Skip to content
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

ESP32-C3 Preferences: nvs_get_blob len fail: schedule NOT_FOUND #6572

Closed
1 task done
Sys64736 opened this issue Apr 13, 2022 · 36 comments
Closed
1 task done

ESP32-C3 Preferences: nvs_get_blob len fail: schedule NOT_FOUND #6572

Sys64736 opened this issue Apr 13, 2022 · 36 comments
Assignees
Labels
Milestone

Comments

@Sys64736
Copy link

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.
@Sys64736 Sys64736 added the Status: Awaiting triage Issue is waiting for triage label Apr 13, 2022
@me-no-dev me-no-dev added Status: Test needed Issue needs testing Area: ESP-IDF related ESP-IDF related issues labels Apr 13, 2022
@lbernstone
Copy link
Contributor

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
Copy link
Author

Sys64736 commented 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
Copy link
Author

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
Copy link
Author

Probably unrelated but I noticed the config folder and the containing sdkconfig.h is missing in latest from .../tools/sdk/esp32c3/include/

@lbernstone
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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.

#include <nvs_flash.h>
void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("testing nvs");
  nvs_handle_t hnd;
  esp_err_t err = nvs_flash_init();
  if (err) log_e("NVS Init Error: %s", esp_err_to_name(err));
  err = nvs_open("schedule", NVS_READWRITE, &hnd);
  if (err) log_e("Namespace Open Error: %s", esp_err_to_name(err));
  err = nvs_set_str(hnd, "test_str", "testing123");
  if (err) log_e("Set String Error: %s", esp_err_to_name(err));
  err = nvs_commit(hnd); 
  if (err) log_e("NVS Commit Error: %s", esp_err_to_name(err));
  size_t sz;
  err = nvs_get_str(hnd, "test_str", NULL, &sz);
  if (err) log_e("Get String Error: %s", esp_err_to_name(err));
  char* buff = (char*)malloc(sz * sizeof(char));
  err = nvs_get_str(hnd, "test_str", buff, &sz);
  if (err) log_e("Get String Error: %s", esp_err_to_name(err));
  Serial.printf("Retrieved String: %s", buff);
  nvs_close(hnd);
}
void loop() {delay(-1);}

@Sys64736
Copy link
Author

Sys64736 commented 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

Attempting to boot anyway...
entry 0x403ce000
testing nvs
[  1109][E][main.cpp:19] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
[  1110][E][main.cpp:22] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
Guru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x40058eb6  RA      : 0x42019268  SP      : 0x3fc92a60  GP      : 0x3fc8b000
TP      : 0x3fc88e78  T0      : 0x403894e6  T1      : 0x3fc92b2c  T2      : 0xffffffff  
S0/FP   : 0x00000000  S1      : 0x00000001  A0      : 0x00000000  A1      : 0xffffffff
A2      : 0x00000001  A3      : 0x7f7f7f7f  A4      : 0x00000000  A5      : 0x00000004  
A6      : 0x3fe00000  A7      : 0x0000000a  S2      : 0x00000000  S3      : 0x3fc93100
S4      : 0x3fc92e98  S5      : 0x00000009  S6      : 0x00000000  S7      : 0x00000000  
S8      : 0x3c030262  S9      : 0x00000000  S10     : 0x3fc92b34  S11     : 0xffffffff
T3      : 0x00000000  T4      : 0x00000000  T5      : 0x00000000  T6      : 0x00000000  
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000005  MTVAL   : 0x00000000
MHARTID : 0x00000000

Below is running it with the commit just before S3 support 3f79097

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x38c
load:0x403ce000,len:0x6a8
load:0x403d0000,len:0x2370
SHA-256 comparison failed:
Calculated: 912c8ece44dc10c27ac7d0fbc21c881181838b5f87f42e05d6797a997e755775
Expected: e48257ed72b4ed90fbd1c7429f3866f76aab94952c8871b8e364f6e503cebde8
Attempting to boot anyway...
entry 0x403ce000
testing nvs
Retrieved String: testing123

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
Copy link
Author

Sys64736 commented 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)

SHA-256 comparison failed:
Calculated: 4ab8657f6f5aa80b81c7dd649db3bd64a98999ed7c65acc5a2ab77ce80caf525
Expected: 6babbc7b9ea63e04e0fc89ec224f6268aa3f84392018f73ab33721f768ce2eb6
Attempting to boot anyway...
entry 0x403ce000
testing nvs
[  1130][E][main.cpp:19] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
[  1130][E][main.cpp:22] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40381782
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
testing nvs
[  1136][E][main.cpp:19] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
[  1136][E][main.cpp:22] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)

Running the ESP32-C3-DevKitC-02 I get similar (not new but erased flash and using default.csv partition) with RC-1

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
Saved PC:0x40381782
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
testing nvs
[  1154][E][main.cpp:19] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
[  1154][E][main.cpp:22] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
Guru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x40058eb6  RA      : 0x42019360  SP      : 0x3fc92a70  GP      : 0x3fc8b000
TP      : 0x3fc88e38  T0      : 0x403894e6  T1      : 0x3fc92b3c  T2      : 0xffffffff  
S0/FP   : 0x00000000  S1      : 0x00000001  A0      : 0x00000000  A1      : 0xffffffff
A2      : 0x00000001  A3      : 0x7f7f7f7f  A4      : 0x00000000  A5      : 0x00000004  
A6      : 0x3fe00000  A7      : 0x0000000a  S2      : 0x00000000  S3      : 0x3fc93110
S4      : 0x3fc92ea8  S5      : 0x00000009  S6      : 0x00000000  S7      : 0x00000000  
S8      : 0x3c030262  S9      : 0x00000000  S10     : 0x3fc92b44  S11     : 0xffffffff
T3      : 0x00000000  T4      : 0x00000000  T5      : 0x00000000  T6      : 0x00000000  
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000005  MTVAL   : 0x00000000
MHARTID : 0x00000000

I thought it was an issue finding the partitions but running this code with RC-1, partitions are found on both boards.

/* Finding Partitions Example
   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#include <Arduino.h>


void getPartionTableInfo()
{
	// Get Partitionsizes
	size_t ul;
	esp_partition_iterator_t _mypartiterator;
	const esp_partition_t *_mypart;
	ul = spi_flash_get_chip_size();
  Serial.println("\n------------------------------------");
	Serial.print("Flash chip size: ");
	Serial.println(ul);  
	Serial.println("Partition table:");
  Serial.println("------------------------------------");
	_mypartiterator = esp_partition_find(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, NULL);
	if (_mypartiterator)
	{
		Serial.println("App Partition table:");
		do
		{
			_mypart = esp_partition_get(_mypartiterator);
			printf("Type: %02x SubType %02x Address 0x%06X Size 0x%06X Encryption %i Label %s\r\n", _mypart->type, _mypart->subtype, _mypart->address, _mypart->size, _mypart->encrypted, _mypart->label);
		} while (_mypartiterator = (esp_partition_next(_mypartiterator)));
	}
	esp_partition_iterator_release(_mypartiterator);
	_mypartiterator = esp_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, NULL);
	if (_mypartiterator)
	{
		Serial.println("Data Partition table:");
		do
		{
			_mypart = esp_partition_get(_mypartiterator);
			printf("Type: %02x SubType %02x Address 0x%06X Size 0x%06X Encryption %i Label %s\r\n", _mypart->type, _mypart->subtype, _mypart->address, _mypart->size, _mypart->encrypted, _mypart->label);
		} while (_mypartiterator = (esp_partition_next(_mypartiterator)));
	}
	esp_partition_iterator_release(_mypartiterator);
}

void setup(){
  Serial.begin(115200);
  while (!Serial) {}
  delay(1000); // delay needed with lolin_c3_mini(no uart chip) because 
               // while(!serial) still missed serial printing flash chip size.
               
 getPartionTableInfo();
}

void loop(){
}

OUTPUT for DevkitC using RC-1

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

------------------------------------
Flash chip size: 4194304
Partition table:
------------------------------------
App Partition table:
Type: 00 SubType 10 Address 0x010000 Size 0x140000 Encryption 0 Label app0
Type: 00 SubType 11 Address 0x150000 Size 0x140000 Encryption 0 Label app1
Data Partition table:
Type: 01 SubType 02 Address 0x009000 Size 0x005000 Encryption 0 Label nvs
Type: 01 SubType 00 Address 0x00E000 Size 0x002000 Encryption 0 Label otadata
Type: 01 SubType 82 Address 0x290000 Size 0x170000 Encryption 0 Label spiffs

Output for Lolin mini using RC-1

--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on COM15  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

------------------------------------
Flash chip size: 4194304
Partition table:
------------------------------------
App Partition table:
Type: 00 SubType 10 Address 0x010000 Size 0x140000 Encryption 0 Label app0   
Type: 00 SubType 11 Address 0x150000 Size 0x140000 Encryption 0 Label app1   
Data Partition table:
Type: 01 SubType 02 Address 0x009000 Size 0x005000 Encryption 0 Label nvs    
Type: 01 SubType 00 Address 0x00E000 Size 0x002000 Encryption 0 Label otadata
Type: 01 SubType 82 Address 0x290000 Size 0x170000 Encryption 0 Label spiffs

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.

@Jason2866
Copy link
Collaborator

Jason2866 commented Apr 23, 2022

Can not reproduce. Platformio using 2.0.3 rc1

.ç:gˇ2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000
20:15 0/1
09 1E EB FF 14 0F 00 01 08 1E 14 15 
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000
20:15 0/1
09 1E EB FF 14 0F 00 01 08 1E 14 15 
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000
20:15 0/1
09 1E EB FF 14 0F 00 01 08 1E 14 15 

Counter example:

>Ωu#ˇ.j
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000

Current counter value: 2
Restarting in 10 seconds...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4038095c
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000

Current counter value: 3
Restarting in 10 seconds...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4038095c
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000

Current counter value: 4
Restarting in 10 seconds...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4038095c
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0xf4
load:0x403ce000,len:0x898
load:0x403d0000,len:0x2180
entry 0x403ce000

Current counter value: 5
Restarting in 10 seconds...

@Sys64736
Copy link
Author

Fixed with #6614

Repository owner moved this from Todo to Done in Arduino ESP32 Core Project Roadmap Apr 23, 2022
@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels Apr 26, 2022
@lbernstone
Copy link
Contributor

This should be reopened. Using jason2866's framework is not really a solution. I think it can be reproduced by using flash mode DIO in Arduino.

@VojtechBartoska
Copy link
Contributor

@lbernstone can you share your sketch to reproduce this issue?

@Sys64736
Copy link
Author

Sys64736 commented Jun 14, 2022

It's been a while but I think the issue was with get.exe. After using Jason's framework I noticed the only thing that changed was the updated esptool version. (although I didn't check the board files or variants to see if those changed). Even though I deleted all packages several times and ran get.exe from the repo I did not get the updated esptoolpy that seemed to correct the problem for me. Possibly it was a partition issue or allowing read/write permissions with an older version of esptool? as all sample code and functions ran error free except when trying to read/write nvs or spiffs. The flash mode is in the boards file? correct? I didn't look to see if that was different but would it be able to upload without error in DIO?

EDIT: I see now, I was using DIO in the platformio.ini until Jason's framework, but I think it's QIO that gives an error when uploading.

@lbernstone
Copy link
Contributor

Start_counter example:
DIO

20:03:44.900 -> 
20:03:44.900 -> Current counter value: 1
20:03:44.900 -> Restarting in 10 seconds...
20:03:54.738 -> ESP-ROM:esp32c3-api1-20210207
20:03:54.738 -> Build:Feb  7 2021
20:03:54.738 -> rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
20:03:54.738 -> Saved PC:0x403816f2
20:03:54.738 -> SPIWP:0xee
20:03:54.738 -> mode:DIO, clock div:1
20:03:54.738 -> load:0x3fcd6100,len:0x38c
20:03:54.771 -> load:0x403ce000,len:0x6ac
20:03:54.771 -> load:0x403d0000,len:0x2464
20:03:54.771 -> SHA-256 comparison failed:
20:03:54.771 -> Calculated: b080eacadd0b63e0211a4f0e60905e026699184995bb6e1528c6f73d2bd5875b
20:03:54.771 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
20:03:54.771 -> Attempting to boot anyway...
20:03:54.771 -> entry 0x403ce000
20:03:54.870 -> 
20:03:54.870 -> [   133][V][Preferences.cpp:400] getUInt(): nvs_get_u32 fail: counter NOT_FOUND
20:03:54.870 -> Current counter value: 1
20:03:54.870 -> Restarting in 10 seconds...
20:04:04.883 -> ESP-ROM:esp32c3-api1-20210207
20:04:04.883 -> Build:Feb  7 2021
20:04:04.883 -> rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
20:04:04.883 -> Saved PC:0x403816f2
20:04:04.883 -> SPIWP:0xee
20:04:04.883 -> mode:DIO, clock div:1
20:04:04.883 -> load:0x3fcd6100,len:0x38c
20:04:04.883 -> load:0x403ce000,len:0x6ac
20:04:04.883 -> load:0x403d0000,len:0x2464
20:04:04.883 -> SHA-256 comparison failed:
20:04:04.916 -> Calculated: b080eacadd0b63e0211a4f0e60905e026699184995bb6e1528c6f73d2bd5875b
20:04:04.916 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
20:04:04.916 -> Attempting to boot anyway...
20:04:04.916 -> entry 0x403ce000
20:04:05.015 -> 
20:04:05.015 -> [   131][V][Preferences.cpp:400] getUInt(): nvs_get_u32 fail: counter NOT_FOUND
20:04:05.015 -> Current counter value: 1
20:04:05.015 -> Restarting in 10 seconds...

QIO (note that it still says DIO)

20:05:41.591 -> 
20:05:41.591 -> Current counter value: 1
20:05:41.591 -> Restarting in 10 seconds...
20:05:51.550 -> ESP-ROM:esp32c3-api1-20210207
20:05:51.550 -> Build:Feb  7 2021
20:05:51.550 -> rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
20:05:51.550 -> Saved PC:0x403816f2
20:05:51.550 -> SPIWP:0xee
20:05:51.550 -> mode:DIO, clock div:1
20:05:51.550 -> load:0x3fcd6100,len:0x438
20:05:51.550 -> load:0x403ce000,len:0x910
20:05:51.550 -> load:0x403d0000,len:0x2464
20:05:51.550 -> SHA-256 comparison failed:
20:05:51.550 -> Calculated: 8a0358da483196ea527b38c9e70583360919a39f5fdafdaf4770dc398052a646
20:05:51.583 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
20:05:51.583 -> Attempting to boot anyway...
20:05:51.583 -> entry 0x403ce000
20:05:51.616 -> 
20:05:51.650 -> Current counter value: 2
20:05:51.650 -> Restarting in 10 seconds...

@me-no-dev
Copy link
Member

@lbernstone says DIO but it's actually switched later to QIO.

Still... very strange issue... any chance you test with other modes too? Does frequency matter?

@P-R-O-C-H-Y
Copy link
Member

@me-no-dev
Only QIO works in 2.0.3 on ESP32C3. Frequency doesn't matter.
Tested if it works in latest IDF 4.4 branch and both modes are working there.

@me-no-dev
Copy link
Member

@P-R-O-C-H-Y you tested in our idf-release/v4.4 branch or you tested in ESP-IDF?

@P-R-O-C-H-Y
Copy link
Member

@me-no-dev I tested SPIFFS example in ESP-IDF.

@me-no-dev
Copy link
Member

can you check with idf-release/v4.4?

@P-R-O-C-H-Y
Copy link
Member

@me-no-dev Same issue with idf-release/v4.4 - DIO not working

@me-no-dev
Copy link
Member

@P-R-O-C-H-Y now that is a very interesting case... WHY? :D

@P-R-O-C-H-Y
Copy link
Member

@me-no-dev Good question :D

@Jason2866
Copy link
Collaborator

@me-no-dev it depends how it is build with the arduino lib builder.
This works with dout. Yours with qio.
But if you try to update between this versions it will fail

@me-no-dev
Copy link
Member

@Jason2866 we found the problem and it is fixed in the soon-to-be-merged release/v4.4 branch/pr (also in the lib-builder)

@VojtechBartoska
Copy link
Contributor

can we close this @P-R-O-C-H-Y?

@P-R-O-C-H-Y
Copy link
Member

Yes, fixed by PR #6910.

Repository owner moved this from In Review to Done in Arduino ESP32 Core Project Roadmap Jul 11, 2022
@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: Test needed Issue needs testing labels Jul 12, 2022
@PaMor969
Copy link

PaMor969 commented Aug 3, 2022

I'm experiencing the same issue after upgrading the espressif framework in platformIO.
Board I'm using is PICO-D4

Sketch was running fine before the upgrade, using

  • framework-arduinoespressif32 @ 3.10006.210326 (1.0.6)
  • tool-esptoolpy @ 1.30100.210531 (3.1.0)
  • toolchain-xtensa32 @ 2.50200.97 (5.2.0)

Then upgraded to latest with

  • framework-arduinoespressif32 @ 3.20004.0 (2.0.4)
  • tool-esptoolpy @ 1.30300.0 (3.3.0)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3

esp_get_idf_version() reports version = v4.4.1-472-gc9140caf8c

Suddenly I'm getting following error for each preferences.getBytes I'm doing:
getBytesLength(): nvs_get_blob len fail: xxxx NOT_FOUND

The issue is no longer occurring when I add following line in the platformio.ini
board_build.flash_mode = qio

To me the issue happened when I get types bytes or Uchar but was not happening when I'm getting Bool or UInt.
I have not tried other types.

@Jason2866
Copy link
Collaborator

Jason2866 commented Aug 3, 2022

@PaMor969 Which board definition you are using in your platformio.ini?
Since Arduino Core 2.0.4 it is mandantory to set the correct flash mode for the board.
If this is not done, bootloop or other issues will occur!
If no default flash mode is set in platformio boards manifest there is no valid flash mode set in firmware magic header

@PaMor969
Copy link

PaMor969 commented Aug 3, 2022

Hi @Jason2866
I'm using
[env:pico32]
platform = espressif32
board = pico32
board_build.partitions = partitions_custom.csv
framework = arduino

Apart from the issue with preferences.getBytes/getUChar (and one small thing related to System Volume Information when reading file structure on an SD card), I have not encountered any other problems since I have upgraded my environment.

@Jason2866
Copy link
Collaborator

The platformio pico32 boards.json is WRONG regarding flash mode.

@valeros
Copy link
Contributor

valeros commented Aug 3, 2022

Sorry to jump in to a closed issue. PlatformIO uses the same flash mode settings as specified in the latest boards.txt for the PICO board. @PaMor969 could you please try your project in the Arduino IDE? Does it work there with the default settings? If so, please forward your issue to https://github.com/platformio/platform-espressif32

@QGB
Copy link

QGB commented Sep 25, 2022

@lbernstone
when i run test nvs code

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (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
[  1123][E][Serial.println_delay.ino:28] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
[  1124][E][Serial.println_delay.ino:31] setup(): Get String Error: ESP_ERR_NVS_NOT_FOUND
Guru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x40058eb6  RA      : 0x42017abe  SP      : 0x3fc92d30  GP      : 0x3fc8b200
TP      : 0x3fc89638  T0      : 0x4038971a  T1      : 0x3fc92dfc  T2      : 0xffffffff
S0/FP   : 0x00000000  S1      : 0x00000001  A0      : 0x00000000  A1      : 0xffffffff
A2      : 0x00000001  A3      : 0x7f7f7f7f  A4      : 0x00000000  A5      : 0x00000004
A6      : 0x3fe00000  A7      : 0x0000000a  S2      : 0x00000000  S3      : 0x3fc933d4
S4      : 0x3fc93168  S5      : 0x00000009  S6      : 0x00000000  S7      : 0x00000000
S8      : 0x3c0302b2  S9      : 0x00000000  S10     : 0x3fc92e04  S11     : 0xffffffff
T3      : 0x00000000  T4      : 0x00000000  T5      : 0x00000000  T6      : 0x00000000
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000005  MTVAL   : 0x00000000
MHARTID : 0x00000000

Stack memory:
3fc92d30: 0xa5a5a5a5 0x00000073 0x00000000 0x3c0302b4 0x3c038444 0x00000000 0x00000000 0x00000000
3fc92d50: 0x00000000 0x00000001 0x00000012 0x00000005 0x00000000 0x3c038ae4 0x00000000 0x00000000
3fc92d70: 0x00000000 0x00000005 0xffffffff 0x7fefffff 0x00000000 0x3fe00000 0x00000002 0x3c03029a
3fc92d90: 0x00000000 0x3fc00000 0x00000000 0x40300000 0x00000000 0x00000001 0x0000005b 0x00000015
3fc92db0: 0x00000000 0x3c038ae4 0x00000000 0x3fc9326c 0x00000000 0x00000000 0x00ffffff 0x7fefffff
3fc92dd0: 0x00000001 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0x00000000 0x3fc00000 0x00000000 0x40300000
3fc92df0: 0x3fc92dfc 0x00000001 0x00000012 0x3c0302a0 0x00000012 0xa5a5a5a5 0xa5a5a5a5 0x3fc93278
3fc92e10: 0xa5a5a5a5 0xa5a5a5a5 0x00a5a5a5 0xa5a5a5a5 0x00000005 0x00000000 0xa5a5a5a5 0xa5a5a5a5
3fc92e30: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x3fc92e4c 0x00000000 0x00000000 0x3c03029a
3fc92e50: 0x00000002 0x3c035000 0x00000015 0x3fc92eec 0x00000004 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fc92e70: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fc92e90: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xffffffff 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fc92eb0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fc92ed0: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xffffff40 0xffffffff 0x00000014 0x00000001 0x31333131
3fc92ef0: 0xffffffff 0x3fc92f24 0x60002000 0x40387ac4 0x00000000 0x3fc92f34 0x60002000 0x0007a120
3fc92f10: 0x00000000 0x3fc92f5c 0x3fc8ae64 0x40389732 0x00000000 0x00010000 0x00000000 0x00000000
3fc92f30: 0x3fc92f20 0x00000000 0x00000005 0x00000000 0x3fc92f30 0x3fc8ae8c 0x0007a121 0x40389d68
3fc92f50: 0x00000004 0x3fc930ac 0x3fc8d000 0x00009040 0x00000004 0x3fc930ac 0x3fc8d000 0x00009024
3fc92f70: 0x00000464 0x3fc92fbc 0x3fc8ae8c 0x40389caa 0x3c030170 0x3fc92fb4 0x00000004 0x00009020
3fc92f90: 0x0000001f 0x3fc8ae8c 0xfffffffc 0x4038a058 0x3fc8aad4 0x00000000 0x60002000 0x00000004
3fc92fb0: 0x3c035000 0x00000004 0x3fc8aeac 0x40386800 0x00000000 0x00000000 0x00010000 0x00000000
3fc92fd0: 0xffffffff 0xffffffff 0x3fc8aeac 0x00009020 0x00009020 0x3fc930ac 0x3fc8ae60 0x403824aa
3fc92ff0: 0x00000000 0x00000004 0x3fc8aeac 0x403812b6 0x3fc911e4 0x00000004 0x00000000 0x4038086e
3fc93010: 0x00009020 0x3fc930ac 0x3fc8ae60 0x00000000 0x00000000 0x00000004 0x00000000 0x40380f9a
3fc93030: 0x00000020 0x00000020 0x3fc8ae60 0x3fc8ae8c 0x00000000 0x00000020 0x00000000 0x40380e3e
3fc93050: 0xcffeddfe 0xcccfeccf 0x3fc8aeac 0x3fc8ae8c 0x00000020 0x00000020 0x3fc8ae60 0x00000002
3fc93070: 0x00000000 0x00000003 0x3fc931bc 0x000000ff 0x00000003 0x3fc911e4 0x00000001 0x3fc8d000
3fc93090: 0x3fc911e4 0x3fc911cc 0x00000000 0x420084c2 0x00000003 0x3fc911e4 0x00000001 0xffffffc2
3fc930b0: 0x000000ff 0x00000002 0x3fc911cc 0x42008a6c 0x00009080 0x3fc9317c 0x3fc8ae60 0x3fc8ae8c
3fc930d0: 0x00000000 0x00000020 0x00000000 0xecffcdef 0x4004c0d4 0x400481c4 0xcefeceef 0xccdfcedf
3fc930f0: 0x3fc89638 0x4038971a 0x00000000 0xffffffff 0x0000000a 0x00000000 0x00000000 0x0000000a
3fc93110: 0x0000002e 0x6000001c 0x00000080 0x60000000 0xa0000000 0x0000000a 0x0000005b 0x00000000



ELF file SHA256: 0000000000000000

Rebooting...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40381782
SPIWP:0xee

@Jason2866
Copy link
Collaborator

@QGB Do you really use latest core 2.0.5 with all updates? Which esptool version is used? There where bugs, which are all solved with latest version.
You have to provide more infos. Versions, all settings you have choosen. The code of the example.

@QGB
Copy link

QGB commented Sep 25, 2022

@Jason2866
when I update esp32-2.0.5 in arduino 1.8.19, esp32c3 even won't boot. It prints:


load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403d10fc
SPIWP:0xee

@Jason2866
Copy link
Collaborator

Jason2866 commented Sep 25, 2022

Choosen settings? Which board? Flash size? Partition scheme? Esptool version?
Just the statement "does not work" does not help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

9 participants