Re: EEPROM guarantees after power loss during a write



David Brown <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

John Devereux wrote:

update():

a) mark copy 1 invalid
b) write new copy 1
c) mark copy 1 valid

[same again for copy 2]

startup(): any copy marked invalid is replaced by the copy marked
valid.

The steps happen in strict order. Each previous step must complete
successfully before the next is started. So the only way the valid
flag can be set is if the data has been successfuly written, without
interruption.

[...]

A better method is to have a version stamp along with your data. You
have two blocks, each structured as "version stamp, data". At
startup, you verify each block based on having a valid version (and
possibly a checksum as well, if you are particularly paranoid). The
latest valid version shows which block you use as your data.

For an update, you erase the block containing the older version of the
data. Then you save your data to this block, then you write your new
version stamp. There is no need to write your data a second time - it
gives no advantages, and halves your eeprom/flash life expectancy.

That does seem a better idea. I have used versioned structures before,
for a flash based system. So I don't know why I did not suggest it
here too.


--

John Devereux
.



Relevant Pages

  • Re: EEPROM guarantees after power loss during a write
    ... mark copy 1 invalid ... startup(): any copy marked invalid is replaced by the copy marked valid. ... If writing of data is interrupted, then the flag never set ...
    (comp.arch.embedded)
  • Explorer causing errors; need to reinstall W98?
    ... Under OS 10.3.3 in Virtual PC 6.1.1, I get error on startup that reads, ... "ScanDisk detected an invalid long filename entry on this drive but was ... I hadn't used VPC since then. ... Today I slowly dragged each prep test file and folder I could find to the ...
    (microsoft.public.mac.virtualpc)
  • Re: what is etymology? (linguistics and biology)
    ... it was Hebrew. ... produce some evidence of such a late dating of Mark. ... Invalid comes ... a neutral word again - neutral words are charged by hate, ...
    (sci.lang)
  • Re: Switchboards
    ... > Hold down the shift key when you open your database. ... > switchboard form from opening at startup. ... prevents the "startup options" from running AND, also, prevents an AutoExec ... "Mark Day" wrote in message ...
    (microsoft.public.access.security)