cancel
Showing results for 
Search instead for 
Did you mean: 

Flash Memory Erasure Issue on STM32 MCU

Giridhara_Datta_G
Associate III

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

6 REPLIES 6
SofLit
ST Employee

hello,

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

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Giridhara_Datta_G
Associate III

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.

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



Check the boot configuration and boot pin

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I tired to make it Zero and run again
but it's going back to HIGH state again

Screenshot 2024-04-01 151308.png