nvs_open return ESP_ERR_NVS_NOT_FOUND after erase flash
Posted: Fri Jan 13, 2023 1:47 am
hello,
i have a working project that uses nvs.
if i do a it return ESP_ERR_NVS_NOT_FOUND.
if i flash an example from $IDF_PATH/examples/storage/nvs... the example works, and than if i flash my project it starts working again.
What i am missing?
follows partition configuration:
and my initNvs function, if it can help
i have a working project that uses nvs.
if i do a
and reflash the project, NVS don't work anymore because when i doidf.py erase-flash
Code: Select all
esp_err_t err = nvs_open("storage", NVS_READONLY, &my_handle);
if i flash an example from $IDF_PATH/examples/storage/nvs... the example works, and than if i flash my project it starts working again.
What i am missing?
follows partition configuration:
Code: Select all
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
storage, data, spiffs, , 0xF0000,
Code: Select all
void initNvs(void)
{
ESP_LOGI(TAG, "init nvs");
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());
ESP_LOGI(TAG, "format nvs");
ret = nvs_flash_init();
}
ESP_LOGI(TAG,"init nvs return %s", esp_err_to_name(ret));
ESP_ERROR_CHECK(ret);
}