ESP32-S3 Wifi not working with flash encryption

Uschi_bloom
Posts: 3
Joined: Tue Feb 14, 2023 1:50 pm

ESP32-S3 Wifi not working with flash encryption

Postby Uschi_bloom » Mon Mar 06, 2023 2:04 pm

I wrote an Arduino program that connects to a wifi network or creates an access point. To use flash encryption I compiled and flashed my program with the esp-idf and Arduino as component.

With flash encryption disabled everything works as it should.
However, now that I have flash encryption enabled, my program is no longer able to connect to a wifi network or create an access point.
For example, when trying to create an access point, I only get the message via the console:
E (163) esp_core_dump_flash: No core dump partition found!
E (165) nvs: CONFIG_NVS_ENCRYPTION is enabled, but no partition with subtype nvs_keys
[296][E][WiFiGeneric.cpp:680] wifiLowLevelInit(): esp_wifi_init 4353
[296][E][WiFiAP.cpp:154] softAP(): enable AP first!

My code to connect to a wifi network looks like this:

Code: Select all

IPAddress localIP;
IPAddress localGateway;
IPAddress subnet(255, 255, 0, 0);

bool InitWiFi(String ssid, String pass, String ip, String gateway) {
    if (ssid == "") {   //Undefined SSID
        return false;
    }

    WiFi.mode(WIFI_STA);
    localIP.fromString(ip.c_str());
    localGateway.fromString(gateway.c_str());

    if (!WiFi.config(localIP, localGateway, subnet)) {  //STA Failed to configure
        return false;
    }
    WiFi.begin(ssid.c_str(), pass.c_str());
    
    unsigned long currentMillis = millis();
    previousMillis = currentMillis;

    while (WiFi.status() != WL_CONNECTED) {
        currentMillis = millis();
        if (currentMillis - previousMillis >= waitInterval) {   //Failed to connect
            return false;
        }
    }
    
    return true;
}

And the code for the access point:

Code: Select all

WiFi.softAP("WifiName", NULL);
I have also tried:

Code: Select all

WiFi.mode(WIFI_AP);
WiFi.softAP("WifiName", NULL);

Does anyone have any idea why it stopped working with flash encryption enabled and what I could try to get it working again?

Uschi_bloom
Posts: 3
Joined: Tue Feb 14, 2023 1:50 pm

Re: ESP32-S3 Wifi not working with flash encryption

Postby Uschi_bloom » Tue Mar 07, 2023 10:09 pm

I have managed to get it to work.
Apparently there were problems with the nvs partition. I deleted all flash memory and rebuilt the partition table with a bigger offset.
Then after I reprogrammed the program everything worked.

Who is online

Users browsing this forum: No registered users and 53 guests