Skip to main content
lightaiyee
Associate
May 23, 2016
Question

EEPROM emulation on stm32f0 using HAL drivers

  • May 23, 2016
  • 4 replies
  • 1458 views
Posted on May 23, 2016 at 12:29

I am trying to emulate EEPROM on stm32f0. There is an application note provided by STM.

http://www.st.com/content/ccc/resource/technical/document/application_note/2e/d4/65/6b/87/dd/40/25/DM00049914.pdf/files/DM00049914.pdf/jcr:content/translations/en.DM00049914.pdf

There are also sample code provided. To my dismay, this EEPROM emulation library uses standard peripheral library and my current code is based on HAL drivers with code auto-generated by CubeMX. 

Is there EEPROM emulation library based on HAL drivers? I would like to use the flash to store some configuration settings. Is no EEPROM emulation library using HAL drivers is available, are there other methods to store config settings on flash?

#eeprom-emulation #flash #stm32f0
This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
May 23, 2016
Posted on May 23, 2016 at 18:39

..are there other methods to store config settings on flash?

Around here we just manage the configuration/calibration structures directly in Flash sectors set aside for that function, rather than pretending it's EEPROM, when it's not.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
lightaiyee
Associate
May 24, 2016
Posted on May 24, 2016 at 04:07

Thanks. EEPROM emulation does sound like an overkill. Would you know where I can get some sample code on how to do this directly on the flash? I am using stm32f0.

Thank you very much. 

rchris
Associate
May 24, 2016
Posted on May 24, 2016 at 10:12

I use EEPROM-Emulation for the F2 (AN3390) coded for the SPL in a HAL project. I manually included the SPL flash driver in my HAL project.  As far as I remember I only had to rename the function FLASH_WaitForLastOperation in the SPL driver because of dual definition. If you want to manage your data in flash directly, remember that the number of write cycles to flash is limited.

Tesla DeLorean
Guru
May 24, 2016
Posted on May 24, 2016 at 18:04

... remember that the number of write cycles to flash is limited.

Pretending it is EEPROM doesn't change those physical properties, it just masks it with the same journaling and ping-pong techniques one could apply treating it directly as Flash, and you'd be more aware of the side-effects and stalling you're going to cause by the erase/write interactions. Better to own the abstraction in my opinion, far less surprises and more efficient.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..