Bricked Nano 33 IoT using WiFiNINA Firmware updater

So, I was trying to fool around with the ESP32 on the Nano 33 IoT. As part of the process I ran the FirmwareUpdater that is part of the "Tools" sketches under the WiFiNINA.

As luck would have it, I could not figure out how to upload the compiled ESP code (clone of "arduino
/ nina-fw" code on GitHub. Anyway, I powered down the Nano 33 IoT (which was running FirmwareUpdater at that time) but on restart the Arduino IDE simply cannnot find the Nano (normally on USB3).

I tried the "double-click" trick to reload a new sketch (the Nano appears on USB4), and I can upload the sketch fine - it will run.

Here's the hitch - once the Nano starts runnning, the IDE loses the Port - the Nano is no longer on USB3 or USB4 - I have no idea where it is. So, I cannot get any information from the Serial Monitor.

So long as I double-click the reset button, I can upload any sketch I like - but as soon as it is uploaded, the Nano 33 IoT no longer talks to the USB, so I can't try to reflash it with the FirmwareUpdater (which started the whole mess).

Any ideas? I don't have the hardware/soldering skills (or any other hardware for that matter) to do a hardware flash - at least, not at this point.

Thanks in advance!

Well, I figured it out. For anyone curious, the problem was obvious:

Don't change your Windows USB driver associated with the Nano!

I had used Zadig to change the USB driver when trying to play with the ESP32 firmware loader (quite unsuccessfully, obviously), and the changed driver (winUSB) did not play noce with the Nano.

I changed the driver back to a usbser driver, and now things seem to be fine.

On the flip side, if anyone has some advice on how to play with the nina-fw software, I would love to hear it. I can compile the code fine, but simply CANNOT get it into the Nano. I don't know how to use the esptool.py utility - keeps saying it can't find the serial port and I've tried all manner of COM1, COM2, COM3, etc. with no luck.

Cheers!

Actually, I did figure out how to program the ESP32 on the IoT 33, using the Arduino SAMD21 as a passthrough to program the ESP32 firmware.

In fact, it's quite simple: follow the instructions at the firmware repository: GitHub - arduino/nina-fw: Firmware for u-blox NINA W102 WiFi/BT module.

That will direct you to the ESP32 toolchain, and you follows THOSE instructions (it is huge, by the way).

When you use the toolchain to compile the nina-fw firmware, you will get a message after a successfull compile, directing you to execute the following to flash the ESP32:

"python /home/lewis/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/lewis/esp/esp-idf/nina-fw/build/bootloader/bootloader.bin 0xf000 /home/lewis/esp/esp-idf/nina-fw/build/phy_init_data.bin 0x30000 /home/lewis/esp/esp-idf/nina-fw/build/nina-fw.bin 0x8000 /home/lewis/esp/esp-idf/nina-fw/build/partitions.bin"

It is THAT step that tripped me up (I'm running windows, not Linux). The bit in the above "--port /dev/ttyUSB0" will not work. The fix is simple: Change it to "--port COMx", "x" being the USB number your IoT 33 shows up on.

Prior to running the above python script, have the IoT 33 run the passthrough program under "Examples|WiFiNINA|Tools|FirmwareUpdater". Then run the python script and, fingers crossed, the two will connect with each other and the ESP firmware will begin flashing (it can be persnippity - keep trying).

Does this actually work? Yes, it does, because not only did I download the latest plain vanilla nina-fw firmware and saw the version number change accordingly in the "Examples|WiFiNINA|Tools|CheckFirmwareVersion" script, but I changed the firmware so that I can get an RSSI when in AP mode (which otherwise returns zero when in AP mode).

Is this a real RSSI? I have no idea. It changes when I move the IoT 33 around, getting better the closer I bring it to my computer, worse when I obscure the IoT 33, but there is a lot of variability.

Is this a stable change to the ESP32 firmware? Again, I have no idea. It seems to work in the short term, but I have no idea if it is stable - e.g., suffers from no memory leaks that will eventually crash the ESP32.

For those interested, the original nina-fw code (C:\msys32\home\YOURNAME\esp\esp-idf\nina-fw\arduino\libraries\WiFi\src\WiFi.cpp) for RSSI was as follows:

int32_t WiFiClass::RSSI()
{
if (_interface == ESP_IF_WIFI_AP)
{
return 0;
}
else
{
esp_wifi_sta_get_ap_info(&_apRecord);

return _apRecord.rssi;
}
}

I changed it to this:

int32_t WiFiClass::RSSI()
{
if (_interface == ESP_IF_WIFI_AP)
{
wifi_sta_list_t staList; //added
esp_wifi_ap_get_sta_list(&staList); //added
if (staList.num > 0) //added
{ //added
return (int32_t) staList.sta[0].rssi; //added
} //added
return 0;
}
else
{
esp_wifi_sta_get_ap_info(&_apRecord);

return _apRecord.rssi;
}
}

Anyway, it does SOMETHING, the most important being that this shows that programming the ESP32 is relatively easy.

BTW, the ESP32 is NOT fully open-source. You cannot get down to the radio level. For example, a key component, "esp_wifi.h" has no corrresponding "esp_wifi.c" - only binaries. Still, there is a lot of interesting stuff that could be done.

Good luck! If anyone else has played around with this (ESP32 programming), I'd love to hear of it.