# EEPROM (flash) wear and tear

**URL:** <https://community.particle.io/t/eeprom-flash-wear-and-tear/23738>\
**Category:** Hardware\
**Created:** [June 15, 2016, 4:50pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738 "2016-06-15T16:50:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyg](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyg/32/3363_2.png) [@andyg](https://community.particle.io/u/andyg)\
**Post date:** [June 15, 2016, 4:50pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/1 "2016-06-15T16:50:01Z")

</div>

Hi there, I am storing some values in EEPROM (flash) that are coming in real time over UDP, should I be worried about wear and tear of the flash memory? Any advice much appreciated.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 15, 2016, 4:57pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/2 "2016-06-15T16:57:40Z")

</div>

When you say real time, I’d guess you’ll have many write cycles and in that case I would be worried about flash wear.  
For such frequent write access, I’d rather go with a replacable medium like SD or add an FRAM chip.

---

<div class="post-metadata">

**Author:** ![andyg](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyg/32/3363_2.png) [@andyg](https://community.particle.io/u/andyg)\
**Post date:** [June 15, 2016, 5:12pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/3 "2016-06-15T17:12:54Z")

</div>

Thanks,  
Is there any endurance data for the use of flash?  
like the idea of SD or add an FRAM chip for next hardware version.  
Could SRAM also be an option, saving realtime data to SRAM and occasionally to EEPROM for the longer term?

---

<div class="post-metadata">

**Author:** ![will](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/will/32/23374_2.png) [@will](https://community.particle.io/u/will)\
**Post date:** [June 15, 2016, 5:25pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/4 "2016-06-15T17:25:57Z")

</div>

I believe that @jvanier did an EEPROM durability test on hardware–would you share those results, Julien?

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [June 15, 2016, 6:15pm UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/5 "2016-06-15T18:15:38Z")

</div>

The Flash in the STM32F205 is rated by STM for 10,000 erase cycles.

The EEPROM is emulated in 2 pages of Flash, with 16kb and 64kb capacity each, and each byte of EEPROM takes 4 bytes of Flash, for a total of ~20,000 bytes written each time both pages are erased.

So plan for 200,000,000 bytes writes for a brand new Photon to be super safe.

Now this is the “lawyer limit” by STM. In practice the limit is much higher, it is just not guaranteed by STM.

I’ve had an EEPROM durability test writing different bytes continuously for about 2 months now. It wrote upwards of 2,000,000,000 bytes to the EEPROM without a failure yet.

I agree that using a RAM buffer and writing to EEPROM once in a while would be better.

Keep in mind that when a page of Flash used for EEPROM needs to be erased **it completely freezes the processor from running any instructions for up to 500ms** (code cannot run from flash while a page of flash is being erased). See [EEPROM.performPendingErase()](https://docs.particle.io/reference/firmware/photon/#performpendingerase-) for info on how you can schedule this process to disrupt your application the least.

---

<div class="post-metadata">

**Author:** ![andyg](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyg/32/3363_2.png) [@andyg](https://community.particle.io/u/andyg)\
**Post date:** [June 16, 2016, 6:19am UTC](https://community.particle.io/t/eeprom-flash-wear-and-tear/23738/6 "2016-06-16T06:19:02Z")

</div>

Excellent guidance, big thanks.
