Question

I am developing an application on the existing board. The application requires frequent data(just 10 bytes) storage, So I am thinking have the External flash emulation as EEPROM because my board doesn't have the EEPROM.We have the External spi flash is with us. any one can help me in this emulation or please suggest me the any other approach to full fill my application requirement.

Was it helpful?

Solution

There are a number of libraries that can do what you want. Some years ago i used the Intel library that they provided for their parallel flash chips.

The technique they use is to use additional bytes to designate which value in the flash is valid, and how many bytes the value it occupies. For example the first time a value is written the valid flag is high. When the bye is re-written, the valid flag on the old data is set low, and the new value and flag/byte count data is written in the flash immediately after the old value. When the value is read, you start at the first position, and if the valid flag is low, you use the count to move to where the newer value was stored, and so on until you find a value with the valid flag high.

When an entire sector has been used this way, you need to read the current value, erase the sector, and re-write he current value at the start.

This technique works because a flash bit can be changed form a high to low, but not changed back from a low to a high without erasing.

This explanation is a little simplified, I am sure there will be a tutorial on the web somewhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top