cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with BLE Central Mode Scanning on STM32WB55CG in BLE_p2pClient Example

brahmananda
Associate II

Hello STM32 Community,

I am currently working with the STM32WB55CG microcontroller and am using the BLE_p2pClient example from the STM32 SDK. My goal is to configure the device in central mode, start scanning, and retrieve the MAC address of the nearest BLE device.

Issue Description:
I followed the setup instructions in the example, including uploading the BLE stack specified in the README file.

To initiate scanning, I used the following function call:


status = aci_gap_start_general_discovery_proc(0x4000, 0x4000, 0x00, 0);
However, I am not receiving any data or MAC addresses from nearby devices. The scan seems to start, but I do not see any output with device information.

Questions:
Is it possible to use the STM32WB55CG to scan and retrieve MAC addresses of nearby BLE devices in central mode using this SDK and example?
Could there be an issue with my setup or BLE stack configuration that might prevent the scan from returning results?
Additional Information:
I am new to STM32 development, so if there are specific APIs or configuration steps required to ensure central mode scanning works, I would greatly appreciate any guidance or documentation references.

Thank you in advance for your help!

6 REPLIES 6
STTwo-32
ST Employee

Hello @brahmananda 

I think this post have a very good discutient on the MAC address. It contains what should answer your question.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STTwo-32 ,

Thank you for your reply.

I want to know the MAC or BD address of nearby devices, not my own. I have configured my device in central mode and want to scan for nearby devices and retrieve their MAC or BD addresses.

So please help me in this regard.

Thank you 

You can get your BD address when you receive a CONNECT_REQ packet.

See in attachment a description of this packet format:

STTwo32_0-1731481226618.jpeg

You just have to analyze the received packed to extract your BD address depending on the role of your device: Initiator = Client or Advertiser = Server.

One the connection is accepted by the advertiser. The connection is identified by the  AccessAddress field that reflects the value of the AA (AccessAddress) field which is the first item of the Link Layer field of the PDU.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STTwo-32 

I believe there may be some misunderstanding. My goal is to scan for nearby BLE devices in advertising mode and retrieve their MAC addresses on the central device without establishing a connection. For example, when we turn on Bluetooth on a smartphone, it shows a list of all nearby devices that are advertising.

I don't want to get  the MAC or BD address of the own device.

I want to set up my STM32 board to function similarly to a smartphone, allowing it to detect and display the MAC addresses of all nearby BLE devices in advertising mode.

Could you please guide me on which API to use to scan for nearby device MAC addresses and print them on the STM32 board, similar to how they would appear on a phone?

I have attached a photo for better understanding.

 

In addition to this is ble central mode is supported on STM32WB55CGU6 ? Can I use the exact BLE_P2PClient example to configure the device in central mode on STM32WB55CGU6 board?

the BLE_p2pClient is a central device. To be able to read the address of the nearby devices (without connection) you have to:

  • Starts an observation procedure using the ACI_GAP_START_OBSERVATION_PROC  
  • The ACI_GAP_START_OBSERVATION_PROC will generate the event called HCI_LE_ADVERTISING_REPORT_EVENT. It Indicates that one or more Bluetooth devices have responded to an active scan or received some information during a passive scan. From this event you can extract the Address and the Address_Type of this device. 

More clarifications are available on the AN5270 - Rev 27.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.