Skip to main content
Associate II
February 28, 2025
Solved

Establishing Connection - BLE P2P Server/Client B-WB1M-WPAN1

  • February 28, 2025
  • 2 replies
  • 945 views

Hi, 

I am setting up a p2p Client and p2p Server example using 2x B-WB1M-WPAN1 boards. There is no example I can find for the B-WB1M-WPAN1 so I have taken the Nucleo example and modified to suit the B-WB1M-WPAN1. 

I cannot connect the p2p Server to the p2p Client. Here is where I am at:

- P2P Server is operational and available on the ST BLE Toolbox phone app. 

- P2P Server advertising settings as below

Connor48_1-1740783492814.png

- P2P Client is running and a button press will initiate a scan as below. 

Connor48_0-1740783415110.png

Connor48_2-1740783535899.png

 

Questions:

1. Does the p2p_Client application apply a device filter to the scan procedure, and if so what is being filtered and where can I modify this filter to find my device? Could this be my issue?

2. In future I would like to only connect to devices with a specific ID, where could I set this ID and is there an automatic re-connect capability if the ID is fixed?

 

Thank you for any help.

Best answer by Connor48

For anyone with this same issue the solution for me was very simple. 

In app_ble.c of the p2p_client the advertising data is filtered for manufacturer specific data. I added the the print messages below to see what k+2 and k+3 was.

To proceed to connect k+2 must be 0x01 and k+3 0x83.

I also had to reduce the adlength filter to 4 instead of 7. 

 

Additional print functions:

 

 

 

/* USER CODE BEGIN AD_TYPE_MANUFACTURER_SPECIFIC_DATA */

APP_DBG_MSG("Manufacturer Specific Data\n");
APP_DBG_MSG("k+2: %X \n",adv_report_data[k + 2]);
APP_DBG_MSG("k+3: %X \n",adv_report_data[k + 3]);
APP_DBG_MSG("Ad Length %d \n",adlength);

/* USER CODE END AD_TYPE_MANUFACTURER_SPECIFIC_DATA */
if (adlength >= 4 && adv_report_data[k + 2] == 0x01) //>=7 in example
{ /* ST VERSION ID 01 */
APP_DBG_MSG("--- ST MANUFACTURER ID --- \n\r");
switch (adv_report_data[k + 3])
{ /* Demo ID */
case CFG_DEV_ID_P2P_SERVER1: /* End Device 1 */
APP_DBG_MSG("-- SERVER DETECTED -- VIA MAN ID\n\r");

 

 

 
Print result:

Manufacturer Specific Data

k+2: 1

k+3: 83

Ad Length 4

— ST MANUFACTURER ID —

— SERVER DETECTED — VIA MAN ID

Event Type: 00, Data Size: 19

Advertising Data: 02 0A 00 03 09 50 44 03 03 0D 18 04 FF 01 83 00 02 01 06

 

To change the manufacturer specific data use either:

app_ble.c in p2p_server app and update the a_AdvData array:

 

 

4, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x01, 0x83, 0x00 /* */,

 

 

Or, use CubeMX to update this same line of code here in your p2p_Server.ioc:

Connor48_0-1741386494019.png

I hope this helps out someone else!

 

2 replies

Connor48Author
Associate II
March 6, 2025

Hey,

Is there any more information I could provide to help with assistance?

Or are there any other useful documents other than AN5289?

@STTwo-32 any suggestions?

Cheers, Connor. 

Connor48AuthorBest answer
Associate II
March 7, 2025

For anyone with this same issue the solution for me was very simple. 

In app_ble.c of the p2p_client the advertising data is filtered for manufacturer specific data. I added the the print messages below to see what k+2 and k+3 was.

To proceed to connect k+2 must be 0x01 and k+3 0x83.

I also had to reduce the adlength filter to 4 instead of 7. 

 

Additional print functions:

 

 

 

/* USER CODE BEGIN AD_TYPE_MANUFACTURER_SPECIFIC_DATA */

APP_DBG_MSG("Manufacturer Specific Data\n");
APP_DBG_MSG("k+2: %X \n",adv_report_data[k + 2]);
APP_DBG_MSG("k+3: %X \n",adv_report_data[k + 3]);
APP_DBG_MSG("Ad Length %d \n",adlength);

/* USER CODE END AD_TYPE_MANUFACTURER_SPECIFIC_DATA */
if (adlength >= 4 && adv_report_data[k + 2] == 0x01) //>=7 in example
{ /* ST VERSION ID 01 */
APP_DBG_MSG("--- ST MANUFACTURER ID --- \n\r");
switch (adv_report_data[k + 3])
{ /* Demo ID */
case CFG_DEV_ID_P2P_SERVER1: /* End Device 1 */
APP_DBG_MSG("-- SERVER DETECTED -- VIA MAN ID\n\r");

 

 

 
Print result:

Manufacturer Specific Data

k+2: 1

k+3: 83

Ad Length 4

— ST MANUFACTURER ID —

— SERVER DETECTED — VIA MAN ID

Event Type: 00, Data Size: 19

Advertising Data: 02 0A 00 03 09 50 44 03 03 0D 18 04 FF 01 83 00 02 01 06

 

To change the manufacturer specific data use either:

app_ble.c in p2p_server app and update the a_AdvData array:

 

 

4, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x01, 0x83, 0x00 /* */,

 

 

Or, use CubeMX to update this same line of code here in your p2p_Server.ioc:

Connor48_0-1741386494019.png

I hope this helps out someone else!