cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM emulation on stm32f0 using HAL drivers

lightaiyee
Associate II
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
4 REPLIES 4
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 Venmo
Up vote any posts that you find helpful, it shows what's working..
lightaiyee
Associate II
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 II
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.

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 Venmo
Up vote any posts that you find helpful, it shows what's working..