Electronic – Storing settings/data on microcontrollers non-volatile memory (STM32F103)

microcontrollernon-volatile-memorystm32

I want to be able to store values in a non-volatile memory so that the microcontroller can load these settings at start up. These settings might change at run-time and it is important for the systems functionality that these settings are stored.

As far as I know the only non-volatile memory on the STM32F103 is the flash. Is it possible to save values on flash someplace at run-time?

I also have the possibility to use a SD card and the SDIO or SPI interface to store the values there, but if possible it would be best if a SD card can be avoided.

The amount of data is only a few hundred bytes at most.

Best Answer

From what i know there are two options:

  • Use flash (emulated as EEPROM for ease of use) according to this Appnote
  • Use the backup registers (20 byte of battery backed registers) according to the Reference Manual Pages 67 And 79

By The Way if the you move one of the bigger brothers (F2-F4) of this chip you get a whole part of ram battery backed something like 4k but it depends on the actual chip