I managed to reduce the code down to the minimum to demonstrate this effect with the WROVER. It has no connection of anything to any of its IO pins, and no SD-card inserted - it is as naked as possible:
Code: Select all
// Wifi connection problems
#include <WiFi.h>
const char* ssid = "mySSID";
const char* password = "myPW";
void setup() {
Serial.begin(115200);
Serial.println("\nConnecting to WIFI");
WiFi.begin(ssid, password); // 1st
delay(10); // 2nd # 5ms: not ok, 8ms: often ok, 10ms: ok
WiFi.begin(ssid, password); // 3rd
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(200);
}
long rssi = WiFi.RSSI(); // RSSI (Received Signal Strength in dBm)
Serial.printf("Successfully connected, getting RSSI: %li \n", rssi);
}
void loop() {
Serial.print("Looping ");
delay(2000);
}
There is no end to the dots (indicating a wait for connection). The very same results come when I comment out only line 2nd, i.e. I have two subsequent WiFi.begin() commands. But when I un-comment 2nd, and thereby have a delay of 10ms between the two WiFi.begin() commands, it works all the time, like this:Connecting to WIFI
...................................................................................
In fact, it still works most of the time with an 8ms delay, but it does not work with only a 5ms delay.Connecting to WIFI
.Successfully connected, getting RSSI: -26
Looping Looping Looping Looping Looping Loo
It looks like the WiFi code is giving up too quickly? Obviously, something has changed during the time I didn't touch my old ESP. Was it some (Arduino) code? or was it my router, a Fritz!Box 7490 (it may have received an upgrade during that time, but I am not sure).