Hi!
I get an issue when use arduino ide and try to connect my ESP32 to wifi network. It looks like the connection happens but it does not obtain IP address via DHCP. At least I see name of the network and signal strength
#define WIFI_SSID "MyNetwork-2.4G-HELLO"
#define WIFI_PASSWORD "ABCDEF123"
void initWiFi() {
WiFi.disconnect();
delay(4000);
WiFi.useStaticBuffers(true);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
uint8_t status = WiFi.waitForConnectResult();
Serial.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Serial.print(status);
Serial.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Serial.print(WiFi.status());
if (WiFi.status() == WL_CONNECTED) {
Serial.println("");
Serial.println("Connected to WiFi");
printWifiStatus();
} else {
Serial.println("");
Serial.println("NOT Connected to WiFi! Restarting");
ESP.restart();
}
}
I see the output of status and WiFi.Status() is 0 (WL_IDLE_STATUS), sometimes it ends up in 6 (WL_DISCONNECTED) or 4 (WL_CONNECT_FAILED)
Serial output shows following:
[ 6086][V][STA.cpp:204] _onStaEvent(): STA Connected: SSID: MyNetwork-2.4G-HELLO, BSSID: 9c:52:f8:71:4e:78, Channel: 2, Auth: WPA2_PSK
[ 6087][V][NetworkEvents.cpp:119] checkForEvent(): Network Event: 13 - STA_CONNECTED
[ 6095][V][STA.cpp:110] _onStaArduinoEvent(): Arduino STA Event: 13 - STA_CONNECTED
It seems it was connected but I never get WL_CONNECTED so my board restarts. If I cancel the restart I get Wifi network connected with signal strength but 0.0.0.0 IP.
Static IP seems working but it is not my requirements. All other devices connect to this network without any issues.