Reputation: 45
I need to get some values saved into eeprom on my esp 8266, but it's not working. I get the Error "ERROR! EEPROM commit failed" when i try to EEPROM.commit() some writes. I tested it with my own code, but it also doesn't even work with the examples from the EEPROM library. I have multiple ESP8266MOD and tested with some of them, but no one worked. Anybody got an idea?
If you need additional Infos ill tell you
Upvotes: 2
Views: 4671
Reputation: 1
in some cases the problem is in the Arduino Ide Tools. For example, the Flash Size might be set to 512KB, and your device Flash Size might be 4MB. Then, you need to select in the Arduino Ide Tools, the correct size of your ESP. This problem happened to me, I thought there was a problem in muy code, but when I changed the Flash Size, the EEPROM start to work.
Upvotes: 0
Reputation: 707
As we discussed in the comments, it is not working because ESP8266 do not have EEPROM and your option is to use Flash to emulate the EEPROM.
I have not done a thorough research as I am not using ESP8266 on regular basis but did try the ESP_EEPROM library and it seem to be working well, here's the code I just tested:
#include <ESP_EEPROM.h>
void setup() {
Serial.begin(115200);
while(!Serial);
EEPROM.begin(16); // looks like 16 bytes is the minimum
EEPROM.put(0, 1234); // first parameter sets the position in the buffer, second the value
boolean res = EEPROM.commit();
Serial.println(res); // should print 1 (true) if commit worked as expected
int myVar;
EEPROM.get(0, myVar);
Serial.println(myVar);
}
void loop() {
}
Upvotes: 2