sparkfun / Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
83 stars 38 forks source link

questions about the "EEPROM emulation" characteristics #449

Closed jerabaul29 closed 2 years ago

jerabaul29 commented 2 years ago

I have a few questions about the "EEPROM emulation" (really, non volatile memory using the Flash memory instead of the volatile RAM).

I am a bit in doubt in a project if I want to either use the flash through "EEPROM emulation" as a non volatile memory, or if I would be better off adding an external FRAM breakout. Any advices / thought / perspective on that? :) .

nseidle commented 2 years ago

Most of your answers are in the datasheet. Unfortunately Ambiq has done something dumb with their registration wall before you can get the datasheet so I can't get the latest Apollo3 datasheet, here's the old one:

image

image

But I can get the Apollo3 Blue Plus (basically same core, more memory):

image

Depending on the EEPROM you want to compare to, these are all similar numbers except the 10,000 write cycles. In comparison, the 'real' EEPROM in ATmega328 is rated for 100k cycles but I found it would last 16 times that amount (see Flash Thrasher).

I cannot immediately find a spec for flash write time. I know I've read it before (bootloading timing) so it's probably buried in a different app note. This too might be a difference of concern for you as Apollo erases and re-writes entire pages of memory whereas an EEPROM can write to a given location. If you're using the EEPROM library in the core, its transparent, and I suspect similar in write times, but I can't confirm without the flash write time specs.

I use emulated EEPROM on a variety of devices (ESP32, Apollo3, etc) and have not found a major drawback. Unless you're logging a new value to EEPROM every second or something (don't do that, use SD instead), you should never get near the 10k write cycle limit; using the internal flash for user settings (or other slowly changing data) is perfectly fine.