2013-03-22 10:02 AM
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-flash2013-03-22 10:15 AM
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.2013-03-25 02:15 AM
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.2013-03-25 10:32 AM
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.2013-03-26 04:03 AM
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
2015-10-25 07:13 AM
2015-10-25 10:43 AM
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.