Hi,
It is caused by ECC error, most likely. Each word in data flash memory has hidden 7bit ECC syndrome. The ECC mechanism provides correction of single-bit faults and reporting of multiple-bit errors.
ECC error can occur if:
- erase or program operation is terminated by unexpected reset, so the flash is left in undefined state
- if we programmed word in data flash that is not fully erased (different from 0xFFFFFFFF)
- if we performed too many erase/program cycles (flash wear-out)
In case of single-bit fault, the ECC circuitry automatically corrects the data. In case of multiple-bit error, the flash controller returns bus error and exception is triggered. Take a look at this document and examples for details:
https://community.freescale.com/docs/DOC-103300
The solution is to erase whole flash block. Then it can be programmed and read again.
Regards,
Lukas