ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

YxWang
Posts: 23
Joined: Sat Oct 20, 2018 1:13 am

ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

Postby YxWang » Wed Nov 28, 2018 1:00 am

由于和其他公司合作,对方仅提供二进制文件。
烧录文件后,提示:
ESP_ERROR_CHECK failed: esp_err_t 0x1110 (ESP_ERR_NVS_NEW_VERSION_FOUND) at 0x400d2305
file: "src\main.c" line 289
func: app_main
expression: ret

Backtrace: 0x4008d423:0x3ffcd100 0x4008d98c:0x3ffcd120 0x400d2305:0x3ffcd140 0x400d2498:0x3ffcd180

Rebooting...
不知该如何解决,以及为何会产生这样的问题。望解答,谢谢各位!

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

Postby ESP_igrr » Wed Nov 28, 2018 1:09 am

NVS format has been changed between v3.1 and v3.2 to support longer blob values. If newer firmware (v3.2) sees the NVS partition produced by older firmware, it will automatically update the format of the partition. However the reverse is not true: if you first run the newer firmware (based on v3.2) and then downgrade to a firmware which uses 3.1, then the older firmware will not be able to read newer NVS partition.
Such situation may happen in development if you use the same dev board to test multiple applications. In this case, do 'make erase_flash' to erase the entire contents of the flash chip, clearing the NVS partition. Then flash your firmware again.
In the source code it is recommended to check the error returned by nvs_flash_init and call nvs_flash_erase if the error is due to partition version mismatch. Please check storage/nvs_rw_value example in IDF for details.

YxWang
Posts: 23
Joined: Sat Oct 20, 2018 1:13 am

Re: ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

Postby YxWang » Wed Nov 28, 2018 1:54 am

ESP_igrr wrote:
Wed Nov 28, 2018 1:09 am
NVS format has been changed between v3.1 and v3.2 to support longer blob values. If newer firmware (v3.2) sees the NVS partition produced by older firmware, it will automatically update the format of the partition. However the reverse is not true: if you first run the newer firmware (based on v3.2) and then downgrade to a firmware which uses 3.1, then the older firmware will not be able to read newer NVS partition.
Such situation may happen in development if you use the same dev board to test multiple applications. In this case, do 'make erase_flash' to erase the entire contents of the flash chip, clearing the NVS partition. Then flash your firmware again.
In the source code it is recommended to check the error returned by nvs_flash_init and call nvs_flash_erase if the error is due to partition version mismatch. Please check storage/nvs_rw_value example in IDF for details.
thank you, you are right!

tosemusername
Posts: 18
Joined: Tue Feb 05, 2019 5:28 pm
Location: Brazil

Re: ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

Postby tosemusername » Mon Feb 25, 2019 5:52 pm

If newer firmware (v3.2) sees the NVS partition produced by older firmware, it will automatically update the format of the partition.
What exactly performs this action? And when is it performed?
Is it one of the python scripts at building time, or automatically at boot time? Or what?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP_ERR_NVS_NEW_VERSION_FOUND 错误如何解决

Postby ESP_igrr » Tue Feb 26, 2019 2:39 am

It happens at run time, when your application calls nvs_flash_init or nvs_flash_init_partition. NVS library recognizes that the storage format version in flash is older than the current format version, and performs the update. Update is done in-place but is safe in case of power loss: when the power is restored, application will start up again and call nvs_flash_init, which will continue the update.

Who is online

Users browsing this forum: No registered users and 40 guests