ECC testing in flash memory
For details on dedicated memory methods, refer to the product Reference Manual.
The double write method requires writing sequences of preselected data, matching the length the flash memory word to an empty flash memory address. The memory must not be erased between writes. Reading after the second write triggers the ECC interrupt.
ECC sequences lists sequences that lead to SEC and DED errors for different flash memory word lengths.
The disturbed write method is sensitive to accurate synchronization between the reset and programming operations. It is necessary to execute from SRAM, or at least from a different flash memory bank. Start programming, and then, after a delay of a few microseconds, force a reset. Reading the written address after the reset should trigger the ECC error. It is easy to generate multiple bit errors this way, while consistently reproducing single‑bit errors is difficult. The recommended pattern is to flip a single bit in the written data to 0 and time the reset so that the bit is written and the ECC is not updated.
Some products have the EDATA option, where certain flash memory pages can be reconfigured from code (8‑Kbyte page, 9-bit ECC) to data (6‑Kbyte page, 6-bit ECC). A page reconfigured to 6-bit ECC starts with ECC errors before the first erase because the reconfiguration scrambles the memory contents.
It is possible to keep the memory location programmed with user-created incorrect ECC to reproduce the error as needed. The error is encountered on each read access.
