Closed
Description
Board
ESP32-C3 Devkitc
Device Description
Nothing attached
Hardware Configuration
Nothing attached
Version
latest master
IDE Name
PIO
Operating System
Win10
Flash frequency
80
PSRAM enabled
no
Upload speed
115200
Description
Preferences e.g. code giving error in latest release. Works in 2.0.2
I also can't format or mount SPIFFS on a C3 but I believe that is fixed in PR #6569 ?
Returning err -1
Sketch
https://github.com/espressif/arduino-esp32/blob/master/libraries/Preferences/examples/Prefs2Struct/Prefs2Struct.ino
Debug Message
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x38c
load:0x403ce000,len:0x6a8
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: 4ab8657f6f5aa80b81c7dd649db3bd64a98999ed7c65acc5a2ab77ce80caf525
Expected: 6babbc7b9ea63e04e0fc89ec224f6268aa3f84392018f73ab33721f768ce2eb6
Attempting to boot anyway...
entry 0x403ce000
[ 106][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: schedule NOT_FOUND
[ 106][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: schedule NOT_FOUND
09:30 235/255
[ 122][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: schedule NOT_FOUND
[ 123][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: schedule NOT_FOUND
Other Steps to Reproduce
Just running example code
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Activity
lbernstone commentedon Apr 13, 2022
There is no error checking in that example. It seems likely that the NVS is unable to either open the namespace or is completely full. Erase your flash and try again.
Sys64736 commentedon Apr 13, 2022
I've erased the flash a few times before that, changed partition to default and made sure it was. Tried on 3 different chips, 2 devkits and 1 Lolin mini.
I noticed it as I updated to the latest from 2.0.2, my current project was giving errors with the EEPROM routine that I had with 2.0.3rc1, so I changed the 3 routines I was using to the Preferences library thinking because it was deprecated it might make a difference. Still errors. In my project now, it's working in 2.0.2 it writes and reads to the key no problem but with 2.0.3RC1 it doesn't write to the key.
Before I swapped out the EEPROM library routines to use Preferences, this is the error I was getting when I updated from 2.0.2 to 2.0.3rc1
assert failed: esp_err_t nvs::Page::copyItems(nvs::Page&) nvs_page.cpp:500 (end <= ENTRY_COUNT)
Core 0 register dump:
Then reboot.
I tried to use the exception decoder but even after trying 3 different versions of the Arduino IDE installed, I couldn't get it to work. It was pretty clear it was something to do with nvs though.
Let me know if there's anything else I can do
Sys64736 commentedon Apr 13, 2022
Just an fyi, I don't know if this has anything to do with the fact the same project does not mount the SPIFFS partition either. I even tried the example SPIFFS code in PIO and ArduinoIDE. Both give same result:
Attempting to boot anyway...entry 0x403ce000E (180) SPIFFS: mount failed, -10025E (15468) SPIFFS: mount failed, -10025[ 15431][E][SPIFFS.cpp:114] format(): Formatting SPIFFS failed! Error: -1[ 15432][E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1SPIFFS Mount Failed
I almost thought the flash got permanently corrupted on the boards somehow because both SPIFFS and nvs were giving me problems but reverting back to 2.0.2 everything works as it should.
Sys64736 commentedon Apr 13, 2022
Probably unrelated but I noticed the config folder and the containing sdkconfig.h is missing in latest from .../tools/sdk/esp32c3/include/
lbernstone commentedon Apr 13, 2022
Make sure to run tools/get.py (but I think you would get much nastier compilation errors if this was the problem). I am unable to reproduce the problem with Preferences or SPIFFS with a new esp32-c3 board that I grabbed out of the box.
Sys64736 commentedon Apr 14, 2022
Thanks. my ESP32 works with Pref and SPIFFS examples, but my C3's still gives same errors. Reverted back again to 2.0.2 to double check and both examples ran fine on C3. It's back to the latest now and trying a few different things, It's prob some config thing I'm doing wrong. I'll post back in a bit as soon as I figure out what's going on.
lbernstone commentedon Apr 14, 2022
Did you perhaps have encryption turned on at some point? I can't think of what else would cause your nvs to fail. Try the following and see if you get some more info about what failed.
Sys64736 commentedon Apr 14, 2022
Thanks, the only encryption I had was encrypted flags in a custom partition for later use but no fuses set or any follow up on those flags.
Chips have all been erased and set with default partitions since then and operate normally until the commit mentioned below.
After a few branch changes, I found the one which is causing my issues.
Commit 8ee5f0a is causing the issues for me with SPIFFS and Preferences.
Running the code you posted with Esp32 s3 support (#6341): 8ee5f0a
Below is running it with the commit just before S3 support 3f79097
Same for the example code with SPIFFS and Preferences.
There's many files changed in Esp32 s3 support (#6341), but I'm thinking it's a library that's common to SPIFFS & nvs maybe? It's like it can't find the partitions anymore
Sys64736 commentedon Apr 17, 2022
@lbernstone I think I've tried everything I can think of. Still getting the bootloop with the ESP32-C3-DevKitC-02 and the Lolin C3 Mini.
The Mini was brand new out of the package.
Output running the nvs sample code you gave with RC-1 & Lolin_c3_mini (brand new)
Running the ESP32-C3-DevKitC-02 I get similar (not new but erased flash and using default.csv partition) with RC-1
I thought it was an issue finding the partitions but running this code with RC-1, partitions are found on both boards.
OUTPUT for DevkitC using RC-1
Output for Lolin mini using RC-1
So, not sure what's going on. 'Almost' everything else on RC-1 works on these boards, I say almost because I have a project I tried running with these boards on the latest and it uses many of Ard/esp32 libraries and it it all works. Webserver, Ledc, http client, wifi using STA + AP etc. Only the SPIFFS and NVS(Preferences) issues are present ( I didn't try LittleFS though).
If you or anyone has any ideas, please let me know if there's something I could try. The fixes/additions in RC-1 are very helpful, especially the USB/Seria/JTAG support for the Lolin mini which doesn't have a uart chip.
Edit: It's getting past the nvs init and nvs commit functions without error, returning zero and a handle of 1.
Returning ESP_ERR_NVS_NOT_FOUND on the nvs_get_str() function only. If it was a nvs_open_mode_t problem I would think it would error before that?
Tried PR #6585 [IDF release/v4.4], still the same.
46 remaining items