08M2 EEPROM Life span

#1
Hi All,

I've a project in mind that requires a couple of values to be saved when the power is off, but I read a quote in a post that the 08M2 will only handle around 10,000 write cycles to EEPROM, which won't be enough.

I've had a look through the datasheet for the 08M2 and it states that the chip itself can be reprogrammed at least 100,000 times, which hints that the above quote is a typo - as a comparison, the 24LC16B serial EEPROM datasheet states "1,000,000 erase/write cycles guaranteed".

Can anyone confirm the lifespan of writing to internal EEPROM on an 08M2?

Additionally, is the quote for a given memory slot, as in if "write 0,b1" and "write 1,b1" were both executed, would each command use one of the 10,000 lives, or is does bytes 0 have 10,000 to use, byte 1 have 10,000, byte 2 have 10,000 etc? If this is the case I can spread the load across individual bytes and not have to resort to using an external EEPROM chip.

Any info glady received :)

Shaggy
 

lbenson

Senior Member
#2
100,000 eeprom writes is the figure most often cited. Someone tested until failure and got, if I recall correctly, 400,000+ writes, but that is not a figure you should design for. At least on external eeproms, it's 100,000 (or more) per block--typically 16 bytes--"write 0,b1 :write 1,b1" would count as two writes, "write 0,b1 ,b2" would count as one, and "write 0,b1 :write 16,b1" would count as one for each of the two 16-byte blocks.

But I don't know about the block characteristics for internal eeprom, and it could differ by chip.
 
#5
#6
A couple of times a day, but I think I'm going to go with monitoring the power supply and writing once when it drops.
This is what I did with an electric bike energy meter, where I wanted to store the remaining battery energy on power down, so I could reload it when the bike was next turned on. With a modest capacitor on the Picaxe supply and by detecting the voltage on the supply before the voltage regulator, you can comfortably store quite a lot of data and cleanly shut the Picaxe down, before the regulated power rail starts to dip.
 

techElder

Well-known member
#7
What is an EEPROM "failure?" Can it be detected by read after write programming?

You have enough EEPROM available that you could produce a power down routine that used a test and if "failure" then move to a different EEPROM location.

Or just sequence to a different location regularly based on some parameter in your program.

There must be several ways to overcome the problem you're imagining.
 
#9

marzan

Senior Member
#10
This is what I did with an electric bike energy meter, where I wanted to store the remaining battery energy on power down, so I could reload it when the bike was next turned on. With a modest capacitor on the Picaxe supply and by detecting the voltage on the supply before the voltage regulator, you can comfortably store quite a lot of data and cleanly shut the Picaxe down, before the regulated power rail starts to dip.
I am interestedon how you did this. I gather it detects the loss of power on the high side of the regulator. Was that done with a voltage divider And i'm guessing an interupt ? Ilike the idea of just writing to eeprom only at shutdown, not every change of event.
Marz.
 

hippy

Technical Support
Staff member
#11
I would guess it's a circuit much like this -
Code:
            .---.                          .-----
Vbat >--.---|REG|---|>|---.----------------| V+
        |   `-.-'         |     __         |
        `-----|-----------|----|__|---.--->| C.x
              |         __|__        .|.   |
              |         ==.==        |_|   |
              |           |           |    |
0v >----------^-----------^-----------^----| 0V
                                           `-----
With a program such as this -
Code:
MainProgram:
  Do : Loop Until pinC.x = 1
  Do
    If pinC.x = 0 Then PowerFailed
    :
  Loop

PowerFailed:
  Write 0, (...)
  End
That polls the pin but could also be set-up to act on an interrupt when C.x goes low as you suggest.
 

Circuit

Senior Member
#12
Probably not directly useful to the questioner, but worth noting for others perhaps who may look to this issue; if there is a battery-backed DS1307 clock chip in the circuit then the RAM on that can be very useful for storing values between power-downs without fear of wearing the storage out as in the case of the EEPROM. I have just been finishing a circuit where I need to store variables frequently and preserve the values in case of power-downs. 56 bytes of battery-backed RAM is available on the chip and a useful link on this forum is https://picaxeforum.co.uk/threads/ds1307-flash-memory-usage.10867/
 

PhilHornby

Senior Member
#13
Something which occured to me...

Rather than "END" the program, it might be better to check whether the power-off condition still exists. If not, normal program flow could be resumed.

(It would presumably be possible for it to be a transitory condition, which didn't actually affect the functioning of the Picaxe and its connected components (because of the capacitor after the diode). This condition would be more likely if using an interrupt to detect it).
 

marzan

Senior Member
#14
Something which occured to me...

Rather than "END" the program, it might be better to check whether the power-off condition still exists. If not, normal program flow could be resumed.

(It would presumably be possible for it to be a transitory condition, which didn't actually affect the functioning of the Picaxe and its connected components (because of the capacitor after the diode). This condition would be more likely if using an interrupt to detect it).
Good point @PhilHornby. I was wondering if a small bypass cap on the pin would be a good idea to "smooth out" the voltage on that pin in case the current going to the stepper causes a voltage drop. I don`t really understand where on the falling edge that the interrupt reacts.
Marz.
 
#15
I just had my first ever Eeprom address failure two days ago.
This location would only be written to at most, 50 times a day. And that only when its task was active. Maybe once a week.
This was in use in an M2 series; and had been in operation for 10 months.

The reason I picked it up, was that some of my display data was corrupted.
I tracked down were the error was originating from, and assumed it may be that Eeprom address. So I changed it to another location. Now its all good.
I would be surprised if this address has seen more than 5000 writes. So it seems that failures can just occur some times :confused:
 
#17
I am interestedon how you did this. I gather it detects the loss of power on the high side of the regulator. Was that done with a voltage divider And i'm guessing an interupt ? Ilike the idea of just writing to eeprom only at shutdown, not every change of event.
Marz.
The schematic and code is in this thread on the Endless Sphere forum: https://endless-sphere.com/forums/viewtopic.php?f=2&t=22675

It works much as @hippy suggested earlier.
 
Top