Skip to main content
Graduate
April 1, 2024
Question

Flash Memory Erasure Issue on STM32 MCU

  • April 1, 2024
  • 3 replies
  • 1833 views

My flash memory is getting erased in stm32 mcu after I power it off and on What could be the reason?
I'm using stm32l562vet6 on a custom PCB. Once I upload the program untill the power is on the program executes properly even if I disconnect the st-link keeping the power off. But once I turn it off and on the program is seemed to be erased.

Any help will be greatly appreciated!
Thank you in advance
with regards,
Giridhara Datta G

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    April 1, 2024

    hello,

    How are you sure the program is erased? did you check the flash content with STM32CubeProgrammer for example?

    Graduate II
    April 1, 2024

    It's physically erased or doesn't appear to run?

    Show memory space with STM32 Cube Programmer. 

    Use tool to write.

    Check code build address and SCB->VTOR settings. 

    Have Error_Handler() and HardFault_Handler() outputting actionable information. 

    Graduate
    April 1, 2024

    No I'm sorry It's not getting erased physically..Screenshot 2024-04-01 143229.png
    As you said the program is not starting after the power off and on.
    And also as I observed now , the program is getting halted even I i press the reset button.

    Here is the SCB->VTOR value:
    Screenshot 2024-04-01 144342.png

     

    Where 

    VECT_TAB_BASE_ADDRESS = (0x08000000UL)

    and

    VECT_TAB_OFFSET = 0x00000000U



    Technical Moderator
    April 1, 2024

    Check the boot configuration and boot pin

    Graduate
    April 1, 2024

    No Sorry, I had not checked with the stm32cube programmer before.
    Now I did, I compared the memory with the .elf file. It turns out the program is not getting erased but it is just not executing the program.
    I'm just running the blink LED program to debug the error.