I am now using Flash data(P/N:S32K144) with the following problems:
When Flash Sector erasing fails or not erased, write to that sector using a write command, and then Reading that sector through a pointer. this progress produces a HardFault, meanwhile register FERSTAT DFDIF bit will be seted to 1(namely This generates an uncorrectable ECC error).
my question is:
1:Is there a better way to deal with the uncorrectable ECC error and DFDIF = 1? or just only erase problematic Flash?
2:Is there any way to get this error state of whole flash quickly after the MCU is powered on?
Hello,
1. I would like to suggest to follow the safety manual, you can handle double-bit error interrupt in different ways. It depends on your application requirements. See the section below from the AN12522
On S32K it's possible to erase only a single sector which is much faster.
FLASH ECC error handling in the AN12522:
https://www.nxp.com/docs/en/application-note/AN12522.pdf
2.
Generally, you can check if the flash is erased before programming. To verify that the Flash is correctly erased or programmed you can use the following commands (Read 1s Block, Read 1s Section, Read 1s All Blocks, Program Check), please, refer to the RM rev 12.1 section 36.5.10 Margin read commands.
Or the ECC is checked during reading memory.
I hope it helps.
Best regards,
Diana