nvs_entry_find Getting ERROR:ESP_ERR_INVALID_ARG
Posted: Tue Aug 01, 2023 9:39 am
I am trying to use the bellow code to find an entry in my NVS storage but I am getting error: ESP_ERR_INVALID_ARG.
My partition table is:
I keep on getting error: E (3607) scan: Error: ESP_ERR_INVALID_ARG
I couldn’t figure out which argument is invalid in the code.
My partition table is:
Code: Select all
#
# Name Type SubType Offset Size Flags
nvs data nvs 0x6000
otadata data ota 0x2000
ota_0 app ota_0 0x180000
ota_1 app ota_1 0x180000
storage data spiffs 0x6000
Code: Select all
Code:
const char *nswifi = "nswifi";
nvs_handle_t nwifi;
void mysearch()
{
err = nvs_open(nswifi, NVS_READWRITE, &nwifi);
if (err != ESP_OK)
{
printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
return;
}
else
{
nvs_iterator_t it = NULL;
esp_err_t res = nvs_entry_find(NULL, nswifi, 0x01, &it);
while (res == ESP_OK)
{
nvs_entry_info_t info;
nvs_entry_info(it, &info); // Can omit error check if parameters are guaranteed to be non-NULL
printf("key '%s', type '%d' \n", info.key, info.type);
res = nvs_entry_next(&it);
}
ESP_LOGE(TAG, "Error: %s", esp_err_to_name(res));
nvs_release_iterator(it);
}
}
I couldn’t figure out which argument is invalid in the code.