Arduino core for ESP32 Wiki content

WiFi connection problem – NVS corrupted

If you have WiFi connection problems where WiFi.status() always returns WL_NO_SSID_AVAIL even you are sure that the AP is available and working, it might be that the NVS storage has been corrupted.

The NVS storage is the place where esp-idf stores the WiFi credentials. See issue wifi connection problem on Arduino-esp32. To check if your NVS storage is corrupted you can use ESP32-Show_nvs_keys provided by stickbreaker.

If your NVS storage is corrupted you can use the following code snippet to wipe all stored NVS keys. Attention, you will loose your previously stored WiFi credentials when using this.

#include <nvs.h>
#include <nvs_flash.h>
void clearNVS() {
    int err;
    err=nvs_flash_init();
    Serial.println("nvs_flash_init: " + err);
    err=nvs_flash_erase();
    Serial.println("nvs_flash_erase: " + err);
 }