cannot read nvs_flash

Posts: 1
Joined: Fri Apr 16, 2021 2:45 pm

cannot read nvs_flash

Postby alphasion » Sat Apr 17, 2021 10:42 am

in my code ,i first callled

and write some parameters into nvs

Code: Select all

nvs_handle mHandler;
                  if (nvs_open(WIFI_TAG, NVS_READWRITE, &mHandler) == ESP_OK)
                     nvs_set_str(mHandler, NVS_SSID, wifi_ssid);
                     nvs_set_str(mHandler, NVS_PASS, wifi_pass);
                     if (nvs_commit(mHandler) == ESP_OK)
                        i2c_oled_showstr(0, 6, "W");

but while i try to read this with this code

Code: Select all

nvs_handle mHandler;
   bool ret = false;
   ret = nvs_open(WIFI_TAG, NVS_READONLY, &mHandler);
   ESP_ERROR_CHECK(nvs_get_str(mHandler, NVS_SSID, wifi_ssid, &wifi_ssid_length));
   ESP_ERROR_CHECK(nvs_get_str(mHandler, NVS_PASS, wifi_pass, &wifi_pass_length));
   return ret;

there is an error :
ESP_ERROR_CHECK failed: esp_err_t 0x110c (ESP_ERR_NVS_INVALID_LENGTH) at 0x40221cd8
could any one tell me where my problem is?thx
btw,my partition table is Single Factory app,no OTA

Her Mary
Posts: 488
Joined: Mon Oct 27, 2014 11:09 am

Re: cannot read nvs_flash

Postby Her Mary » Thu Apr 22, 2021 5:18 pm

Could this example help?

Who is online

Users browsing this forum: No registered users and 5 guests