WiFi not Stable over longer periods. Is this normal? Ideas?

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.

bastelbastler:
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.

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?

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.

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?

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.

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...

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

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 :frowning:

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 GitHub - arduino-libraries/WiFi: WiFi Library for Arduino. It may not be the cause of the issue but it would be a good place to start.

Matt

matt_lee_smith:
I would probably recommend raising it as an issue on the Arduino WIFI library at GitHub - arduino-libraries/WiFi: WiFi Library for Arduino.

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:

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.

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

@bastelbastler's bug report:

OMG, its the MKR1000 all over again.

Any solution to this? I have the same problem

mtz8302:
Any solution to this? I have the same problem

You need to detect when your application has lost the connection and restart the WiFi and other protocols that you are using on top of it. e.g. UDP and MQTT. My test board has been running for more than a week now and simply reconnects to my WiFi. I have 30 reconnect events over that time but other than that everything works fine. So, the WiFi module can be managed by software only, no need for power cycling or hard resets so far.

This also necessary for other boards if you want to your application to be robust. It might only be necessary every few month but it has the same solution.

Hello Klaus_K,

Yes, Reconnect does most of the time work over weeks.
To also run month, you need Resets all few weeks with the watchdog, because at some point also reconnect does no longer work.

But:
It is still an important bug. And there are still disconnects - now also proven by you.
This is not normal, a board like an ESP32 does NOT disconnect an stay connected also over month without interruption.

Reconnecting is only a workaround and neccessarry for robustness.
With all such disconnects, the Nano 33 can not be used for a lot of applications.

Imagine a simple presence detector for switching on the light in your smart home.
Not working in 1 out of 100 times because there is no WiFi for 1 minute when you enter the room.
Not talking about alarm equipment, water alarm, wind sensor for your blinds, the charging station of your e-car in the moment you plug it in....
For most applications it is not acceptable to be offline for a minute all few hours...

Sorry to say this, but for Smart Home or most other IOT devices, currently the Nano 33 can not be used due to the frequent disconnects.

I wounder why there is not more attention on this, making a really cool board practically useless.

bastelbastler:
I wounder why there is not more attention on this, making a really cool board practically useless.

Its just a reality of this industry, things are complicated and need time to be solved. The resources for that are payed for by volume shipped. So, fixing a software issue in a 100Munits smartphone gets more people working on it than Arduino development boards. Until the issue is solved the board is still useful for many hobbyists as a educational toy.

bastelbastler:
For most applications it is not acceptable to be offline for a minute all few hours...

You would be surprised for how many applications that is acceptable because people will not pay for more reliability.

Lets hope this gets fixed soon, so you can finish your project.

You are absoluletly right and I understand this.
Debugging radio stuff can be really really tricky with a lot of special equiplment.

Im not looking for a "Fixed right now".
But I wonder why there is no "Thank you for this report, we can reproduce it and are working on it" or somethink like this from Arduino.

Im not shure, but I think you are not from Arduino and no official person, supporter or developer from Arduino has responded to this? So my concerns are - they do not even know about the bug and dont see it here...

You can now see that one of Arduino's developers has been investigating the problem:

i'm working on this i let run a nano 33 iot without disconnection from the AP for 2 days, now i'm planning to make more complex test

Arduino has a ton of code to maintain so it's not always possible to instantly investigate every bug. Fortunately, there are some very talented people on the job so I think this issue is in good hands now.

bastelbastler:
no official person, supporter or developer from Arduino has responded to this?

I am an "official person", and did respond, but certainly my response didn't amount to much. I wish I was an expert in every one of the many facets of Arduino with infinite time to resolve every one of the many thousands of posts on the forum, but unfortunately I'm not so amazing as that.