Disable Flash ECC NMI Issue
Hello,
I am currently developing a Bootloader for a STM32H562. The Bootloader checks, if there is a valid application present by calculating a checksum over the application area. To avoid getting ECC errors during the checksum calculation, I disable the ECC NMI for this procedure. (see attached code snippet image "Code_CRC.png")
Summary of the planned procedure:
* disable ECC NMI
* read data from the flash memory
* enable ECC NMI
Unfortunately, the NMI is still generated even though I have disabled its generation by the bit "ECCNMI_MASK_EN" in the "SBS_ECCNMIR" register.
In my test case I write 4 words at the flash address 0x0800'8000. Then I write 4 different words again at this location (without erasing) which seems to cause an ECC double bit error at this location.
Now I reset the processor and execute the procedure in the code snippet. I set a breakpoint at line #111.
With my debugger I can verify that the "ECCNMMI_MASK_EN" bit is set to 1 (=> see attached image "SBS_Regs.png")
The function in line #111 simply does *(uint32*)0x08008000. If I step over this line, the processor gets caught in the NMI handler. The Flash double bit error flag "ECCD" in register "FLASH_ECCDETR" is set. (=> see attached image "FLASH_ECCD_Err.png").
Why is the NMI still generated?
During this procedure, the ICACHE and the Flash prefetch are active. May this cause this issue?
Edit: Tried it with disabled ICACHE and disabled Flash prefetch => does not make a difference.
Thank you,
Markus
