2020-07-25 05:43 PM
It also doesn’t erase after starting new debug session. Is that expected behavior?
I am using STM32L476, and I downloaded X-CUBE-EEPROM software package, included it into my project and it works fine. EEPROM content is retained after NVIC_SystemReset() and after power up, which is great. But I want to start with clean EEPROM every time I flash new code or start a new debug session.
In X-CUBE-EEPROM example code, in EE_Init() it calls EE_Format() if no active page is present, but it never goes there, except first time every EEPROM is initiated.
I couldn’t find any way around this?
Appreciate your help.
Solved! Go to Solution.
2020-07-26 05:55 AM
EEPROM is emulated on end of flash and your code is less size. Check setings for flash code, default is i mean erase only sectors for code
then when you flash new version EEPROM stay valid and untouched
2020-07-26 01:25 AM
workaround: use the compilation date and or time to put it in eeprom area and compare with the one in flash. if mismatch after reset, format and write the new time...
2020-07-26 01:25 AM
you can also do it manually coding a version number to reduce space
2020-07-26 03:57 AM
Having some kind of version info stored with your EEPROM data is always a good idea. If you want to start "with clean EEPROM every time I flash new code or start a new debug session" you can call EE_Format() manually. You also may do that conditionally only in the Debug configuration by using "#ifdef DEBUG".
2020-07-26 05:55 AM
EEPROM is emulated on end of flash and your code is less size. Check setings for flash code, default is i mean erase only sectors for code
then when you flash new version EEPROM stay valid and untouched
2020-07-26 07:19 AM
The code doesn't understand what situations you want persistent memory to stop being persistent.
Use Erase All or Mass Erase options when uploading new firmware to debug.
2020-07-27 12:51 PM
I am using STM32 IDE (Eclipse based) and I can't find Erase All or Mass Erase options, and also any other settings regarding flashing the code to target.
I will explore recommended options and decide what works best for me.
Thank you all.
2020-07-27 01:14 PM
Yeah, probably a checkbox item in the debug settings. In Keil we have Flash -> Erase from the top level IDE
In the debug settings Flash Download, Download Function, Erase Full Chip