Doesn't connect to WIFI without scanning first

Hi,

I've recently bought an MKR WIFI 1010 board to replace my Nano 33 IoT. Connecting to my local WPA2-PSK network did not work anymore on the new board. The status is WL_DISCONNECTED.

I started playing around with the WiFiNINA examples, to see if any of those work. I tried first the ConnectWithWPA example, which, as expected, did not connect to my network.

Interestingly, the scanNetworks example worked, and even more interestingly, re-uploading the ConnectWithWPA right after, that one worked as well. But if I re-uploaded the ConnectWithWPA example one more time, it did not connect anymore.

Then I tried adding directly before the line WiFi.begin(..) in the ConnectWithWPA example an extra WiFi.scanNetworks() call. Having that line before WiFi.begin(..) I can consistently connect to my network.

Then I tried replacing the WiFi.scanNetworks() line by a simple delay(10000), but then it stopped connecting, therefore at this point I am convinced that something is happening in the scanNetworks library call, which makes the following WiFi.begin(..) succeed, even with a full board reset inbetween, but not without scanNetworks library call.

The strange thing is that I did not have this problem at all with the Nano 33 IoT device.

Could you please help me with further debugging this strange problem? Is it possible that it's a problem with my MKR board, that it's faulty, or do I do something wrong?

Thanks a lot in advance.

do the Nano and the MKR have the same firmware version?

Thanks a lot, Juraj, your question indirectly led me to the cause of the problem: I forgot to change the board from Nano 33 IoT to MKR WIFI 1010 :slight_smile:

The firmware was indeed different on the two boards, and I wanted to downgrade, and the FirmwareUpdater did not work either. That got me suspicious, and finally I figured out that I forgot to switch to MKR WIFI 1010 board type.

Thanks again,
Dani