1

I've got the same code running on 2 different boards:

  1. MKR1010
  2. Adafruit Feather M0

I'm using WiFiNINA on the former, and WiFi101 on the latter.

Other than that, the code that's exactly the same: every 10 seconds connects to WiFi, sends an HTTPS Request, and then sends a response back to the server (response is a bunch of metrics: memory, counter, time & day).

I am also using a WDT to reset the board if it hangs.

After a lot of refinement and experiments, the Adafruit board is able to run for days with no hangs (indicated by no WDT triggers), and no visible degradation (e.g. memory stays stable over time).

The MKR1010 board, on the other hand, resets several times per day.

What I've done?

I've been able to narrow down issues to the network stack (I think). I've randomly injected a bogus hostname to the WiFikSSLClient::connect method (e.g every n calls, where n is random, I will switch the real hostname with something that will not resolve, simulating a longer latency).

In reviewing the WiFi101 codebase I've found a long, hardcoded, non-customizable timeout here.

...
while (_info[sock].state == SOCKET_STATE_CONNECTING && millis() - start < 20000) {
        m2m_wifi_handle_events(NULL);
    }
...

20 seconds is greater than the max WDT timeout (16 seconds). You can argue that for network operations, 20 seconds would be reasonable, but I'm expecting connections in my network to happen much faster, so I tweaked the library (WiFi101) to 10 seconds and the reliability increased significantly. Every once in a while I get a connection error, but that is fine. The system recovers nicely on the next attempt.

I have not been able to find similar timeouts in WiFiNINA (looks like a much more complex codebase too, but that is my first impression. I'm not an expert)

If I disable the WDT around the connect method, then the MKR1010 will hang after some time. If I leave it, it will recover through a WDT reset.

I'm making sure the firmware on both boards is up to date.

While the WDT solves the issue of ensuring the board recovers, I'd love to fix it properly.

Questions

  • Is this consistent with anyone's experience?
  • Are there alternatives to WiFiNINA for the MKR1010?
  • Is there something obvious I'm missing when configuring the WiFI stack (e.g. a timeout someplace else)?
3
  • I'm a bit lost here: you say you have a problem with the MKR1010/WiFiNINA combination, and changing a time-out in the WiFi1010 library helps? – ocrdu Dec 22 '20 at 20:30
  • Thanks @Juraj for the edits, good catches! ocrdu, sorry I wasn't clear enough. In a nutshell: > MKR1010 + WiFiNINA -> not reliable > Adafruit Feather M0 + WiFi101 -> reliable (once I changed the library timeout to 10s) – Eugenio Pace Dec 22 '20 at 22:06
  • Could this be the same problem as described here? github.com/arduino-libraries/WiFiNINA/issues/103 – ocrdu Dec 23 '20 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.