<p>The EEPROM is <em>not</em> where the program itself is stored, what's relevant for your question is the flash. The flash in the ATmega2560 <a href="http://www.atmel.com/images/atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_datasheet.pdf" rel="nofollow noreferrer">is rated for 10,000 cycles</a> (i.e. you can reprogram it <em>at least</em> 10,000 times).</p>

CC BY-SA 4.0
2019-04-18T13:36:45.070Z
A "cycle" for flash storage is not the writing but is the erasing.  When Flash is written, it must first be erased.  The erase process stresses the device, and over many cycles leads to several failure modes.  Writing data into the erased part is more benign.  Thus, it doesn't matter how big the program is.  "Re-Flashing" starts with an erase cycle, followed by as many programming cycles as necessary.
cmm
CC BY-SA 4.0
2016-03-26T20:36:40.923Z
2018-08-09T10:27:40.237Z
2018-08-09T10:27:40.237Z
Tom van der Zanden
<p>The AVR has SRAM for variables (what is usually called RAM), it has EEPROM for non volatile variables and it has flash for the executable code. (Harvard Architecture!)</p>

<p>For re-flashing the firmware neither SRAM nor EEPROM write rates are important, but the Flash rates are. The flash write rates are in the region of 100 thousand to a million so that should not be a problem.</p>

<p>The article you linked also states that he did not more than 2000 rewrites and therefore should be fine. I can only agree. A few thousand re-flashes is no problem. Once you get closer to 100 thousand you can start to worry.</p>

<p>Flash bits can only be written from 1 to 0. Erasing the flash writes all bits to 1. Erasing can only be done on a flash page (size is device dependent but usually a multiple of 512).</p>

CC BY-SA 3.0
2016-03-27T15:03:55.723Z
2016-11-04T12:31:16.593Z
2016-11-04T12:31:16.593Z
Lars Pötter
<p>First of all I'm working with a Folger Tech Prusa i3 kit, if that makes a difference. Also I believe the Arduino is a Mega 2560.</p>

<p>I know somewhere in the back of my head that electrically programmable ROM like what must be on the Arduino board storing the firmware degrades a little, each time you write to it. Right now I'm trying to calibrate away another print problem, and I think I need to modify the firmware yet again, which I've already done several times. So I'm starting to worry about how many times I can do that.</p>

<p>Well, once I remembered the acronym "EEPROM", and after a little googling, I came across this, <a href="https://www.arduino.cc/en/Reference/EEPROMWrite" rel="nofollow noreferrer">Arduino - EEPROM</a>, which says that it can handle 100k cycles, so I think I'm onto the answer, but the problem is I'm not sure if a cycle is an entire file being uploaded? Wouldn't it be a single blip of data? And if so how many cycles would the average Marlin file consume?</p>

<p>I also found this:</p>

<blockquote>
  <p>but I'd be very surprised if I've uploaded to it more than 2000 times</p>
</blockquote>

<p>on <a href="http://forum.arduino.cc/index.php?topic=58243.0" rel="nofollow noreferrer">Mega2560 bricked? not detected, DFU failing</a>, indicating that the answer might be as low as 2000. </p>

<p>Also, this:</p>

<blockquote>
  <p><strong>Failure modes</strong></p>
  
  <p>There are two limitations of stored information; endurance, and data
  retention.</p>
  
  <p>During rewrites, the gate oxide in the floating-gate transistors
  gradually accumulates trapped electrons. The electric field of the
  trapped electrons adds to the electrons in the floating gate, lowering
  the window between threshold voltages for zeros vs ones. After
  sufficient number of rewrite cycles, the difference becomes too small
  to be recognizable, the cell is stuck in programmed state, and
  endurance failure occurs. The manufacturers usually specify the
  maximum number of rewrites being 1 million or more.[5]</p>
  
  <p>During storage, the electrons injected into the floating gate may
  drift through the insulator, especially at increased temperature, and
  cause charge loss, reverting the cell into erased state. The
  manufacturers usually guarantee data retention of 10 years or more.[6]</p>
</blockquote>

<p>from Wikipedia: <a href="https://en.wikipedia.org/wiki/EEPROM#Failure_modes" rel="nofollow noreferrer">EEPROM - Failure Modes</a>, indicating the answer might be into the millions.</p>

<p>At this point I'm just wondering if an expert might see this and relieve my angst...</p>

CC BY-SA 4.0
2019-04-18T13:40:55.587Z
The AT Mega2560 has internal flash storage, but it helps to look at external flash devices for information.  There are several different grades of external flash devices.  Some can be flashed only a very small number of times, and from these parts the 2000 number may come.  Other, higher-grade parts can be reflashed a million times.  In my work, we usually see ratings of 10,000 for low-cost parts and 100,000 for higher-cost parts.  For integrated flash, there may not be such a range of price and lifetime, since it would complicate the manufacturer's testing and distribution channel.
cmm
<marlin>
How many times can you re-flash the Marlin firmware to a RAMPS 1.4 board before it degrades the ROM?
user273872
# How many times can you re-flash the Marlin firmware to a RAMPS 1.4 board before it degrades the ROM?

(Asked by: username_0 on 2016-03-26)

First of all I'm working with a Folger Tech Prusa i3 kit, if that makes a difference. Also I believe the Arduino is a Mega 2560.

I know somewhere in the back of my head that electrically programmable ROM like what must be on the Arduino board storing the firmware degrades a little, each time you write to it. Right now I'm trying to calibrate away another print problem, and I think I need to modify the firmware yet again, which I've already done several times. So I'm starting to worry about how many times I can do that.

Well, once I remembered the acronym "EEPROM", and after a little googling, I came across this, [Arduino - EEPROM](https://www.arduino.cc/en/Reference/EEPROMWrite), which says that it can handle 100k cycles, so I think I'm onto the answer, but the problem is I'm not sure if a cycle is an entire file being uploaded? Wouldn't it be a single blip of data? And if so how many cycles would the average Marlin file consume?

I also found this:

> but I'd be very surprised if I've uploaded to it more than 2000 times

on [Mega2560 bricked? not detected, DFU failing](http://forum.arduino.cc/index.php?topic=58243.0), indicating that the answer might be as low as 2000.

Also, this:

> **Failure modes**
>
> There are two limitations of stored information; endurance, and data
> retention.
>
> During rewrites, the gate oxide in the floating-gate transistors
> gradually accumulates trapped electrons. The electric field of the
> trapped electrons adds to the electrons in the floating gate, lowering
> the window between threshold voltages for zeros vs ones. After
> sufficient number of rewrite cycles, the difference becomes too small
> to be recognizable, the cell is stuck in programmed state, and
> endurance failure occurs. The manufacturers usually specify the
> maximum number of rewrites being 1 million or more.[5]
>
> During storage, the electrons injected into the floating gate may
> drift through the insulator, especially at increased temperature, and
> cause charge loss, reverting the cell into erased state. The
> manufacturers usually guarantee data retention of 10 years or more.[6]

from Wikipedia: [EEPROM - Failure Modes](https://en.wikipedia.org/wiki/EEPROM#Failure_modes), indicating the answer might be into the millions.

At this point I'm just wondering if an expert might see this and relieve my angst...

**Tags:** marlin
> **Comments:**
> **username_1**: The AT Mega2560 has internal flash storage, but it helps to look at external flash devices for information.  There are several different grades of external flash devices.  Some can be flashed only a very small number of times, and from these parts the 2000 number may come.  Other, higher-grade parts can be reflashed a million times.  In my work, we usually see ratings of 10,000 for low-cost parts and 100,000 for higher-cost parts.  For integrated flash, there may not be such a range of price and lifetime, since it would complicate the manufacturer's testing and distribution channel.  

---

## 2 answers

### Answer by username_2 on 2016-03-26. Score: 15

The EEPROM is *not* where the program itself is stored, what's relevant for your question is the flash. The flash in the ATmega2560 [is rated for 10,000 cycles](http://www.atmel.com/images/atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_datasheet.pdf) (i.e. you can reprogram it *at least* 10,000 times).

> **Comments:**
> **username_1**: A "cycle" for flash storage is not the writing but is the erasing.  When Flash is written, it must first be erased.  The erase process stresses the device, and over many cycles leads to several failure modes.  Writing data into the erased part is more benign.  Thus, it doesn't matter how big the program is.  "Re-Flashing" starts with an erase cycle, followed by as many programming cycles as necessary.  

---

### Answer by username_3 on 2016-03-27. Score: 1

The AVR has SRAM for variables (what is usually called RAM), it has EEPROM for non volatile variables and it has flash for the executable code. (Harvard Architecture!)

For re-flashing the firmware neither SRAM nor EEPROM write rates are important, but the Flash rates are. The flash write rates are in the region of 100 thousand to a million so that should not be a problem.

The article you linked also states that he did not more than 2000 rewrites and therefore should be fine. I can only agree. A few thousand re-flashes is no problem. Once you get closer to 100 thousand you can start to worry.

Flash bits can only be written from 1 to 0. Erasing the flash writes all bits to 1. Erasing can only be done on a flash page (size is device dependent but usually a multiple of 512).


---

