cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading STM32L152 EEPROM: works only after (short) debug session

mk299
Associate III

In my project I write some bytes to the internal EEPROM of a STM32L152CB. While running a debug session I can verify that the data has been stored correctly. At power up I read the EEPROM data and store it in some variables. As the MCU is configured as USB HID I can read those variables from RAM via a custom USB tool.

If I run the program in a debug session, I can read the expected data via the USB tool. But when the device powers up normally (without debugging) I always read 0x00 via USB from those variables. I did not change the EEPROM content nor did I reflash the binary between those 2 tries.

I use:

  • BMP as debugger
  • STM32L1 HAL
  • GNU Arm Embedded Toolchain 7 q4

What can cause this issue? Could it be a problem in conjunction with a DFU bootloader?

2 REPLIES 2

Outside of the debugger, try using your own code to dump the memory content of the EEPROM as it sees it.

Should be around 0x08080000 as I recall.

I don't recall there being any specific clocks, or unlock sequences to read it.

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

I have the USB connection and the USB tool to read it. I use the same tools and procedures in both cases: while debugging and while not debugging. But with different results. I do nothing special in my debug session; only connect, restart and run. I'm not even reflashing the binary.

When I examine the memory @ 0x8080000 I can see the expected values, although I was not able to read them before (without debugging session).