cancel
Showing results for 
Search instead for 
Did you mean: 

Nonvolotile EEPROM for configuration parameters

dimax
Senior
Posted on June 14, 2013 at 07:20

In old good 8-bit Architecture (AVR,PIC,...) CPU had a nonvolatile memory region to keep configuration parameters of the application that were persistent over reset. This region had a byte read/write access without erase requirement.

In STM32 I can not find a substitution to this EEPROM and thus I do not know how to keep my application configurations. Although STM32 Flash can be erased/written it is not acceptable. As to write byte I have to erase and rewrite the whole 16K segment (STM32F2).

All I can think about is to use external I2C or  SPI EEPROM.

Are there any other suggestions?

5 REPLIES 5
zzdz2
Associate II
Posted on June 14, 2013 at 09:00

All I can think about is to use external I2C or  SPI EEPROM. 

 

Not bad idea if you can afford it.

The standard solution is to use EEPROM emulation, no need to erase pages frequently:

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257897

dimax
Senior
Posted on June 14, 2013 at 10:53

Thanks.

Went over suggested file and found many interesting things but not EEPROM emulation. But there is a below file instead:

http://www.st.com/web/en/resource/technical/document/application_note/CD00165693.pdf

zzdz2
Associate II
Posted on June 14, 2013 at 11:43

Ah yes, It only provides eeprom emulation software download, no application note.

I think it qualifies as website bug. It should add this link:

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00026574.pdf

Anyway, you don't have to use the provided firmware, you can write your own functions optimized for your specific use.

dimax
Senior
Posted on June 14, 2013 at 13:50

I also was thinking about using 2 Flash sectors to implement EEPROM like memory. But thinking about 16Kx2 (STM32F2xx) of Flash memory being lost for stupid thing made me crazy.

In some document ST wrote that luck of EEPROM in silicon is an approach to make it cheaper. Maybe for F1 devices with 1K or 2K Flash pages this correct but for F2 and higher it's stupidity.

jpeacock2399
Associate II
Posted on June 14, 2013 at 15:46

I use two internal flash sectors for configuration data.  In my apps the parameters are loaded only after a reset.  Permanent changes (infrequent writes) are followed by a reset.  I don't use the configuration parameters in emulated EEPROM mode.

I store two copies of the data block, one in each sector.  This way I'm always guaranteed a good copy after a reset.  When parameters are changes they are written to the ''A'' sector.  After a reset if the ''A'' parameters are intact (good CRC) then I copy them to sector ''B'', the backup.  If the last write failed, sector ''A'' has a bad CRC, then I can reload the previous ersion from ''B''.  I always have at least one good sector for data.

  Jack Peacock