stm32duino/STM32duinoBLE

unable to get BLE examples working with STM32WB5MM-DK board.

ThunderMink opened this issue · 2 comments

I am having problems getting BLE working on this board. All examples give this in the serial monitor: starting BLE failed! using Arduino IDE 2.0.4
I have tried to update FUS and STACK but that did not help. Probably something simple that i am missing. The BLE works fine when using STM32CubeIDE.

STM32CubeProgrammer FUS info: FUS state = IDLE, FUS status = FUS_NO_ERROR, FUS version = v1.2.0.0, STACK VERSION = v1.15.0.3, FUS OPERATOR = v3.1.0.

Arduino IDE settings:
Board = Discovery
Board part number = STM32WB5MM-DK
C runtime library = Newlib standard
Upload method = SWD

Here is the serial monitor dump for the Scan.ino example:

sys evt: 0xFF subevtcode: 0x9200 payload: 00
mm evt released: 0xFF subevtcode: 0x9200 buffer addr: 0x20030028
sys cmd: 0xFC66 payload: 00 00 00 00 00 00 00 00 44 00 08 00 40 05 08 01 3A 79 9C 00 F4 01 00 02 FF FF FF FF 48 01 01 01 00 20 D8 06 00 08 CF 00 00 00 00 00 0C
sys rsp: 0x0E cmd opcode: 0xFC66 status: 0x00
ble cmd: 0x0C03
ble rsp: 0x0E cmd opcode: 0x0C03 numhci: 0x01 status: 0x00
ble cmd: 0xFC0C payload: 00 06 E6 BD 26 E1 80 00
ble rsp: 0x0E cmd opcode: 0xFC0C numhci: 0x01 status: 0x00
ble cmd: 0xFC0F payload: 01 18
ble rsp: 0x0E cmd opcode: 0xFC0F numhci: 0x01 status: 0x00
ble cmd: 0x2018
ble rsp: 0x0E cmd opcode: 0x2018 numhci: 0x01 status: 0x00 payload: 79 F3 06 95 97 12 36 7B
ble cmd: 0x2005 payload: 79 F3 06 95 97 D2
ble rsp: 0x0F cmd opcode: 0x2005 numhci: 0x01 status: 0x01
starting BLE failed!

Here is the Scan.ino

#include <STM32duinoBLE.h>

/*
Scan

This example scans for BLE peripherals and prints out their advertising details:
address, local name, advertised service UUID's.

The circuit:

  • Boards with integrated BLE or Nucleo board plus one of BLE X-Nucleo shield::
    • B-L475E-IOT01A1
    • B_L4S5I_IOT01A
    • STEVAL-MKBOXPRO
    • STEVAL-MKSBOX1V1,
    • NUCLEO-WB15CC
    • P-NUCLEO-WB55RG
    • STM32WB5MM-DK
    • X-NUCLEO-IDB05A2
    • X-NUCLEO-IDB05A1
    • X-NUCLEO-BNRG2A1

This example code is in the public domain.
*/

#if defined(ARDUINO_STEVAL_MKBOXPRO)
/* STEVAL-MKBOXPRO /
SPIClass SpiHCI(PA7, PA6, PA5);
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_LP, PA2, PB11, PD4, 1000000, SPI_MODE3);
#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj(&HCISpiTransport);
BLELocalDevice& BLE = BLEObj;
#endif
#elif defined(ARDUINO_STEVAL_MKSBOX1V1)
/
STEVAL-MKSBOX1V1 /
SPIClass SpiHCI(PC3, PD3, PD1);
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_1S, PD0, PD4, PA8, 1000000, SPI_MODE1);
#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj(&HCISpiTransport);
BLELocalDevice& BLE = BLEObj;
#endif
#elif defined(ARDUINO_B_L475E_IOT01A) || defined(ARDUINO_B_L4S5I_IOT01A)
/
B-L475E-IOT01A1 or B_L4S5I_IOT01A /
SPIClass SpiHCI(PC12, PC11, PC10);
HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, PD13, PE6, PA8, 8000000, SPI_MODE0);
#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj(&HCISpiTransport);
BLELocalDevice& BLE = BLEObj;
#endif
#elif defined(ARDUINO_NUCLEO_WB15CC) || defined(ARDUINO_P_NUCLEO_WB55RG) || defined(ARDUINO_STM32WB5MM_DK)
HCISharedMemTransportClass HCISharedMemTransport;
#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj(&HCISharedMemTransport);
BLELocalDevice& BLE = BLEObj;
#endif
#else
/
Shield IDB05A2 with SPI clock on D3 /
SPIClass SpiHCI(D11, D12, D3);
HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
#if !defined(FAKE_BLELOCALDEVICE)
BLELocalDevice BLEObj(&HCISpiTransport);
BLELocalDevice& BLE = BLEObj;
#endif
/
Shield IDB05A2 with SPI clock on D13 /
// #define SpiHCI SPI
// HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M0, A1, A0, D7, 8000000, SPI_MODE0);
// #if !defined(FAKE_BLELOCALDEVICE)
// BLELocalDevice BLEObj(&HCISpiTransport);
// BLELocalDevice& BLE = BLEObj;
// #endif
/
Shield IDB05A1 with SPI clock on D3 /
// SPIClass SpiHCI(D11, D12, D3);
// HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
// #if !defined(FAKE_BLELOCALDEVICE)
// BLELocalDevice BLEObj(&HCISpiTransport);
// BLELocalDevice& BLE = BLEObj;
// #endif
/
Shield IDB05A1 with SPI clock on D13 /
// #define SpiHCI SPI
// HCISpiTransportClass HCISpiTransport(SpiHCI, SPBTLE_RF, A1, A0, D7, 8000000, SPI_MODE0);
// #if !defined(FAKE_BLELOCALDEVICE)
// BLELocalDevice BLEObj(&HCISpiTransport);
// BLELocalDevice& BLE = BLEObj;
// #endif
/
Shield BNRG2A1 with SPI clock on D3 /
// SPIClass SpiHCI(D11, D12, D3);
// HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M2SP, A1, A0, D7, 1000000, SPI_MODE1);
// #if !defined(FAKE_BLELOCALDEVICE)
// BLELocalDevice BLEObj(&HCISpiTransport);
// BLELocalDevice& BLE = BLEObj;
// #endif
/
Shield BNRG2A1 with SPI clock on D13 */
// #define SpiHCI SPI
// HCISpiTransportClass HCISpiTransport(SpiHCI, BLUENRG_M2SP, A1, A0, D7, 1000000, SPI_MODE1);
// #if !defined(FAKE_BLELOCALDEVICE)
// BLELocalDevice BLEObj(&HCISpiTransport);
// BLELocalDevice& BLE = BLEObj;
// #endif
#endif

void setup() {
Serial.begin(115200);
while (!Serial);

// begin initialization
if (!BLE.begin()) {
Serial.println("starting BLE failed!");

while (1);

}

Serial.println("BLE Central scan");

// start scanning for peripherals
int ret = 1;
do
{
ret = BLE.scan();
if (ret == 0)
{
BLE.end();
BLE.begin();
}
} while(ret == 0);
}

void loop() {
// check if a peripheral has been discovered
BLEDevice peripheral = BLE.available();

if (peripheral) {
// discovered a peripheral
Serial.println("Discovered a peripheral");
Serial.println("-----------------------");

// print address
Serial.print("Address: ");
Serial.println(peripheral.address());

// print the local name, if present
if (peripheral.hasLocalName()) {
  Serial.print("Local Name: ");
  Serial.println(peripheral.localName());
}

// print the advertised service UUIDs, if present
if (peripheral.hasAdvertisedServiceUuid()) {
  Serial.print("Service UUIDs: ");
  for (int i = 0; i < peripheral.advertisedServiceUuidCount(); i++) {
    Serial.print(peripheral.advertisedServiceUuid(i));
    Serial.print(" ");
  }
  Serial.println();
}

// print the RSSI
Serial.print("RSSI: ");
Serial.println(peripheral.rssi());

Serial.println();

}
}

Hi @ThunderMink
As stated in the README.md:

In order to use this library with SM32WBxx series, you need to update the STM32WB Copro Wireless Binaries
with stm32wbxx_BLE_HCILayer_fw.bin depending of your mcu:
https://github.com/STMicroelectronics/STM32CubeWB/tree/master/Projects/STM32WB_Copro_Wireless_Binaries
Each subdirectories contains binaries and Release_Notes.html which explain how to update it.

So do you use the stm32wb5x_BLE_HCILayer_fw.bin?

Hi fpistm! thanks for the fast reply, yes i use the HCILayer. Now i got another devlopement board that uses stm32wb55 and i had no problem getting that one to work so i guess the stm325mmk had some problem getting the firmware programmed. i did not get any errors or anything when updating the firmware. i need to try to re-flash the firmware again and verify the start adress and firmware that is beeing used.