(solved) just converted to 3.1.1 and now program won't run

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

(solved) just converted to 3.1.1 and now program won't run

Postby mzimmers » Thu Dec 06, 2018 7:52 pm

Hi all -

I just converted to the 3.1.1 release and am trying to run my newly-built program. In app_main, I call nvs_flash_init(), and get an error ESP_ERR_NVS_NEW_VERSION_FOUND. I ran make erase_flash but got the same results. What step am I forgetting?
Last edited by mzimmers on Mon Dec 10, 2018 3:27 pm, edited 1 time in total.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: just converted to 3.1.1 and now program won't run

Postby mzimmers » Thu Dec 06, 2018 9:50 pm

Sort of fixed...I'd uploaded a .bin file into the NVS partition, and evidently there was a compatibility issue. Plus, when I reverted from 3.2 to 3.1.1, I didn't enable multi-page support. So, my remediation was:

- erase the flash on the chip
- change the multi-page support using make menuconfig
- upload my .bin again (needed for the program)
- make flash my program

I believe it's fixed now.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: just converted to 3.1.1 and now program won't run

Postby ESP_Angus » Thu Dec 06, 2018 10:38 pm

Hi mzimmers,

NVS is backward compatible but not forwards compatible.

Do I understand correctly that when you moved to v3.1.1 you didn't generate a brand new NVS .bin and upload it? You either kept the NVS data which was already in the flash or you re-uploaded a .bin file which was previously generated for v3.2?

Specifically, the ESP_ERR_NVS_NEW_VERSION_FOUND error means the the NVS partition in the flash has a newer version of NVS than the version which can be parsed by the running code. This is because the default format changed between v3.1.1 and v3.2.

In the special case of IDF v3.1.1, enabling multi-page blob support will cause ESP-IDF V3.1.1 to use the same updated format version that is used in V3.2. This option is not present in V3.2 or master branch (multi-page blob support is always enabled in these versions).

If you don't need to seed initial data to NVS, one workaround is to erase flash or manually flash a new NVS partition.

Another workaround is to choose to respond to the error in code. Most of the IDF examples do this:

Code: Select all

    esp_err_t ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
But you may wish to do something more complicated depending on what you're storing in NVS - for example, store the initial NVS data (generated for the matching IDF version) in a separate "seed" partition and copy it across if there's a version mismatch due to a rollback.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: just converted to 3.1.1 and now program won't run

Postby mzimmers » Thu Dec 06, 2018 10:48 pm

Hi Angus - I'd been working with a beta release of 3.2. As we're getting closer to product release, I figured I'd better fall back to the most recent true release. There were a few minor glitches (include files moved or missing) but overall it was fairly uneventful. I think the thing that will trip people up the most is the multi-page support - you need to remember to enable it in your menuconfig, or existing .bin files won't work. As it happened, I regenerated my .bin file for nvs using the 3.1.1 tool as well, so it all worked out.

Who is online

Users browsing this forum: No registered users and 105 guests