STM32H503: random ECC/NMI on flash read after bootloader jump
Hi,
I have a bootloader (0x08000000) jumping to an application (0x0800C000) on an STM32H503CB, everything at 32 MHz HSI, VOS3. The bootloader runs at 1WS flash latency, disables the ICACHE and jumps.
About 1 boot in 5, the app dies in the NMI handler right after the jump: FLASH_ECCDETR shows a double ECC error on the very flash line being fetched, at a different address every time. The flash content is intact when read back over SWD - the read just fails transiently. It also depends on the chip: 2 of my 3 boards reproduce it, one never does.
If I restore the latency to 3WS (the reset value) in the bootloader just before jumping, the problem disappears completely (200+ reset campaigns, zero failure).
My question: why is the H5 sensitive to flash wait states in this situation? 1WS at 32 MHz / VOS3 should be enough on paper, and the bootloader itself runs fine with it. Is there something specific about executing uncached from flash right after a bootloader handover that requires more margin, and is restoring the reset latency before jumping the recommended practice?
Jonathan
