EEPROM Emulation Life P2

I don't need infinite life. Wondering what to expect for median life of emulated EEPROM on a P2. I expect 5 years median life (not the extreme end of Weibull) of about 1.5e9 writes/reads (0.1 second update for 5 years). I have a waiting scheme I used for EERAM on an Argon that can cut that by a factor of 10 or 100 if needed, with extra work.

EEPROM emulation on the P2 is a file in the LittleFS flash file system on the 8MB QSPI external flash memory. There is not a fixed write limit.

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, one the for the data, and possibly one for metadata (file length, etc.). However if the write crosses a sector boundary, then that would involve one more sector.

The variability of the wear is because wear leveling occurs across all free sectors only. Since the file system is basically empty under normal circumstances, writes are spread out over nearly 500 sectors, so there is little wear on any given sector.

However, imagine you have filled it almost completely up so there are only 10 free sectors. Each erase will only be spread across 10 sectors because LittleFS never moves already written sectors that did not change. The wear on those 10 free sectors will be high, and low on every other one, which is not ideal.

I have very little to store on a P2. About 20 parameters of mixed type. So I would estimate 500*100000 cycles minimum, or 5e7, which is less than a year for 0.1 sec update interval. I will go for intermittent saving scheme, aiming for a 10 second interval. Thank you.

Hey @davegutz, PLCs need high write-cycle non-volatile storage and for this they use FRAM instead of flash.

FRAM has orders of magnitude more rated write cycles compared to other non-volatile storage technologies, but is comparatively more expensive. However, since you are only looking to retain a few values, you can get away with a small chip — a quick Digikey search shows 4kbit FRAMs are available in the ~$2 range.

Hope that helps!

Thanks for that! I used an EERAM last year with an Argon. Great little device. When they lose voltage an attached capacitor powers it long enough to write to EEPROM. I used 47L16-E/SN. The downside is each access of I2C takes so long it interferes with real time. I had to stretch out the write every 100th pass. Good way to share info. I didn't realize the Argon could do the emulated EEPROM or I would have done that instead for my fast real time device.

EDIT: I went back and checked my notes. I2C access to the external EERAM device took ~0.001 seconds. I had ~50 parameters so writing every update would use half of the 0.100 update interval. I don't recall there being a clever block write workaround. I simply spread them out over time because I could get away with it.

@rickkas7, @Dan-Kouba, what is the write time for emulated EEPROM? I'm not sure if there is any caching behind the scenes but at 0.1sec/100ms write intervals, that may be tight, no?

One EEPROM.put call is 0.090sec measured on a p2. That's most of my cycle time. I'm going with an external EERAM for this application (0.001sec per put).

2 Likes

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

super familiar with EERAM, a great product and good choice for this application!

2 Likes