NANO 33 IOT won't connect to WiFi

I'm having an issue connecting my Nano 33 IOT to WiFi. Using the following sketch to test the connection and it stops when it says it can't find the WiFi module. It's a brand new Nano just out of the box.

Here's the code I'm using to test the connection.

/*
Arduino Nano 33 IoT WiFi Test
nano-33-iot-wifi-test.ino
Demonstrates use of WiFiNINA library for WiFi Connectivity
Results on serial monitor

DroneBot Workshop 2021
https://dronebotworkshop.com
*/

// Include SPI and WiFi Libraries
#include <SPI.h>
#include <WiFiNINA.h>

// WiFi Credentials (edit as required)
char ssid[] = "Android....."; //SSID
char pass[] = "........"; //WiFi password

int status = WL_IDLE_STATUS;

// Initialize the Wifi client
WiFiSSLClient client;

void connectToAP() {
// Connect to Wifi Access Point

while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);

// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);

// wait 1 second for connection:
delay(1000);
Serial.println("Connected...");
}
}

void printWifiStatus() {
// Print results to serial monitor

// Network SSID
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// Device IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
}

void setup() {

// Start the Serial port
Serial.begin(9600);

while (!Serial) {
; // Wait for serial port to connect.
}

// Check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("WiFi module failed!");
while (true);
}

connectToAP();

printWifiStatus();

}

void loop() {

}

What am I missing?

BTW I did replace the SSID and WiFi Password with the correct values in the code loaded to the board.

Hello!
I assume you have the lib WifiNINA.h installed on your computer

Then, can you upload the sketch that allow you get the firmware version (CheckFirmware or something like that)? It's in the example of the WifiNINA lib (if you don't find it, tell me)

Once you did it, give us what is printed on the monitor please :upside_down_face:

I loaded the firmware check and I still get this message on the serial monitor:

WiFiNINA firmware check.

Communication with WiFi module failed!

For some reason, the WiFi module is not being recognized on my Nano 33 IOT. I've tried two different boards with the same result.

What are the different boards? Nano 33 IOT as well? Are they brand new too?

Are you on Arduino IDE 2.x or 1.x ?

both boards are Nano 33 IOT, one is brand new just out of the box. I'm using IDE 2.x

Can you pls try with the latest version in 1.x? Which is 1.8.19
Then you upload the code to UPDATE the firmware of the Arduino :

For that, click on "Tools" -> "WiFi101 / WiFiNINA firmware"
A new window should open. Then, click on the button "Open sketch uploader" and upload it to the Arduino.
Once it's done, go back to the firmware window and click on "Test connection" (you may need to select your board before that)
If it's successful, then update the firmware (JUST THE FIRMWARE, DON'T DO ANYTHING WITH THE CERTIFICATES)

When I try to load the updater code I get the following error messages:

typArduino: 1.8.19 (Mac OS X), Board: "Arduino Nano, ATmega328P"

ESP32BootROM.cpp:335:32: error: 'SerialNina' was not declared in this scope
 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);
                                ^~~~~~~~~~
/Users/michaeldalfonzo/Documents/Arduino/libraries/WiFiNINA/examples/Tools/FirmwareUpdater/ESP32BootROM.cpp:335:32: note: suggested alternative: 'Serial'
 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);
                                ^~~~~~~~~~
                                Serial
ESP32BootROM.cpp:335:44: error: 'NINA_GPIO0' was not declared in this scope
 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);
                                            ^~~~~~~~~~
ESP32BootROM.cpp:335:56: error: 'NINA_RESETN' was not declared in this scope
 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);
                                                        ^~~~~~~~~~~
exit status 1
'SerialNina' was not declared in this scope
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Functional-Vlpp: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Functional-Vlpp
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/RTCZero: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/RTCZero
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Blynk_WiFiNINA_WM: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Blynk_WiFiNINA_WM
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/DueFlashStorage: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/DueFlashStorage
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/WiFi101: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/WiFi101
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
	at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
	at cc.arduino.plugins.wifi101.flashers.Flasher.testConnection(Flasher.java:90)
	at cc.arduino.plugins.wifi101.UpdaterImpl$1.run(UpdaterImpl.java:190)


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Are you sure that you configured well the IDE before trying to upload?
I mean, did you gave it the good COM port and did you specify correctly the board?
Maybe you can send a screen of your interface so I can check

Here's a shot of the setup:

Thanks but I meant the window from where you upload the code
Are you sure you are compiling the code for an arduino NANO 33 IOT?

I think I am using the right code, here it is:

/*
  FirmwareUpdater - Firmware Updater for the 
  Arduino MKR WiFi 1010, Arduino MKR Vidor 4000, and Arduino Uno WiFi Rev.2.
  
  Copyright (c) 2018 Arduino SA. All rights reserved.
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#include "ESP32BootROM.h"

typedef struct __attribute__((__packed__)) {
  uint8_t command;
  uint32_t address;
  uint32_t arg1;
  uint16_t payloadLength;

  // payloadLength bytes of data follows...
} UartPacket;

static const int MAX_PAYLOAD_SIZE = 1024;

#define CMD_READ_FLASH        0x01
#define CMD_WRITE_FLASH       0x02
#define CMD_ERASE_FLASH       0x03
#define CMD_MD5_FLASH         0x04
#define CMD_MAX_PAYLOAD_SIZE  0x50
#define CMD_HELLO             0x99

void setup() {
  Serial.begin(1000000);

  if (!ESP32BootROM.begin(921600)) {
    Serial.println("Unable to communicate with ESP32 boot ROM!");
    while (1);
  }
}

void receivePacket(UartPacket *pkt, uint8_t *payload) {
  // Read command
  uint8_t *p = reinterpret_cast<uint8_t *>(pkt);
  uint16_t l = sizeof(UartPacket);
  while (l > 0) {
    int c = Serial.read();
    if (c == -1)
      continue;
    *p++ = c;
    l--;
  }

  // Convert parameters from network byte order to CPU byte order
  pkt->address = fromNetwork32(pkt->address);
  pkt->arg1 = fromNetwork32(pkt->arg1);
  pkt->payloadLength = fromNetwork16(pkt->payloadLength);

  // Read payload
  l = pkt->payloadLength;
  while (l > 0) {
    int c = Serial.read();
    if (c == -1)
      continue;
    *payload++ = c;
    l--;
  }
}

// Allocated statically so the compiler can tell us
// about the amount of used RAM
static UartPacket pkt;
static uint8_t payload[MAX_PAYLOAD_SIZE];

void loop() {
  receivePacket(&pkt, payload);

  if (pkt.command == CMD_HELLO) {
    if (pkt.address == 0x11223344 && pkt.arg1 == 0x55667788)
      Serial.print("v10000");
  }

  if (pkt.command == CMD_MAX_PAYLOAD_SIZE) {
    uint16_t res = toNetwork16(MAX_PAYLOAD_SIZE);
    Serial.write(reinterpret_cast<uint8_t *>(&res), sizeof(res));
  }

  if (pkt.command == CMD_READ_FLASH) {
    // not supported!
    Serial.println("ER");
  }

  if (pkt.command == CMD_WRITE_FLASH) {
    uint32_t len = pkt.payloadLength;
    if (!ESP32BootROM.dataFlash(payload, len)) {
      Serial.print("ER");
    } else {
      Serial.print("OK");
    }
  }

  if (pkt.command == CMD_ERASE_FLASH) {
    uint32_t address = pkt.address;
    uint32_t len = pkt.arg1;
    if (!ESP32BootROM.beginFlash(address, len, MAX_PAYLOAD_SIZE)) {
      Serial.print("ER");
    } else {
      Serial.print("OK");
    }
  }

  if (pkt.command == CMD_MD5_FLASH) {
    uint32_t address = pkt.address;
    uint32_t len = pkt.arg1;

    if (!ESP32BootROM.endFlash(1)) {
      Serial.print("ER");
    } else {
      ESP32BootROM.end();

      uint8_t md5[16];

      if (!ESP32BootROM.begin(921600)) {
        Serial.print("ER");
      } else if (!ESP32BootROM.md5Flash(address, len, md5)) {
        Serial.print("ER");
      } else {
        Serial.print("OK");
        Serial.write(md5, sizeof(md5));
      }
    }
  }
}

Yes you are using the right code (the one that opens by itself when you click on "Open sketch uploader") but you are not compiling it for the right board.
Pls, before trying to upload the code, then go to "Tools", then "Boards" and select the board you are using (Arduino NANO 33 IOT) ; not just Arduino NANO
Can you find your board? It should be under "Arduino SAMD board"

I've verified the board and made sure it's loaded using the board manager. Showing Nano 33 IOT as the connected board. When I try to compile and upload the updater software I get the following error messages.

Arduino: 1.8.19 (Mac OS X), Board: "Arduino NANO 33 IoT"

fork/exec /Users/michaeldalfonzo/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++: no such file or directory
Error compiling for board Arduino NANO 33 IoT.
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Functional-Vlpp: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Functional-Vlpp
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/RTCZero: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/RTCZero
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Blynk_WiFiNINA_WM: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/Blynk_WiFiNINA_WM
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/DueFlashStorage: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/DueFlashStorage
Invalid library found in /Users/michaeldalfonzo/Documents/Arduino/libraries/WiFi101: no headers files (.h) found in /Users/michaeldalfonzo/Documents/Arduino/libraries/WiFi101


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Do you actually have the WiFiNINA library installed on your computer? If not, then install it and try again pls
If yes, then I suggest you to uninstall the IDE, delete all files related to the Arduino software and try again from a new installation

OK, I've uninstalled the IDE and removed WIFININA and reinstalled both. I'm getting the same error.

Can you try to upload the code from the online IDE?
Idk why but it seems that it doesn't compile on your computer and I can't help with that...

I've gotten it to load and run the Firmware Updater and it says it was successful. When I go to the examples file and run the firmware checker it says the firmware needs to be updated. When I rerun the firmware updater sketch I get the response on the Serial Monitor that it's Unable to communicate with ESP32 boot ROM!

I'm not sure what's wrong but there seems to be some kind of disconnect between the IDE and the board.

It is "normal" that it asks you too update to the last version of the firmware because with the IDE 1.8.19 you don't have access to the veryt last version of the firmware (idk why, it's the same for me)

If you want to have the last version, you need to do it with the IDE version 2.x which is less easy to use.

So now, update the firmware with IDE 1.8.19 (so not the last version)
Once it is successful, try again your very first code, hoping you won't have the same error!

Hi Anthony,

I've uncovered a new problem. I've updated the firmware on the Nano 33 IOT board and I've run a couple of the example sketches to test the WiFi connection and it appears that everything is working correctly. Then when I try to get the device to connect through the Cloud IOT platform I get the error that it doesn't see the WiFi module and bombs out. Same board, nothing has changed, just the sketch. When I load the Cloud software it recognizes the board but not the serial port it is connected to so I'm not able to build the sketch and test it. Create Agent is loaded and as far as I can tell it is running. When I switch back to IDE 2.0 it shows both the board and serial port and I can upload and run sketches. However when I load the example to test a WEP Connection I'm back to getting the error that it doesn't see the WiFi module. Also when I try to connect through the Cloud it's not seeing the Nano connected. I've disconnected it and plugged it back in with the same result.