nvs_storage.cpp: assertion "dataSize == readSize" failed

elec_gd
Posts: 9
Joined: Mon Aug 31, 2020 10:57 am

nvs_storage.cpp: assertion "dataSize == readSize" failed

Postby elec_gd » Mon Aug 31, 2020 12:26 pm

Hi All,

I have a device using the esp32 wroom-32d and running esp-idf sdk v3.3.1.

When the device reboots occasionally I see the following failed assert:
assertion "dataSize == readSize" failed: file "C:/device/user/repository/esp
-idf/components/nvs_flash/src/nvs_storage.cpp", line 419, function: esp_err_t nvs::Storage::readMultiPageBlob(uint8_t, const char*, void*, size_t) abort() was called at PC 0x400d5ba3 on core 0

When this assert error occurs, the device will reset and print this error again and will continue to repeat this cycle. The only way to recover the device is to reflash it.

Just a note, this device has run an earlier version of the esp-idf sdk where this error was not seen. In the earlier version, nvs_storage.cpp line 419 where the assertion occurs did not exist. Since updating to esp-idf sdk v3.3.1 this error is seen on the device occasionally.

I would appreciate any insights into the cause of this error.Thanks.

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: nvs_storage.cpp: assertion "dataSize == readSize" failed

Postby abansal22 » Tue Sep 01, 2020 12:05 pm

This error comes on the specific code or on all code. Please share the code which is running on Esp. at the time it is throwing the error.

elec_gd
Posts: 9
Joined: Mon Aug 31, 2020 10:57 am

Re: nvs_storage.cpp: assertion "dataSize == readSize" failed

Postby elec_gd » Fri Oct 02, 2020 12:32 pm

Hi,

I wanted to update this post on the reason for the issue described in my original post.

My device previously ran espressif IDF v3.0.x and was being updated to v3.3.x.

It was discovered the NVS partition format changed between 3.1.x and v3.2.x. This means when I upgraded from v3.0.3 to v3.3.1 the NVS partition format changed. Upgrading doesn't cause any problems.
But when downgrading from v3.3.1 to v3.0.x this can cause corruption in the data structure. If I upgrade again to 3.3.x the corrupted data structure can cause the assert error.

To avoid data corruption, do not downgrade your espressif IDF from the newer NVS partition format to the older format.

Who is online

Users browsing this forum: Google [Bot] and 66 guests