Arduino-esp32: nvs_open fail error when using WiFi

Created on 22 Oct 2017  Â·  11Comments  Â·  Source: espressif/arduino-esp32

I am using the latest code as of this post. Both the latest ESP-IDF from Git master and the latest Arduino-ESP32 download. I have a sketch which enables WiFi ... see:

https://pastebin.com/7KvKX27J

All compiles and flashes cleanly, but at runtime, I get the error:

Connecting to XXX
W (84) wifi: wifi nvs_open fail ret=4353

E (84) wifi: wifi_init 1410 ret=4353
[E][WiFiGeneric.cpp:120] wifiLowLevelInit(): esp_wifi_init 4353
W (87) wifi: wifi nvs_open fail ret=4353

E (90) wifi: wifi_init 1417 ret=4353
[E][WiFiGeneric.cpp:120] wifiLowLevelInit(): esp_wifi_init 4353
.......................

I am building my solution using Arduino as a component in ESP-IDF as opposed to using the Arduino IDE. I can recreate at will and am happy to provide any additional information or screen share as needed.

Most helpful comment

Don't forget to initialize NVS using nvs_flash_init() before enabling WiFi.
Previously that was not strictly required, as WiFi driver would also call nvs_flash_init if the application didn't. It doesn't do that anymore, so application should take care of NVS initialization before WiFi or Bluetooth drivers are started.

All 11 comments

Your BLE device causing this? I saw in your BLE code that you nvs_open

It shouldn't ... if we look at the pastebin of the code I am using here:

https://pastebin.com/7KvKX27J

I had hoped I had commented out all the BLE code calls... so it was nothing but WiFi. I'm for sure not saying the error isn't in my code ... I'm just not seeing it yet and have tried to back out to just WiFi. I noticed that the WiFi library changed in Arduino-ESP32 the other day.

Don't forget to initialize NVS using nvs_flash_init() before enabling WiFi.
Previously that was not strictly required, as WiFi driver would also call nvs_flash_init if the application didn't. It doesn't do that anymore, so application should take care of NVS initialization before WiFi or Bluetooth drivers are started.

WiFi Does start the NVS :) @nkolban is this still present with the latest build? I had no issues running BLE and WiFi at the same time

I am also trying to use my custom code with the arduino-esp32 core as an esp-idf component, and ran into the same problem. I found that nvs_flash_init() called from app_main() was failing. The error code was ESP_ERR_NVS_NO_FREE_PAGES indicating a problem with the nvs partition.
After erasing the chip flash with "make erase_flash" the nvs init succeeded, and the WiFi connection also worked (and nvs_open failures were gone).
I am not sure why the problem appeared suddenly, probably some change in the esp-idf/arduino-esp32 triggered this and we need to erase the flash fully to make it work correctly.

this can happen if you switch partition schemes and they have different nvs size.

I encoutered the same problem, the solution is to unselect Wifi nvs enabled in menuconfig ,component config -> Wifi -> Wifi NVS Flash. And make flash.

I just had a similar issue out of the blue, not using ble, nothing in sketch but printdiag()

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11404
entry 0x40078a28
W (17) wifi: wifi nvs_open fail ret=4353

E (17) wifi: wifi_init 1408 ret=4353
[E][WiFiGeneric.cpp:118] wifiLowLevelInit(): esp_wifi_init 4353

 Starting
E (23) wifi: esp_wifi_get_mode 789 wifi is not init
E (23) wifi: esp_wifi_get_channel 1168 wifi is not init
E (23) wifi: esp_wifi_get_auto_connect 1345 wifi is not init
Mode: 
Channel: 252
Auto connect: 63
E (31) wifi: esp_wifi_get_config 1011 wifi is not init
SSID (12): �E�?��?��?
Passphrase (0): 
BSSID set: 1

and now this

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:812
load:0x40078000,len:0
load:0x40078000,len:11404
entry 0x40078a28

 Starting
E (1034) wifi: esp_wifi_get_mode 789 wifi is not init
E (1035) wifi: esp_wifi_get_channel 1168 wifi is not init
E (1035) wifi: esp_wifi_get_auto_connect 1345 wifi is not init
Mode: Guru Meditation Error: Core  1 panic'ed (LoadProhibited)
. Exception was unhandled.
Register dump:
PC      : 0x400014e8  PS      : 0x00060730  A0      : 0x800f1cd0  A1      : 0x3ffd09c0  
A2      : 0x800f25c6  A3      : 0x800f25c4  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x800f1b78  A9      : 0x3ffd0990  
A10     : 0x3ffc1798  A11     : 0x3f404330  A12     : 0x00000000  A13     : 0x3ffd0660  
A14     : 0x3ffd0660  A15     : 0x00000004  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x800f25c4  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffe  

Backtrace: 0x400014e8:0x3ffd09c0 0x400f1ccd:0x3ffd09d0 0x400f1d15:0x3ffd09f0 0x400f2670:0x3ffd0a10 0x400d080d:0x3ffd0ad0 0x400f25c3:0x3ffd0af0

And after I erase flash

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
>ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

hmmm, that part might be normal though,

Ok seems to be fixed, erased flash and then
made sure wifi was enabled before calling printDiag().

printdiag was cause, #1088

W (20) wifi: wifi nvs_open fail ret=4353

I start getting this again..

Gonna nvs erase

This issue is closed, because it looks as if it is not a bug or problem with the ESP32 Arduino core or its support libraries. For general API usage questions or help on specific coding challenges, please visit the arduino-esp32 Gitter channel. If you feel this issue was closed in error, reopen it and comment, why you think this is a bug in the Arduino-Core.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AsafFisher picture AsafFisher  Â·  4Comments

DrewHoyt picture DrewHoyt  Â·  4Comments

merlinschumacher picture merlinschumacher  Â·  4Comments

0x1abin picture 0x1abin  Â·  3Comments

maxpromer picture maxpromer  Â·  3Comments