Skip to main content
Apr 27, 2025 7:07 PM UTC
Solved

hard fault during flash programing

hi. i am trying to save a data into stm32h7b0vbt6 flash memory. so i have used HAL_FLASHEx_Erase to erase one of the sectors and HAL_FLASH_Program to program it. Screenshot 2025-04-27 221957.pngScreenshot 2025-04-27 222042.png

it works and flash will be programed.

Screenshot 2025-04-27 222127.png

but when debuging, code gets stuck to while of the void HardFault_Handler(void) and it doesn't continue. how i fix it?

Screenshot 2025-04-27 222210.png

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Apr 27, 2025 7:14 PM UTC

At 8K in you're probably erasing the application itself.

Use a sector at the END of memory, not the front.

Look at what is actually reported by the Hard Fault.. the memory address and the processor registers.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

1 reply

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Apr 27, 2025 7:14 PM UTC

At 8K in you're probably erasing the application itself.

Use a sector at the END of memory, not the front.

Look at what is actually reported by the Hard Fault.. the memory address and the processor registers.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..