Delayed WiFi.begin() with "ESP32 WROVER Module" board selected

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Delayed WiFi.begin() with "ESP32 WROVER Module" board selected

Postby boarchuz » Tue Aug 21, 2018 5:59 am

There is a 1500ms delay between WiFi.begin() and SYSTEM_EVENT_WIFI_READY using an ESP32-WROVER with "ESP32 WROVER Module" selected as board in Arduino IDE.
This problem does not occur if a different board is selected. Tested using the same ESP32-WROVER physical module but with "ESP32 Dev Module" selected, the SYSTEM_EVENT_WIFI_READY returns in 90-100ms (normal).
Also, this problem does not occur if a different SoC is used. Tested using a Wemos LOLIN32 (ESP-WROOM-32) with "ESP32 WROVER Module" selected as the board, again it performs normally (90-100ms).

Test code:

Code: Select all

#include <WiFi.h>

void WiFiEvent(WiFiEvent_t event)
{
    switch (event)
    {
    case SYSTEM_EVENT_WIFI_READY:
        Serial.print("[");Serial.print(millis());Serial.print("ms]\t");
        Serial.println("WiFi ready");
        break;
    case SYSTEM_EVENT_STA_CONNECTED:
        Serial.print("[");Serial.print(millis());Serial.print("ms]\t");
        Serial.println("Station connected");
        break;
    case SYSTEM_EVENT_STA_GOT_IP:
        Serial.print("[");Serial.print(millis());Serial.print("ms]\t");
        Serial.print("IP address: ");Serial.println(WiFi.localIP());      
        break;
    }
}

void setup()
{
    Serial.begin(115200);
    WiFi.onEvent(WiFiEvent);
    WiFi.begin();
}

void loop()
{
    delay(1000);
}
Typical output using ESP-WROOM-32 with "ESP32 Dev Module" (OK):

Code: Select all

[90ms]	WiFi ready
[1054ms]	Station connected
[1069ms]	IP address: 192.168.0.140
Typical output using ESP-WROOM-32 with "ESP32 Wrover Module" (OK):

Code: Select all

[93ms]	WiFi ready
[1012ms]	Station connected
[1060ms]	IP address: 192.168.0.140
Typical output using ESP32-WROVER with "ESP32 Dev Module" (OK):

Code: Select all

[96ms]	WiFi ready
[1103ms]	Station connected
[1145ms]	IP address: 192.168.0.46
Typical output using ESP32-WROVER with "ESP32 Wrover Module" (SLOW):

Code: Select all

[1501ms]	WiFi ready
[2431ms]	Station connected
[2449ms]	IP address: 192.168.0.46

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Delayed WiFi.begin() with "ESP32 WROVER Module" board selected

Postby ESP_igrr » Tue Aug 21, 2018 6:19 am

Can you also log something from the beginning of "setup" function? I suspect that it's not SYSTEM_EVENT_WIFI_READY that is delayed, but "setup" is called later due to external memory test.

Memory test can be disabled using https://docs.espressif.com/projects/esp ... AM_MEMTEST option (if you are using Arduino, you need to use it as an ESP-IDF component in order to change sdkconfig options).

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Re: Delayed WiFi.begin() with "ESP32 WROVER Module" board selected

Postby boarchuz » Wed Aug 22, 2018 6:30 am

You're right, it's setup that is delayed. And it's something to do with RAM- Setting "PSRAM" to "Enabled" in the ESP32 Dev Module options also creates the ~1500ms delay.

I've set up ESP-IDF and had a play. Enabling CONFIG_SPIRAM_SUPPORT adds a negligible difference whether or not CONFIG_SPIRAM_MEMTEST is enabled (setup() still called within 20-40ms). It's my first time using it, so take this with a grain of salt.

Regardless, I don't need the additional RAM for this project so I'm just going to take the easy route and avoid that configuration for now. Using the ESP-IDF also introduces new issues like ~1000ms between connecting to the AP and getting an IP which I'd rather avoid debugging!

Who is online

Users browsing this forum: No registered users and 56 guests