EEPROM (flash) wear and tear

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.

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.

1 Like

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?

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

1 Like

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() for info on how you can schedule this process to disrupt your application the least.

9 Likes

Excellent guidance, big thanks.

1 Like