Re: EEPROM guarantees after power loss during a write
- From: John Devereux <jdREMOVE@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 07 Feb 2008 16:57:07 +0000
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
.
- References:
- EEPROM guarantees after power loss during a write
- From: John Devereux
- Re: EEPROM guarantees after power loss during a write
- From: ssubbarayan
- Re: EEPROM guarantees after power loss during a write
- From: John Devereux
- Re: EEPROM guarantees after power loss during a write
- From: ssubbarayan
- Re: EEPROM guarantees after power loss during a write
- From: John Devereux
- Re: EEPROM guarantees after power loss during a write
- From: David Brown
- EEPROM guarantees after power loss during a write
- Prev by Date: Re: z80 memory io selection
- Next by Date: Re: Scripting tools under Windows
- Previous by thread: Re: EEPROM guarantees after power loss during a write
- Next by thread: Re: EEPROM guarantees after power loss during a write
- Index(es):
Relevant Pages
|