cancel
Showing results for 
Search instead for 
Did you mean: 

Bluetooth low energy scan mode

m h
Associate
Posted on August 17, 2017 at 08:24

Hi,

I am using Nucleo l053r8 development board with x-nucleo-idb05a1 extension board which has SPBTLE-RF bluetooth low energy module. 

I am want to make application that can scan for ble devices and reads its advertising data. I can find examples for device as peripheral mode but can't find any example about scanning. 

Can anyone give me some pointers where to look for example code for scanning modes or where should i start to learn more about it?

Thanks

2 REPLIES 2
Frank Weissenborn
Associate II
Posted on August 22, 2017 at 16:18

https://developer.mbed.org/teams/ST/code/BLE_LEDBlinker_IDB0XA1/docs/tip/main_8cpp_source.html

 

You can take this code to start. Instead of connect to the device you can print/save/... advertising data. 

Antonio Vilei
Senior III
Posted on August 24, 2017 at 13:09

Hi,

In the X-CUBE-BLE1 package there is a project implementing both peripheral and central:

STM32CubeExpansion_BLE1_V3.0.0\Projects\Multi\Applications\SampleAppThT

The example is not specific about scanning, though.

If you want to learn more about the way scanning works, you may install the

https://my.st.com/content/my_st_com/en/products/embedded-software/wireless-connectivity-software/stsw-bnrgui.license%3d1502368323559.html

 application for PC.

In order to use the BlueNRG GUI with X-NUCLEO-IDB05A1, you must run the Virtual_COM_Port project (included in the X-CUBE-BLE1 software package) on your STM32 Nucleo board:

STM32CubeExpansion_BLE1_V3.0.0\Projects\Multi\Applications\Virtual_COM_Port

Within the ACI Utilities tab of the GUI, in the Central Role section, there is a Scanning... button that lets you scan for BLE devices. The GUI will show all the related commands and events.

The GUI application also allows you to run many different python scripts that implement the most common functionalities for BLE. Among them, there is one that shows how to scan and connect to a specific device:

Application\scripts\SensorDemo_Central\SensorDemo_Central.py

Even if it is python, by simply getting inspiration from it, you should be able to understand the correct sequence of commands that you need to call in C code.

Hope that helps,

Antonio