I designed and had manufactured a custom version of the Arduino Nano IoT 33 (basically the same, except it has some additional ICs on the PCB). It is working just fine when I program using the Arduino language (e.g. I can get LEDs to light up, PWM output, etc.). The Nina W102 Bluetooth Low Energy module (BLE), however, will not initialize.
I get a failure code returned to me when I run BLE.begin()
(the result is 0, meaning a failure code). I used a debugger to follow the stack trace, and found that the exact function where it fails is here (in HCI.cpp in the ArduinoBLE module):
int HCIClass::reset()
{
return sendCommand(OGF_HOST_CTL << 10 | OCF_RESET);
}
I've reached the limits of my understanding of Arduino and BLE (I'm a little new to this), and don't understand what this code does and whether it's a clue to determine what I have set up wrong.
Some additional comments:
- I have triple checked my circuit schematics and board design. The schematics reflect nearly exactly the Arduino schematic here. https://store.arduino.cc/usa/nano-33-iot (see "PDF schematic"). I say "nearly" because I did not include the ECC608 Crypto Auth module and the LSDM6DS3TR IMU module (I assumed these are not relevant to successful BLE functionality - are they?)
- The BLE.begin() is in my setup() function and there's nothing else in the app. The rest of setup() is empty and the loop() function is empty as well.
-- UPDATE --
I was told that I probably need to update the firmware for the NINA W102 BLE module itself (assuming that's the cause of the problem in my original question), so I followed the instructions here: https://www.arduino.cc/en/Tutorial/WiFiNINA-FirmwareUpdater (WifiNina 1.5.0 library installed - the latest). Every time I hit "Update Firmware" (see screenshot), I get an error message, "Programmer Not Responding. Make sure that FirmwareUpdater sketch is loaded on the board." even though I have successfully loaded the sketch. (Also by the way, I have the latest version of Arduino IDE (1.8.13)).
To dig deeper, I uploaded the sketch via a debugger, and found that it is stuck in this loop of the FirmwareUpdater sketch:
if (!ESP32BootROM.begin(921600)) { Serial.println("Unable to communicate with ESP32 boot ROM!"); while (1); }
The closest available solution on the internet to this problem is here https://forum.arduino.cc/index.php?topic=654833.0 and it did not work for me (still receive the same error, and I think that solution is outdated anyway).
HCI.debug(Serial);
)? If I'm not mistaken, the SAMD21 MCU talks via UART to the NINA W10 module for Bluetooth. Have you checked that communication with an oscilloscope? \$\endgroup\$