Forcing a FLASH ECC error on a STM32G4
Hi
Earlier today I was demonstrating a IAP functionallity with dualbanking on a stm32G474RET. I was saying that it cannot fail as I check the written image with a CRC after it has been written to the new bank.
As I power of the system mid transfer and power it up again, I experience the what we now all expect. It obviously failed.
My system no longer boots normally and as i start to debug it i see that i get a NMI. Now, I unfortunately did not record all the relevant register values, but i am pretty sure that what was set was FLASH_ECCR, bit ECCD. I know this because i see that the NMI trigger as i am doing a boot blank check and CRC on both my banks and the NMI triggers while i am reading from the bank i was writing to.
I have now written a suitable NMI handler to deal with this situation in the future, but how can I intentionally force a double ECC error in a given address in flash?
Best regards
Martin
