Hello,
Whatever I try, i can not manage to have a real stable WiFi connection using WiFiNINA.
In average all 12 hours the Nano disconnects for unknown reason and need a reconnect.
In average all 30 hours the reconnect is not possible in 2 minutes and the Watchdog resets the nano - then the reconnect work again.
My Access point is a Fritz Box 7490.
I configured the AP to NOT change the channel, because this also trigger a disconnect, but my access point stay at defined channel.
For comparison I connected the second nano 33 to a repeater FritzRepeater 1200.
Both Nano 33 have the latest Firmware installed, what show up in "firmwareVersion()" as "1.2.3".
I run different slightly modified example Scetches (example client doing 1 requst all 30s, example server getting 1 call all 30s) on 2 Nano 33 IoT and both show the same behavior. One without any peripherals.
WiFi signal is in good strengh with -51 and -67 dBm (WiFi.RSSI())
Before reconnecting, i always call "WiFi.end()" this help to make reconnects happen more often.
When Reconnects fail - the "WiFi.reasonCode()" show rarely for a single time 202 (WIFI_REASON_AUTH_FAIL) or 1(WIFI_REASON_UNSPECIFIED), but most of the time 0 in an endless loop.
Failed reconnects show a status of 4 (WL_CONNECT_FAILED), rarely 255 (WL_NO_SHIELD), or 0 (WL_IDLE_STATUS)
Watchdog is set to 2 Minutes. (Using Adafruit_SleepyDog.h and Adafruit_ZeroTimer.h). Resetting the WD in a timer ISR each second and keep track of the 2 minutes timeout by myself. Just set a variable in loop to the time and compare the time in the ISR.
My ESP32 in the same network stay connected over month without issues.
So my Questions:
- Someone managed to have a stable connection over weeks without disconnects, or is this disconnect frequency normal?
- Any ida what to try further to get it more stable?
My Reconnect code, called in loop():
void reconnectWiFi()
{
int statusWiFi = WiFi.status();
// attempt to connect to Wifi network:
while ( statusWiFi != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
Serial.print("Status: ");
Serial.println(statusWiFi);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
statusWiFi = WiFi.begin(ssid, pass);
reconnectCounter ++;
if( statusWiFi != WL_CONNECTED )
{
Serial.print("Connect Fail - call end() wait 5s status:");
Serial.println(statusWiFi);
Serial.print("Reason code: ");
Serial.println(WiFi.reasonCode());
// Connect was not successful... retry
WiFi.end();
delay( 5000 );
} else {
// Give it 1s connected...
delay( 1000 );
}
}
}
Code for Client and Server are as in the examples.
Setup include "WiFi.noLowPowerMode();"
Loop include "ArduinoOTA.poll();" for easier flashing of the two nanos.