Using an STM32H753, I have boot code in bank 1, sector 0 (0x08000000
) that detects and jumps to application code in bank 2, sector 0 (0x08100000
). In the application code I am trying to erase and rewrite bank 1 sector 0, but the MCU locks up (with no fault handler output) when I set FLASHH7_CR_START
too soon after reset.
The application code is quite sophisticated and enables many features of the chip, but neither bank swapping nor FLASH CRC. The fault handler is known to work.
Things I have tried:
- busy wait 50-100ms from reset before erasing; succeeds
- redirect erase/rewrite to bank 1, sector 5; succeeds (without busy wait)
- application code leaves caches disabled; still fails
- compare FLASHH7 register bank at reset and 100ms later; no change
- check errors in
SR
and clear any detected withCCR
; no errors found - check
WRP
andPRAR
registers; no protection set - check errata rev6 (19 Jun 2019); no relevant issues
The boot code does not enable any interrupts or caches and the application code writes to VTOR
.
It seems there is something else time-sensitive about erasing the STM32H7 boot sector (or recently executed sector). What am I missing?