EEPROM Emulation Life P2

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.