Gen 3 EEPROM wear: is it 1300 years for 12 bytes/100 writes per day?

Hi, on Borons and Argons I have 12 bytes that need writing into (simulated) EEPROM.

I'd like to verify my math with the community.

Considering the following (source):

  • Each 4096 byte sector of the flash memory has a minimum of 100000 erase cycles (but it could be much larger)
  • On devices with a 2 MB flash file system (everything except the Tracker), that’s 512 sectors of 4096 bytes
  • Erases only occur at the sector level.
  • Each committed write of up to 4096 bytes will probably be two sector writes

For 12 bytes to fill up a sector, it will take ~42 writes.
Since writes happen in two sectors, there are 256 sectors available.

100000 erase cycles * 256 sectors * 42 writes = 1,075,200,000 writes (of a particular 12 bytes structure)

If the firmware writes 100 times per day, the EEPROM will last (at the very least):
1,075,200,000 at 100 times per day: 10,752,000 days or 2,945 years

Is this correct?
Thank you!
Gustavo.

EDIT: for reference, this is the struct:

struct EepromStruct
{
    uint8_t var1;
    time32_t var2;
    int var3;
};

That's not how it works on Gen 3.

When you write anywhere in the 4096 byte EEPROM area, it rewrites the entire EEPROM file on the flash system, which is one sector erase. How much wear this is depends on how full the flash file system is.

The file system is 512 sectors, and if it's mostly empty, and there are 500 free sectors, the erases will cycle across all 500 free sectors, wearing them evenly.

If the file system is nearly full, say there are only 10 sectors free, then those 10 sectors will wear more than the other sectors, because LittleFS never rewrites a used sector unless it changes.


EepromStruct is only used on Gen 1 and Gen 2 (STM32) where EEPROM really occupies two physical flash sectors.

ok, so:

100000 erase cycles * 500 sectors = 50,000,000 writes (of any amount of bytes < 4096)

If the firmware writes 12 bytes 100 times per day, the EEPROM will last (at the very least):
50,000,000 at 100 times per day: 500,000 days or 1,369 years

Is this correct?
Thanks again.

EDIT: consider the file system is not used for anything else

That is correct.

1 Like

I will say that although the flash can handle up to 100,000 write cycles, I would caution you to say as far away from that number as possible as you will not have much in terms of data retention close to that number. Endurance and data retention are two separate specs and as an area wears out, the retention time decreases as well (this is never quantified by any vendor that I am aware of). For example, I have seen both Flash and EEPROMs pass their endurance levels, but the value read is only valid for a few minutes/hours, etc. after the write.

2 Likes

thank you! Interesting info.

If you need to write that much consider using other methods like a dedicated eeprom chip or FRAM. Both are stand-alone nonvolatile memory. FRAM you will never wear out but its a bit costly.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.