Skip to main content
Associate
August 23, 2023
Question

Write variables into non-voaltive memory STM32L010K8T6TR

  • August 23, 2023
  • 2 replies
  • 1007 views

Hi,

 

I need to write a variable, like ID , for a new design.

This ID during the normal program execution the user can change in order to assing a new ID. In the next re-start this new ID must to be can read.

someone could me help to implement this function?

thank

This topic has been closed for replies.

2 replies

TDK
Super User
August 23, 2023

The STM32L010K8 has 256 bytes of EEPROM at address 0x08080000. That data is nonvolatile.

https://www.st.com/resource/en/datasheet/stm32l010k8.pdf

If that's not enough, dedicate a page of flash to store data. You'll need to erase it before you can write to it, but once written, the value will stay there until it's changed. Note that erasing a flash page takes a little bit, tens to hundreds of ms or so.

"If you feel a post has answered your question, please click ""Accept as Solution""."
loopis80Author
Associate
August 24, 2023

Hi, 

Do you know where I can find a example of code to do?

 

TDK
Super User
August 24, 2023
uint8_t data * = (uint8_t data *) 0x08080000;
data[0] = 42;
data[1] = 102;
if (data[0] == 42) {
 ...
}

I imagine you use it as normal memory.

"If you feel a post has answered your question, please click ""Accept as Solution""."