Today I learned that WiFi and Bluetooth LE could NOT be used simultaneously on Arduino boards featuring the ESP32-based u-blox NINA-W102 wireless module, impacting the Arduino Nano RP2040 Connect, Arduino MKR WiFi 1010, and Arduino Nano 33 IoT boards.
It’s a long-running problem since the first Arduino board with NINA-W10 was introduced in 2018, and meant you could use WiFi or Bluetooth LE, but not both simultaneously. The good news is that the issue has finally been fixed, thanks to a new firmware for the module and new WiFi and BLE libraries.
More specifically, you’ll need the following libraries and firmware:
- WiFiNINA library version 2.0.0 or later
- ArduinoBLE library version 2.0.0 or later
- NINA-W102 firmware version 3.0.1 or later
The libraries can easily be updated in the Library Manager in the Arduino IDE, and the firmware needs to be updated with the Firmware Updater Tool in Tools > WiFi101 / WiFiNINA Firmware Updater.
All three boards mentioned in the introduction benefit from the update. However, the Arduino UNO WiFi Rev2 board cannot do so due to limited memory, despite also having a NINA-W102 module. Here’s an example of code where both WiFi and Bluetooth are used at the same time:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <WiFiNINA.h> #include <ArduinoBLE.h> char ssid[] = "yourSSID"; // your network SSID (name) char pass[] = "yourPassword"; // your network password (use for WPA, or use as key for WEP) int status = WL_IDLE_STATUS; void setup() { Serial.begin(9600); while (!Serial); String fv = WiFi.firmwareVersion(); if (fv < "3.0.0") { Serial.println("Please upgrade the firmware, you can't run both WiFi and BLE with this version"); } // attempt to connect to WiFi network: 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 10 seconds for connection: delay(10000); } Serial.println("Connected to WiFi"); // Initialize BLE if (!BLE.begin()) { Serial.println("Failed to initialize BLE!"); while (true); } // Set BLE device name and local name BLE.setLocalName("ArduinoCNXSoftPeripheral"); // Create and add a dummy BLE service BLEService dummyService("180A"); // UUID for the Device Information service BLE.addService(dummyService); // Start BLE advertising BLE.advertise(); Serial.println("BLE advertising started..."); } void loop() { // Add logic here to handle BLE connections or WiFi tasks if needed } |
That’s all good, but why exactly couldn’t WiFi and Bluetooth LE be used simultaneously before? That’s because WiFi was connected through SPI, Bluetooth to UART, and SPI and UART shared some pins to preserve more GPIOs for the user, but creating conflicts when using both at the same time. The solution was to use SPI for WiFi and Bluetooth. This doesn’t explain why it took so long, though.

Via Arduino Blog

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress. We also use affiliate links in articles to earn commissions if you make a purchase after clicking on those links.


