ESP32 - Use EEPROM and SPIFFS

Hi!
I searched a lot on the internet but I didn't get satisfactory answers.

I have a question: if I use in the same sketch to write data in ESP32 in flash memory with the EEPROM library and with SPIFFS, is there the risk of one data overlapping the other or generating some other memory problem or board damage?

Thank you!

Yes.

Thanks for the answer!

Could you tell me more details or where could I get it?

Sure!

API Reference - ESP32 - — ESP-IDF Programming Guide latest documentation (espressif.com)

As @Idahowalker says the answer is yes.

EEPROM used to be in a separate reserved memory space but that was changed a couple of years ago.

https://github.com/espressif/arduino-esp32/commit/ca7106e97e69ac6f5b91fcf18927c3d3c529571d

EEPROM.h has been deprecated on the ESP32, and you should be using Preferences.h instead. It has built in wear leveling as part of its memory management which moves stored data to different locations when changed.

SPIFFS is best used for large files, and Preferences for simple saving of data that could go in an EEPROM.

2 Likes

Thank you very much for the explanation of the answer! It enlightened me a lot.

Thanks!