cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM Emulation

richardh
Associate II
Posted on March 22, 2013 at 18:02

Hi

Im playing with the ST EEPROM emulation example, what I cannot get my head around is the use of VirtAddVarTab, the example has 3 addresses, but do I need to assign an address in the table for each variable I want to store?

I may well be missing the point (or the plot) but cannot decide either way, plus I can only fin the ST 3 value example.

Any help would be very appreciated, even to point out my stupidity lol

#stm32-eeprom-emulation-flash
6 REPLIES 6
Posted on March 22, 2013 at 18:15

It's not just you.

The demo is a little odd, they seem to be trying to implement a journaling like system across a couple of flash pages. The virtual address being a record number, you get the last value written to the record read back. If you think there is some byte level mapping you'll get very confused.

There are better ways of writing calibration or other data to a block of flash, and managing the erasure as required.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
richardh
Associate II
Posted on March 25, 2013 at 10:15

Glad its not me then lol, I genuinely couldn't figure it out. Thanks Clive

Any idea of a decent demo then? only I am unsure of how to implement wear leveling etc, or if I really need to bother etc.  an example would be really useful.

Posted on March 25, 2013 at 18:32

Well in terms of wear leveling, it's going to be a bit difficult as you don't have much in the way of blocks, or relocation capabilities.

Generally you'd want to avoid erasing/writing over the same spot a lot, ideally you'd collect the data you want to save in some type of structure, and then write new copies of that after older versions within the same block, when it comes to reading you index through these until you find the last (most recently written) one. And when you consume all the space in the block, only then erase it and start again. ie you could write a 160 byte structure 100 times to a 16KB block, increasing the life from 10K to 1M operations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
richardh
Associate II
Posted on March 26, 2013 at 12:03

Right, that sounds doable, I will give it a go.  Years of 8 bit micros with a bit of E2 makes you lazy lol

Thanks for the help

meysamfeyzi
Associate
Posted on October 25, 2015 at 15:13

hi dear, i have proble to write data to flash when using eeprom emulation !

i want to use 4096 variable to saving data in storage but i can not to do it,

i can just to save 255 variable in to storage !

why ?

best regads

Posted on October 25, 2015 at 18:43

This is a 2.5 year old thread, consider starting a new thread next time. We don't lock threads here, but use some common sense.

You're using what part, exactly? Why can't you just write your 4K block of data directly to FLASH rather than some awkward EEPROM emulation that records addresses/data. As stated earlier there isn't a byte-to-byte correlation between the size of the FLASH blocks consumed, and the EEPROM emulated.

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