EmbeddedRelated.com
Forums

EEPROM guarantees after power loss during a write

Started by John Devereux February 5, 2008
Hi,

I am wondering what guarantees are there for existing EEPROM data,
after power is lost during a write operation?

I am writing a datalogging routine that writes records to an
EEPROM. It's an Atmel 24C1024, although the question is probably
applicable to other devices too. This uses "page mode" for writes -
the device seems to be organised as 256 byte pages.

Say power is lost during a write to a single byte in a page. What can
I assume? Is just that byte suspect, or the whole page (or the whole
device)? 

The microcontroller has brownout protection, so isn't going to run
wild - but what about the EEPROM internal state machine? Are they
generally protected against brownout?

If I write a single byte, does this in fact involve a hidden
erase/write of the whole page?

I can't find any information on this stuff.

-- 

John Devereux
> Say power is lost during a write to a single byte in a page. What can > I assume? Is just that byte suspect, or the whole page (or the whole > device)?
The answer to this question depends rather much on whether your external brownout protection also asserts the write protect pin...
larwe <zwsdotcom@gmail.com> writes:

>> Say power is lost during a write to a single byte in a page. What can >> I assume? Is just that byte suspect, or the whole page (or the whole >> device)? > > The answer to this question depends rather much on whether your > external brownout protection also asserts the write protect pin...
I would like to know the situation where this does not happen (i.e. no external brownout detection). Actually in the case of the AT24C1024, it looks pretty useless anyway. It is active high, which still leaves the question of brownout behaviour open. And the datasheet implies it only provides write protection if asserted *before* the write. -- John Devereux
John Devereux wrote:
> Hi, > > I am wondering what guarantees are there for existing EEPROM data, > after power is lost during a write operation? > > I am writing a datalogging routine that writes records to an > EEPROM. It's an Atmel 24C1024, although the question is probably > applicable to other devices too. This uses "page mode" for writes - > the device seems to be organised as 256 byte pages. > > Say power is lost during a write to a single byte in a page. What can > I assume? Is just that byte suspect, or the whole page (or the whole > device)? > > The microcontroller has brownout protection, so isn't going to run > wild - but what about the EEPROM internal state machine? Are they > generally protected against brownout? > > If I write a single byte, does this in fact involve a hidden > erase/write of the whole page? > > I can't find any information on this stuff. >
You'd have to ask Atmel to know for sure. In a similar situation, I've added an electrolytic cap big enough to power the MCU and EEPROM for the time necessary to complete the write.
Arlet Ottens <usenet+5@c-scape.nl> writes:

> John Devereux wrote: >> Hi, >> >> I am wondering what guarantees are there for existing EEPROM data, >> after power is lost during a write operation? >> >> I am writing a datalogging routine that writes records to an >> EEPROM. It's an Atmel 24C1024, although the question is probably >> applicable to other devices too. This uses "page mode" for writes - >> the device seems to be organised as 256 byte pages. >> >> Say power is lost during a write to a single byte in a page. What can >> I assume? Is just that byte suspect, or the whole page (or the whole >> device)? >> >> The microcontroller has brownout protection, so isn't going to run >> wild - but what about the EEPROM internal state machine? Are they >> generally protected against brownout? >> >> If I write a single byte, does this in fact involve a hidden >> erase/write of the whole page? >> >> I can't find any information on this stuff. >> > > You'd have to ask Atmel to know for sure.
I did that - no answer I'm afaid. :(. Maybe Ulf knows? (hint, hint) :)
> In a similar situation, I've added an electrolytic cap big enough to > power the MCU and EEPROM for the time necessary to complete the > write.
I am trying to avoid any hardware changes. I can afford to dedicate whole pages to records, and to record status "bytes". But if the entire memory is suspect there is not much I can do. -- John Devereux

John Devereux wrote:

> I am wondering what guarantees are there for existing EEPROM data, > after power is lost during a write operation? > > I am writing a datalogging routine that writes records to an > EEPROM. It's an Atmel 24C1024, although the question is probably > applicable to other devices too. This uses "page mode" for writes - > the device seems to be organised as 256 byte pages. > > Say power is lost during a write to a single byte in a page. What can > I assume? Is just that byte suspect, or the whole page (or the whole > device)?
I don't think anybody can tell for sure what can happen to the flash write state machine when the power goes down at sudden. Hopefully it will not have enough time to destroy the whole device, so something like the journaling file system could help. You can also consider the autostore NVRAMs from Simtek: http://www.simtek.com/simtekSite.php Those parts are designed for the random power outages. Works very well indeed. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On 2008-02-05, John Devereux <jdREMOVE@THISdevereux.me.uk> wrote:
> Hi, > > I am wondering what guarantees are there for existing EEPROM data, > after power is lost during a write operation? > > I am writing a datalogging routine that writes records to an > EEPROM. It's an Atmel 24C1024, although the question is probably > applicable to other devices too. This uses "page mode" for writes - > the device seems to be organised as 256 byte pages. > > Say power is lost during a write to a single byte in a page. What can > I assume? Is just that byte suspect, or the whole page (or the whole > device)? > > I can't find any information on this stuff.
Atmel was very up front with me when I e-mailed their support address with that exact question. They said that the byte being written to when the power failed will be undefined, but everything else will be OK. -- Grant Edwards grante Yow! It was a JOKE!! at Get it?? I was receiving visi.com messages from DAVID LETTERMAN!! !
Grant Edwards <grante@visi.com> writes:

> On 2008-02-05, John Devereux <jdREMOVE@THISdevereux.me.uk> wrote: >> Hi, >> >> I am wondering what guarantees are there for existing EEPROM data, >> after power is lost during a write operation? >> >> I am writing a datalogging routine that writes records to an >> EEPROM. It's an Atmel 24C1024, although the question is probably >> applicable to other devices too. This uses "page mode" for writes - >> the device seems to be organised as 256 byte pages. >> >> Say power is lost during a write to a single byte in a page. What can >> I assume? Is just that byte suspect, or the whole page (or the whole >> device)? >> >> I can't find any information on this stuff. > > Atmel was very up front with me when I e-mailed their support > address with that exact question. They said that the byte > being written to when the power failed will be undefined, but > everything else will be OK.
Thanks Grant, that's great - it gives me a lot of confidence it is worth doing this. -- John Devereux
John Devereux wrote:
> larwe <zwsdotcom@gmail.com> writes: > > >>>Say power is lost during a write to a single byte in a page. What can >>>I assume? Is just that byte suspect, or the whole page (or the whole >>>device)? >> >>The answer to this question depends rather much on whether your >>external brownout protection also asserts the write protect pin... > > > I would like to know the situation where this does not happen (i.e. no > external brownout detection). > > Actually in the case of the AT24C1024, it looks pretty useless > anyway. It is active high, which still leaves the question of brownout > behaviour open. And the datasheet implies it only provides write > protection if asserted *before* the write.
If this is important, it sounds like the sort of thing you should run some agressive tests on. Make the power fail during a write, and see what happens ? All writes have to have a 'hidden erase', so check you can see that 'on demand' and then look around for collateral damage.... There are FRAMs, and I saw someone just released a 32KB SPI SRAM too. -jg
On Tue, 05 Feb 2008 19:44:50 +0100, Arlet Ottens wrote:

> John Devereux wrote: >> Hi, >> >> I am wondering what guarantees are there for existing EEPROM data, >> after power is lost during a write operation? >> >> I am writing a datalogging routine that writes records to an EEPROM. >> It's an Atmel 24C1024, although the question is probably applicable to >> other devices too. This uses "page mode" for writes - the device seems >> to be organised as 256 byte pages. >> >> Say power is lost during a write to a single byte in a page. What can I >> assume? Is just that byte suspect, or the whole page (or the whole >> device)? >> >> The microcontroller has brownout protection, so isn't going to run wild >> - but what about the EEPROM internal state machine? Are they generally >> protected against brownout? >> >> If I write a single byte, does this in fact involve a hidden >> erase/write of the whole page? >> >> I can't find any information on this stuff. >> >> > You'd have to ask Atmel to know for sure. > > In a similar situation, I've added an electrolytic cap big enough to > power the MCU and EEPROM for the time necessary to complete the write.
And a status pin that tells you that power's still up before you commence the write, and something to make sure that you don't branch off to a higher priority task during the write, and ... -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html