Skip to main content
Explorer II
April 27, 2025
Solved

hard fault during flash programing

  • April 27, 2025
  • 1 reply
  • 389 views

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.
    Best answer by Tesla DeLorean

    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.

    1 reply

    Graduate II
    April 27, 2025

    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.