Flash & EEPROM memory maximum life

I've read that these non-volatile memory on the Arduino have a limited life.

Say, if I write and read a 2 byte word to/from the same addresses many times, over their life expectancy, what happens?

Will all memory start performing erraticly? Or just those 2 bytes?

Will the Atmega chip be worthless after that? Or what will really happen?

I am currently saving and reading back that word (thru the serial port) on my host PC hard disk to avoid that. But is it really necessary to do that?

If anybody can help, I'll appreciate it very much.

bibre:
I've read that these non-volatile memory on the Arduino have a limited life.

They do. What you have read is correct.

Say, if I write and read a 2 byte word to/from the same addresses many times, over their life expectancy, what happens?

I have read these are possible failures: erase failure (byte is stuck at the previous value), write failure (byte is stuck at 0xFF), stuck bit (either high or low), retain failure (value gradually turns back to 0xFF).

Will all memory start performing erraticly? Or just those 2 bytes?

With EEPROM, just those two bytes. I believe Flash is also byte-wise so just those two bytes would fail. In the worst case, Flash is page-wise so the page would have problems.

Will the Atmega chip be worthless after that?

In my opinion, yes. It is not worth the potential headache when a replacement processor costs about $5.

I am currently saving and reading back that word (thru the serial port) on my host PC hard disk to avoid that. But is it really necessary to do that?

Let's do some math... In simple terms, Atmel guarantees 100,000 EEPROM writes over 20 years. That is 5000 writes per year. ~13.7 writes per day. 13.7 writes per day every day for 20 years. Guaranteed to work.

How often do you need to write the value?

How often do you need to write the value?

Well, ideally every time I change the position of a turnout (switch or point in the UK) in my model railroad. I do not change the turnouts very often anyway.

It is not really important since it's just my hobby but that's a way to really know what the last turnout status is for the next running session, specially if there's a power interruption or something.

I guess I'll stick to my current sketch talking to my FreeBasic host program. It's not worth to risk the whole chip, specially if its not in a socket.

I was just curious of what would happen. And yes, I agree that those bytes will tend to be 0xFF.

Thank you. :slight_smile:

Less often talked about is the 10,000 write limit of PROGMEM. However, most people can't click upload in the IDE fast enough to wear out PROGMEM.

Thank you, James! :slight_smile:

Not with the IDE.

PROGMEM writes to program flash mem, correct? That's what I was refferring to. Max 10k writes for flash mem and 100k writes to EEPROM.

I am monitoring 44 pushbuttons in loop(), so I could easily write too many times/sec to PROGMEM, if my code were not right.

Anyway, it was my scientific curiosity, Descartes' Methodical Doubt.

@bibre, close but not quite...

bibre:
Max 10k writes for flash mem and 100k writes to EEPROM.

Correct

bibre:
I am monitoring 44 pushbuttons in loop(), so I could easily write too many times/sec to PROGMEM, if my code were not right.

Not correct.

Code executing from program space can not WRITE to PROGMEM. (Only code executing from the bootloader partition can write to PROGMEM.)

Ok so, if I were to use flash memory to save my status word, what would I have to use?

bibre:
Ok so, if I were to use flash memory to save my status word, what would I have to use?

Program code (outside of the bootloader partition) can't save to PROGMEM.

Would I then have to use EEPROM mem to save non-volitile data? I'm confused, I though I could also use flash mem for this purpose.

@Coding Badly

I forgot to mention that in 20 years I know where I'll be and the trains and electronics will not be as important as my Celestial harp. Just check my profile, I'm a class 46 baby boomer, he he! :stuck_out_tongue_closed_eyes:

EEPROM is organized into pages of 4 bytes. So you will wear out 4 bytes at a time. It hopefully goes without saying that you wouldn't write to it unless the relevant thing has changed (eg. the points).

What you might do is write in those 4 bytes something like:

  • Current value (2 bytes)
  • Counter (unsigned int)

Each time you write, you decrement the counter (it would start at 0xFFFF if I'm not mistaken). Once it hits zero you "discard" (ignore) those 4 bytes and move onto the next 4.

That would give you 65535 writes per 4 bytes. So for 1024 bytes of EEPROM, then 65535 * 256 = 16776960 writes you could do.

Let's assume you change the points once every minute, and don't bother sleeping ever. You could change the points for 31 years before you use up all the EEPROM.

Of course the "current value", being 16 bits, could hold information about 16 sets of points/signals.

@Nick Gammon

Hey Nick !

31 YEARS !!!, No way José!

Please don't ask me to last that long, he, he, he!

Thank you for giving your WISER opinion. That's why you ARE a global moderator.

Q, Nick: Do you ever sleep?

Thanks for being here! :slight_smile: :slight_smile: :slight_smile:

bibre:
Q, Nick: Do you ever sleep?

Timezones. :wink:

I don't think he does sleep!

@CrossRoads,

I concur. Nick HAS TO BE be a zombie or something, he never sleeps. CHECK it out, no timezones!

But to tell you the truth Robert, you and Nick are the most helpful members in this forum.

CrossRoads:
I don't think he does sleep!

I sleep. And I drink. :slight_smile:

Later in the day my posts get a bit more snippy. :wink:

See you tomorrow, Nick. I'm going to watch a movie and then go to sleep, before I pass away!!!

I sleep. And I drink.

WE drink. ¡SALUD Nick!

And I don't think so, you DO NOT sleep amigo. Gracias por ayudarnos. ¿Vete a acostarte YA!!!

As I said before Nick, "never leave this board"

Buenas noches mi amigo.

Naw. EEPROM paging is strictly to facilitate writing by an external programmer. AVR internal EEPROMs really are composed of one byte cells.