How much eeprom space available for electron?

size_t length = EEPROM.length();

by above line i get 2048 bytes

by this link it shows https://docs.particle.io/datasheets/electron-datasheet/

it shows two regions EEPROM1 0x800C000 0x8010000 16 KB
EEPROM2 0x8010000 0x8020000 64 KB

how above two regions are accessible and in application code to store some sensor data for example

The EEPROM emulation code uses wear leveling algorithms to avoid “bricking” your device by frequently changing data.
In simple words: The 2KB EEPROM area gets moved across several flash pages to reduce erase cycles - which are causing flash wear - on each individual page.

how much space is available 2KB or 16KB or 64KB to store data

That’s actually documented
https://docs.particle.io/reference/firmware/photon/#eeprom

@viraj, as @ScruffR pointed out, the STM32 doesn’t actually have built-in EEPROM. Instead, a portion of flash is used to emulate EEPROM. Since flash is not as robust as true EEPROM, extra flash is used along with “wear-leveling” logic to spread the number of flash page erases over multiple pages over time. So the 16KB and 64KB areas are really wear-leveling spaces for the emulation.

If you need a lot of EEPROM storage, you should consider using an I2C or SPI external device. You can also get OneWire devices to reduce pin count.

I have used external 128MB SPI flash along with SPIFFS (SPI flash file system) to store data in file format, much like SDFat but for SPI flash. SPIFFS implements wear-leveling and it works quite well. I believe the SPIFFS library is available on the web IDE.

2 Likes

I have been looking into this since our conversation last week over here but haven’t found anything in Particle Dev or web IDE. Am I missing something or is it not up yet?

@supscientist, darn, I just realized SPIFFS is not on the web IDE! I used this github repo for a working version of SPIFFS:

:slight_smile:

1 Like

Thanks, @peekay123!

1 Like