How can I detect that a PSoC® 1 device's flash has become corrupted?
If the project does not contain any EEPROM (or intentionally unprotected) blocks:
Read the checksum value in the PSoC 1 device by using the MiniProg3 programmer and PSoC Programmer's "Read" option. If the checksum does not match with the checksum of the hex file it indicates that that the flash has been corrupted. The hex file is that of the project with which the device was once programmed successfully.
If the project contains any EEPROM (or intentionally unprotected) blocks:
The checksum can show a mismatch with the hex file's checksum even if the flash is not corrupted. This is because some flash locations might have been written by the user application code into the EEPROM blocks.
Use the following approach to identify flash corruption in a project where an EEPROM is present.
When the device is functioning well (for example, immediately after programming), read the checksum of the flash using PSoC Programmer, and then read the EEPROM block values using MiniProg3 and PSoC Programmer's "Read" option. Add the EEPROM block values (you can use a tool such as an Excel sheet to perform this operation) and truncate it to four hex digits. This gives the EEPROM checksum.
Calculate the non-EEPROM blocks (write-protected blocks) checksum with the following formula:
When the device fails and you suspect flash corruption, repeat the operation listed earlier, and find the "Non-EEPROM blocks checksum".
If the "Non-EEPROM blocks checksum" of the failed device is different from the "Non-EEPROM blocks checksum" that was calculated when the device was functioning properly, it confirms that the flash has been corrupted.