6 years, 9 months ago.

How to implement BLE device discovery?


I have seen code on how to implement BLE service discovery... but I'm looking for device discovery (BLE scanning). How could that be done?

To clarify I have a X-NUCLEO-IDB04A1 BLE shield on top a Nucleo L152RE. I would like it to see nearby BLE devices and print it on UART. I know how to do the UART printing ;) I don't know how to detect presence of other BLE devices nearby... And I haven't found documentation for the BLE library either :(


Question relating to:

/ BLE_HeartRate Featured
Heart Rate Monitor example for the BLE API using nRF51822 native mode drivers

2 Answers

6 years, 9 months ago.

Hi Axelle,

The program Rohit provide is effectively for a nrf51 target. Fortunately, it is possible to change the target and use the proper library for your setup.

The BLE_observer example for your setup is available here: https://developer.mbed.org/users/vcoubard/code/BLE_Observer_Nucleo/

Accepted Answer

That's just great! I just added a few printfs to UART, doing

Serial pc(SERIAL_TX, SERIAL_RX); pc.printf("blan");

posted by Axelle Apvrille 04 Dec 2015

I'm using a Nucleo STM32F401 with X-NUCLEO-IDB04A1 BLE shield, but this program doesn't work: if I don't update libreries the led is freezed, meanwhile if I update libreries there's blinky led but the program doesn't find devices :(

posted by Gabriele Di Simone 28 Jan 2017
6 years, 9 months ago.

https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_Observer/ There are other examples showing the use of scanning APIs

Hmm, thanks. But the code uses pretty much a nRFxxx library, and I'm using the X-NUCLEO-IDB04A1. Not exactly sure how I'll manage to 'port' that. If you have any suggestion, they're welcome...

posted by Axelle Apvrille 04 Dec 2015