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.