Arm Mbed OS support forum

Help! I'm looking for code for ST BLUENRG-M2SP on a F401RE

I bought this Bluetooth 5.0 module and noticed there is no code to drive it from mbed despite it being mbed 6.0 compatible (according to the mbed website) I can’t find anything about it. The Bluetooth examples I have tried appear to be for earlier versions, including a deprecated message.

A PR is waiting for review on mbed-os that will add the necessary HCI drivers for this BLE module.

You can pull the changes and try them on your local mbed-os clone.

Or you can use the BlueNRG-MS that already works with mbed (we use this one for our product).

Thanks Ladislas for the info.

I pulled the repo, but I could not perform the first operation in the readme, where the ARM Cordio stack is required to be programmed onto the X-NUCLEO-BNRG2A1 board using a firmware image for a different board than the one I am currently using (STMF401RE vs STM32L476RG)

I set the wire from J12 to CN9 I drop the firmware BIN file onto the STMF401RE board and nothing happens.

I guess I will have to use ST’s CubeMX software to try and get this board to work at all. I wanted so much to learn about BT5 with mbed but there’s just nothing from ST for mbed despite their advertising.

Frustrating.

EDIT: I loaded the entire STCubeMX onto my Mac and spent hours trying to get the BLE Beacon example to work, nothing. I guess it’s time to dump the old faithful 401 and cave into ST and buy the 476 (even though I am in no need of it whatsoever) the Cube thing is so complicated and buggy and it needs Java to work. I’m sorely tempted to find another vendor’s implementation and toss this X-NUCLEO-BNRG2A1 in the trash - but - no, just relax and fingers crossed, someone will have a solution to make this board work. It is “new” so I’m in the twilight zone of being too new and there’s no decent support and other stuff is too old and only supported in mbed2. The time-of-flight module also doesn’t work on the F401 - it keeps losing connection to the terrible Windows software - so I am RMAing that board (X-NUCLEO-53L0A1) - not having much luck/fun with ST stuff at the moment :unamused:

Would the STM32WB55 be a good fit for you? It works great out of the box!

Dear user,

The PR has been just updated including the binary to update the BlueNRG-2 FW with a Nucleo-F401RE.

Hope this can help.
Apologize for the inconvenience.

Thanks, I have bought that kit and it is sitting on my bench the USB key style of device is definitely interesting!

Thanks for the PR, I’ve tried to put the FW onto the 401 and I get an error in the serial console;

BlueNRG-2 IFR/Stack Updater.
Start Stack updater…
… error.

I have also put the required reset jumper wire from J12 to PA_8/RESET on CN9 this doesn’t have an effect on the message though.

An alternative could be to update the FW following the procedure described in the documentation attached hereafter

Let us know if it is suitable and works for you.

Thanks for the information. My board is marked 2022, I will buy an ST Link programmer and see if that will fix the problem.

I bought an ST Link v2 programmer and programmed the X-NUCLEO-BNRG2A1 with new firmware and still, it refuses to work.

Steps:

  1. Flashed ST Link V2 to latest FW
  2. Connected ST Link V2 to the pins on the X-NUCLEO-BNRG2A1
  3. Run STSW-BNRGFLASHER select the ST Link V2 in the SWD list
  4. Mass Erase and was successful
  5. Load firmware from BlueNRG GUI 4.0.0\Firmware\BlueNRG2\DTM\DTM_SPI.hex
  6. Flash board and was successful
  7. Disconnect ST Link V2
  8. Put X-NUCLEO-BNRG2A1 onto NUCLEO-F401RE (the supported combination)
  9. Compiled BLE_GattServer example against the NUCLEO-F401RE
  10. In the Output Window I get;
    Ble process started.
    …and that’s it.

The same code, this time targetting the P-NUCLEO-WB55 results in;
Ble process started.
Ble instance initialized
Adding demo service
clock service registered
service handle: 11
hour characteristic value handle 13
minute characteristic value handle 16
second characteristic value handle 19
Advertising started.

P.S. the recommended ST BLE Profile App v 2.0.2 is useless, avoid it, download the Nordic Semiconductor nRF Connect - it actually works!

Hi,
in step 5 try the DTM_SPI.bin referenced by the updated PR

Thanks for sharing your consideration about the ST BLE Profile App. You can find the list of the supported profiles on the Play Store page: