-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commit does return an error code #12
Comments
I have the same problem here and also with a D1 Mini. I modified the ESP_EEPROM source commit() function to return a more useful error message and in my case, it is failing when it tries to erase the sector of flash that it uses for the first time. So, while I don't have an exact answer, it looks to me that a low level ESP erase flash sector function is failing. |
Hi @LeoVe - this issue is probably long past its sell by date - however I tried your code and got
That being said , I also tried checking |
Hi @n4mwd - you make a valid point. If I do any further work on this I will probably add a 'lastError' property that you can query in case of a failure. Flagged as 'enhancement' |
Hi jwrw, Thanks for your test and reply. For your information: Kind regards, Leo |
Hi @LeoVe - I did manage to find an old Wemos mini pro and it worked fine until I updated my ESP8266 core to 3.1.2 then it broke as you described. It's now fixed in the latest release 2.2.0 as long as you're using ESP8266 core 3.1+. SPIFF is fine and has some useful features if you need them but is a lot more heavy duty than the simple EEPROM scheme. |
Hi jwrw, Thanks for your actions, you're great ! 👍 |
I'm wondering though... |
I am also facing with same issue. EEPROM is not saving my data and when I power off and on and read written data it is coming as false or 0. Also, I checked that EEPROM.commit() is returning 0. I am using latest library of eeprom and esp8266 core |
@Ilkhomjon2002 - any details of what board? Are you able to read the data back OK before you switch off? Do the examples work? @LeoVe - should work (or not!) as before with earlier cores. New location finding only kicks in with newer core libs. |
Board is wemos d1 mini pro and yes I can read it before turning it off. I am using latest core and latest esp_eeprom library |
Examples sketches also didn`t work |
The same problem here. The symbols "EEPROM_start", and even "_FS_end" are both undefined when entering the library ! I tried other EEPROM libraries, with exactly the same problems on my PC & Arduino IDE: not being able to commit. |
Trying to find a universal way to find the start of the flash area is clearly an issue with some combinations of core libraries. I may need to stand up a recent Arduino IDE to investigate further. It might not be a legitimate 'fix' but for quite some time I've been using VSCode with the PlatformIO extension. This means I can use VSCode for pretty much all my projects, on whatever platform and in whatever language. Advantages include a much more robust way to define libraries/version in use and differing builds for different boards for the same code. There's been a lot of work done on the Arduino IDE to add features but I'd certainly recommend you give VSCode + PlatformIO a go. |
CHATGTP just answered this (and this one works !!!) // Function to retrieve flash memory size // Function to calculate EEPROM start address based on flash size // Calculate EEPROM start address void setup() { // Retrieve and print flash memory size // Calculate and print EEPROM start address void loop() { Some ideas ? |
Making the library work for a NodeMCU V1.0 ESP8266 is simple : |
Can confirm that this fix works perfectly for the Wemos D1 mini. I'm using ESP8266 core 3.0.2. The original ESP8266 EEPROM library worked for me, however |
Hardcoding the address for a specific board is not a fix I can use here. Bottom line is that EEPROM_start is the published method for getting the start in a hardware-independent way and so should be expected to work for all supported boards. If it's not defined then there's a problem in the build or in the board definition somewhere. With latest IDE (2.3.2) and latest esp8266 package (3.1.2) and a Wemos D1 Mini Pro, the commit() is working as expected with all but one of the flash configurations (FS:14M, FS:15M and the 'Mapping defined by Hardware and Sketch'). For the FS:none I am getting a linker error - this is due to a missing file in the esp8266 distribution (...packages/esp8266/hardware/esp8266/3.1.2/tools/sdk/ld/eagle.flash.16m.ld). This is missing on github and I'm not clear why. Here's a minimal test for commit()... `// A minimal test of ESP_EEPROM commit() #include <ESP_EEPROM.h> void setup() { #ifdef _FS_end #ifdef EEPROM_start // set the EEPROM data ready for writing // write the data to EEPROM void loop() { |
Closing this issue with note that an enhancement re. last error should be developed |
Hi,
Thanks for the great work to this library !
I make use of the library in an Arduino (v1.8.13) script for the wemos mini D1 Pro.
Whatever I try, I keep on getting a returncode 'false' from the EEPROM.commit() and the values are not written to EEPROM. I'm using ESP_EEPROM version 2.1.1 with standard Arduino library management.
The put and get functions seem to work flawless as the get does return the expected values after the put. The problem is its not written to EEPROM with EEPROM.commit().
This is the code I use:
String RfDeviceID[] = {"xx", "74"};
const int RfDeviceIdCount = 2;
int eeAddress;
...
void setup() {
...
EEPROM.begin(RfDeviceIdCount * 10); //Initialize EEPROM
String initCode;
char arrayFromStore[10];
eeAddress=0;
EEPROM.get(eeAddress, arrayFromStore);
initCode = arrayFromStore;
Serial.println();
Serial.print("\nInitCode from EEPROM: ");
Serial.println(arrayFromStore);
if (initCode != RfDeviceID[0]) {
writeInitEEPROM();
}
for (int i=0; i<RfDeviceIdCount; i++ ) {
eeAddress=i10;
EEPROM.get(eeAddress, arrayFromStore);
RfDeviceID[i] = arrayFromStore;
Serial.print("init ");
Serial.print(i);
Serial.print(" read from EEPROM: ");
Serial.println(arrayFromStore);
}
}
...
void writeInitEEPROM() {
char arrayToStore[10];
for (int i=0; i<RfDeviceIdCount; i++ )
{
RfDeviceID[i].toCharArray(arrayToStore, RfDeviceID[i].length()+1);
Serial.print("write init ");
Serial.print(i);
Serial.print(" to EEPROM: ");
Serial.println(arrayToStore);
eeAddress=i10;
EEPROM.put(eeAddress, arrayToStore);
}
boolean ok=EEPROM.commit(); //Store data to EEPROM
Serial.print((ok) ? "EEProm commit OK: " : "*** EEProm commit failed !!! ");
Serial.println(ok);
}
Example of the output:
13:03:57.000 -> InitCode from EEPROM: ⸮�
13:03:57.000 -> write init 0 to EEPROM: xx
13:03:57.000 -> write init 1 to EEPROM: 74
13:03:57.000 -> *** EEProm commit failed !!! 0
13:03:57.000 -> init 0 read from EEPROM: xx
13:03:57.000 -> init 1 read from EEPROM: 74
The text was updated successfully, but these errors were encountered: