Go Down

Topic: WiFi not Stable over longer periods. Is this normal? Ideas? (Read 2776 times) previous topic - next topic

bastelbastler

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():
Code: [Select]
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.


pert

Both Nano 33 have the latest Firmware installed, what show up in "firmwareVersion()" as "1.2.3".
The latest NINA firmware is 1.3.0. Please update to Arduino IDE 1.8.12, update the firmware, then test again to check whether the problem still occurs.

bastelbastler

I update to IDE 1.8.12, wifiNINA 1.5.0 and FW 1.3.0.
Test started, but will take a few days for results.
I will come back to you in 2 days.

So you are saying it is working for you stable?
Anyone testet this for a few days if the connection is stable?

pert

I haven't done any long-term testing of the boards with WiFi NINA modules for stability. The boards I have are used to provide support, write documentation, and test software, so they are constantly getting new sketches uploaded to them.

bastelbastler

Update: Already had the fist disconnect the 1.3.0 is also not stable.

This is from the FritzBox (Accesspoint) logfile.
It shows first connect - then the disconnect and Reconnect for no reason.

As you can see from the log, all other WiFi devices are still connected (no disconnect message).
Also other Nano 33 and ESP32 devices are working during this dosconnect.
The nano 33 is only affected one by one at random times.

Any chance to forward this to NINA developers for help? How to contact them for a bug report?


Code: [Select]

17.02.20 08:42:52 WLAN-Gerät angemeldet (2,4 GHz), 72 Mbit/s, arduino-32d0, IP 192.168.178.44, MAC A4:CF:12:84:32:D0.
17.02.20 08:42:42WLAN-Gerät wurde abgemeldet (2,4 GHz), arduino-32d0, IP 192.168.178.44, MAC A4:CF:12:84:32:D0.
17.02.20 08:28:12 WLAN-Gerät angemeldet (2,4 GHz), 72 Mbit/s, arduino-32d0, IP 192.168.178.44, MAC A4:CF:12:84:32:D0.

bastelbastler

Is there absolutely no one out there who run aNANO 24/7 like i try to do?

Would be really great if those persons could share if this is only related to my setup or if their nanos 33 also have unexpexted disconnects and this is related to the product...


matt_lee_smith

Hello bastelbastler,

I am working on a device that needs to be connected 24/7, I will try and run a test in the next week or so and get back to you.

What is the full code you are using?

Thanks,
Matt

bastelbastler

#7
Feb 23, 2020, 04:03 pm Last Edit: Feb 23, 2020, 04:06 pm by bastelbastler
You can use the original arduino examples and still it has disconnects.
Valid vor client and for server example.

Think the Arduino sketch can not influence this and its a firmware bug.
Still have no idea how to reach out to Arduino to get help on this and report an official bug :(

matt_lee_smith

I still haven't managed to get the long test going yet. Will do soon.

In the meantime, I would probably recommend raising it as an issue on the Arduino WIFI library at https://github.com/arduino-libraries/WiFi. It may not be the cause of the issue but it would be a good place to start.

Matt

pert

I would probably recommend raising it as an issue on the Arduino WIFI library at https://github.com/arduino-libraries/WiFi.
That is the repository for the WiFi library, which is only used for the long since retired Arduino WiFi Shield. The equivalent library for the Nano 33 IoT is the WiFiNINA library. Its repository is here:
https://github.com/arduino-libraries/WiFiNINA

Klaus_K

I have a test setup running now for 24 hours. So far I have 6 reconnect events.

My system sends two MQTT messages every minute and I can manually send MQTT messages that the node is described to. The sketch checks whether it is still connected to the MQTT server and then restarts the WiFi stack. The number of restarts is send as one of the MQTT messages and stored in an database.

I will let the system run for a little while longer and will keep you updated on the results.

bastelbastler

Thank you Klaus_K.
You already confirmed that it is also not stable for you and there are lots of reconnects neccessary.

Will try to raise this bug in on Github


briantee


mtz8302


Go Up