arduino-libraries / ArduinoBLE

ArduinoBLE library for Arduino
GNU Lesser General Public License v2.1
291 stars 198 forks source link

Support for NINA-B31 Modules #321

Closed felixerdy closed 10 months ago

felixerdy commented 10 months ago

I'm trying to modify the library in a way, so that I can use it on another board (senseBox MCU mini) together with the Bluetooth Bee which is running on a NINA-B312 module.

While I'm able to communicate with AT commands

void setup() {
    Serial3.begin(115200);
    delay(500);
    Serial3.print("AT+UFACTORY\r");
    Serial3.flush();
}

I can't get the library running. I'm setting the HardwareSerial in the src/utility/HCIUartTransport.cpp but the HCI.reset() function in src/local/BLELocalDevice.cpp is failing.

There are some differences between NINA-B30 and B31 modules, but I don't know if they have an effect on this library.

Screenshot 2023-08-30 at 23 46 05

Source: NINA-B3 Data Sheet

facchinm commented 10 months ago

Hi @felixerdy , the NINA B31 module comes pre-flashed with u-connect firmware, that's why you are able to communicate via AT commands. The HCIUartTransport class expects an HCI H4 port listening on the other side to correctly interpret the protocol instead. To be able to use this library you should write from scratch a transport (akin to HCIVirtualTransportAT) that implements the functionalities over AT. Unfortunately we don't support any similar board (the closest one is UNO R4 WiFi but in that case we have full control over the firmware).