MKR 1010 not connecting to WPA2 secured networks

Hello,

Arduino IDE 1.8.5 Arduino Board Wifi MKR 1010 Windows 7 / 64 bit

I try to rebuild the project "Telegram Bot with Arduino MKR WiFi 1010" by AppsByDavideV (you can find it on hackster.io).

Unfortunately I can not get it run, because my board does not connect to my WIFI network: 1.) Attempting to connect to WPA SSID: X XXXXXX no success. 2.) WIFI is WPA2, as commonly used and there is a space within the SSID name, but I have also tried a network w/o a space in the SSID name. 3.) SSID and PASSWORD are correctly entered in the code (I checked it often!) - enclosed by double quotes. 4.) When I run the WifiNINA / ScanNetworks example, all visible networks are shown 5.) When I run the WifiNINA / ConnectWithWPA example, it attempts to connect, but no success. 6.) When I upload any sketch I get the error messages "SAM-BA operation failed" and "An error occured while uploading the sketch" and "Verify successful" at the same time and the program seems to work. 7.) status = WiFi.begin(ssid, password); returns 1, sometimes 6 for a moment, sometimes 4. 8.) It connects sometimes, when I restart the Wifi.

Board Info: BN: Arduino MKR WiFi 1010 VID: 2341 PID: 8054 SN: .............

Thank you in advance for any suggestions which could heal the problem!

Reinhard

Are there any special characters in you password or is it super long?

Have you tried to connect to another access point like a hotspot on a smartphone?

Yes, there were spaces and underlines in the SSID and password, but I removed special characters without any improvement.

SSIDs tested are 6 to 12 characters long and passwords are 8 to 9 characters long.

Furthermore I have tried an external power supply and 3x 470uF capacitors - no change.

My WORKAROUND :wink: so far is: WiFi.disconnect(); // WORKAROUND!!!!!!!! status = WiFi.begin(ssid, password);

Now the board connects to WiFi at the second try, but after some time (half an hour to hour) the orange LED next to the USB port starts flashing (why?) and an overnight test failed due to lost connection.

The Arduino MKR WiFi 1010 does not seem to be mature and we, the developers, are the more or less voluntarily beta testers.

There is also a great cavity of documentation so far (just a schema pdf, no placeplan).

I think I will sooner try an ESP8266 module.

This works for me as well. Can't connect without WiFi.disconnect(); line, status is constantly '1'.

@yum

The orange LED is the charge / battery light. It has the same behaviour on some other MKR boards where it will flash after a period. That issue is nothing to be concerned about and when in use with a LiPo its behaviour changes to indicate charge status etc.

@radeftw:

nice to hear that I could save your time and my workaround works for you, too.

Now we have to find a workaround for the issue of disconnecting over night. My approach is to use the watchdog timer from

https://www.arduinolibraries.info/libraries/sodaq_wdt (Thank you, Sodaq!)

which does basically work, but some of the bot routines seem to wait forever or get stuck, when connection is lost and I do not want to dig into the library's code.

If your connection drops, are you able to get your MKR to auto connect back? Once connected, my status doesn't recognize the drop.

That's what I currently work on...but I do not have the solution so far.

If you reboot your wireless source, it has the same effect. WiFi.status() doesn't obtain a real time connection status, which means you can't detect when it's offline. It's the same for the localip. I don't think the drivers (ublox firmware) are fully functional with WiFiNINA. Short of building a timer and periodically connecting back, I'm not sure what to do without realtime status.

Why do think that WiFi.status() doesn't obtain a real time connection status? WiFi.status() queries the WiFi module, if connected or whatever.

Because if I use Serial.println(WiFi.Status) after I turn off the AP, the status never detects it dropped connection. In loop, if it drops connection, I want it to attempt to reconnect back on a timer (until the wifi source comes back online).

After WiFi is setup I do:

 while (true) {
Serial.println(WiFi.status());
delay(1000);
}

After turning off the WAP I see 3 ("connected") for some more seconds and thereafter 6 ("disconnected"). So WiFi.status() works, it is just somewhat delayed.

Sigh... Unifi... it was accessing the next UAP that I assumed was out of range. Is there a chart of what 0,3,5,6 refer to? I get 6 now.

@yum - I solved the drop/reconnect issue. In Loop I just placed...

    while (WiFi.status() != 3) { //Autoconnect back if WiFi is dropped
      WiFi.disconnect();
      status = WiFi.begin(ssid, pass);
      delay(2000);
    }

Hi,

I just got a MKr 1010 and I am trying to connect it to my network. It keep returns me ‘1’ after WiFi.begin. I tried even the WiFi.disconnect() before begin, but it worked just few times. Now it gives me just WL_NO_SSID_AVAIL.

Any idea?

@tatulea

Which sketch and from which set of examples ?

The WiFiNINA examples are the ones to use with the MKR1010.

Only seen that once here and it was my own error with the SSID name.

I am using the WPA connect example from WIFININA. It looks like it is working on my phone hotspot, but not on my router.

Are you trying to connect to a 2G or 5G wireless network ?

Currently only 2G is supported.

Yes, I am trying 2.4G

You find the enumeration of the WiFi return status in /libraries/WiFiNINA/src/utility/wl_definitions.h:

typedef enum { WL_NO_SHIELD = 255, WL_NO_MODULE = WL_NO_SHIELD, WL_IDLE_STATUS = 0, WL_NO_SSID_AVAIL, WL_SCAN_COMPLETED, WL_CONNECTED, WL_CONNECT_FAILED, WL_CONNECTION_LOST, WL_DISCONNECTED, WL_AP_LISTENING, WL_AP_CONNECTED, WL_AP_FAILED } wl_status_t;