May 10, 2011 AT 3:22 pm

EEPROM Destroyer

John Boxall (tronixstuff) wanted to know just how long the EEPROM in an ATMega328 would last, so he whipped up this neat test program to stress the memory. He writes:

Some time ago I published a short tutorial concerning the use of the internal EEPROM  belonging to the Atmel ATmega328 (etc.) microcontroller in our various Arduino boards. Although making use of the EEPROM is certainly useful, it has a theoretical finite lifespan – according to the Atmel data sheet (download .pdf) it is 100,000 write/erase cycles.

One of my twitter followers asked me “is that 100,000 uses per address, or the entire EEPROM?” – a very good question. So in the name of wanton destruction I have devised a simple way to answer the question of EEPROM lifespan. We will write the number 170 (10101010 in binary) to each EEPROM address, then read each EEPROM address to check the stored number. The process is then repeated by writing the number 85 (01010101 in binary) to each address and then checking it again. The two binary numbers were chosen to ensure each bit in an address has an equal number of state changes.

After both of the processes listed above has completed, then the whole lot repeats. The process is halted when an incorrectly stored number is read from the EEPROM – the first failure. At this point the number of cycles, start and end time data are shown on the LCD.

The result? 1,230,163 write/read cycles (per address) before failure. That’s an order of magnitude+ beyond Atmel’s specs, though Atmel does tend to be conservative with their numbers.

Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!

Maker Business — Raspberry Pi and CoderDojo Join Forces

Wearables — Gold glow

Electronics — Linear Love

Biohacking — Nike’s Unlimited Stadium Will Put Your Best Foot Forward

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


  1. What if it was an Atmel inside a hot device instead?

  2. Good point, Ad.

    Additional thermal stress would almost certainly shorten the lifespan.

  3. Yeah, it may well be that it’s rated for 100,000 cycles at temperatures near the top of its specced operating range. Also, there’s a catch: at least some types of EEPROM and Flash can apparently appear to write successfully, but then lose the data. I suspect the algorithm this uses may avoid that problem, but I’m not sure.

  4. So then how many licks does it take to get to the center of a ATMega328?

    I never made it without Byteing.


  5. I think I readed somewhere that flash memory has like 100,000 r/w cycles, and eeprom memory like 1,000,000 r/w cycles before they start with problems.

  6. Yep, it was on a Microchip pic datasheet. Really don’t know about atmel, sorry 🙂

  7. @Matias: That’s probably closer to reality, as John’s experiment demonstrated, but the official Atmel specs are 10,000 write/erase cycles for flash and 100,000 for EEPROM. Reads are presumably unlimited.

    Like I mentioned in the post, Atmel is probably being very conservative with those numbers.

  8. @Kevin G: Nice!

Sorry, the comment form is closed at this time.