1

in addition to the standard LED_BUILTIN, MKR 1010 WIFI comes with a built-in RGB LED.

This RGB LED fails when used along the on-board BLE, no matter what program sequence I test.

To reproduce the issue, turn on the LED and then start BLE which will turn the LED off.

#include <WiFiNINA.h>
#include <utility\wifi_drv.h>
#include <ArduinoBLE.h>

void setup() {

  const int ledPin = 27;  //R=26 G=25 B=27

  WiFiDrv::pinMode(ledPin, OUTPUT);

  WiFiDrv::digitalWrite(ledPin, HIGH);

  Serial.begin(115200);
  while (!Serial);

  if (!BLE.begin()) { // ble.begin trun the led off
    Serial.println("BLE Failed");
    while (1);
  }

  Serial.println("BLE started"); // last line shown on console
  
  WiFiDrv::digitalWrite(ledPin, HIGH); 

  // program never gets here

}


void loop() {}

The RGB LED is connected to NINA’s GPIO pins. Two of them (green and blue) are part of the UART, and another one is used for system control signals (red).

I assumed that BLE.begin uses the UART to communicate with the processor and therefore avoided the red pin and added delays between commands hoping to separate the actions, but it didn’t work.

My goal is to use the RGB LED to indicate BLE states without adding three sets of MOSFETs and resistors. Ideas?

0

1 Answer 1

1

The ArduinoBLE library resets the NINA firmware to BLE mode (code here). In this mode the NINA firmware just sets ESP32 SDK (IDF framework) to handle the BLE commands.

The RGB LED is handled by the part of the Arduino NINA firmware which handles the commands from the WiFiNINA library. These commands are communicated over SPI and are not handled if the firmware is in BLE mode.

1
  • Appreciate the clarifications, thanks Juraj
    – Nino
    May 15, 2023 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.