-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Global EEPROM instance always returns 0 #6067
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
Comments
Hello, can you please retest this on v2.0.3-rc1? |
I am not currently sure where my second test ESP is, so can't it test at the moment. When I find it I will try it out |
Thank you! |
Any news on this? |
Oh shit sorry, I couldn't find my ESP so I didn't end up testing. Sorry... |
Hi. I tested this today with platformIO, pressed update all (updating both libraries and boards, but the result is still that EEPROM returns 0 when used outside in other classes and such. In other words, behaviour is still not global. Oh wait! Actually, adding EEPROM.begin(4096) in setup() screws up my serial lcd output. EDIT: its cpu panic EndeavourOS (arch-Linux based distribution), Linux 5.17.5. |
@UnicodeMan Are you testing the result of EEPROM.begin()? If it fails to initialize (perhaps your nvs partition is full), then length will still be 0. Setting the EEPROM length is one of the last things done in the begin function. |
I tested the result. EEPROM.begin(4096) returns 1. EEPROM.length(), however, returns 0. |
Seeing as EEPROM is deprecated on ESP32, I decided to use Preferences library. It works great. So anyone having issues with EEPROM should consider migrating to Preferences (though I see why EEPROM is still used). |
Interesting. The reason I'm using it is because I tried to port over a project for the ESP8266 and got it working, but nothing would persist a restart. I just added lots of Serial.print statements to find what the culprit was in the saving code and it came down to this. Seeing as it wasn't any sort of dynamic number, I hardcoded the expected length, but a fix to the EEPROM library would be useful nonetheless. |
Nevermind, same issue. It doesn't save the values.
|
Checking the nvs status is more difficult than just erasing it. Open a command prompt and find esptool (usually %userdata%/Arduino15/packages/esp32/tools/esptool/) and run |
did that. behaviour didn't change. Both Preferences and EEPROM libraries don't do what they ought to (they still act with previously mentioned behaviour). |
Does the StartCounter example work? |
Works fine. Currently at counter value 28 and going up. Debugging set to verbose? Without any external hardware attached? Is there a platformio.ini value to be set for that? I do have some output: |
build_flags = -DCORE_DEBUG_LEVEL=5 |
With flags, example library prints this: Interestingly, with these flags, my project now has problems, when:
I am attaching whole project that can be opened as-is in VSCode / VSCode-based applications. |
Dismiss previously sent project file, it had a problem because Preferences object was used before it was passed on. |
Can I consider this as solved? |
I think it is better left as open. |
see #6572 |
Likely fixed by PR #6910. |
Board
ESP32 Dev Module
Device Description
N/A
Hardware Configuration
N/A
Version
v2.0.1
IDE Name
Arduino IDE
Operating System
Windows 11
Flash frequency
N/A
PSRAM enabled
no
Upload speed
115200
Description
Expected Behaviour
After running EEPROM.begin(2048) on the global EEPROM instance, EEPROM.length() should return 2048
Current Behaviour
After running EEPROM.begin(2048) on the global EEPROM instance, EEPROM.length() returns 0
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: