cancel
Showing results for 
Search instead for 
Did you mean: 

stm32wb55 p2prouter and service

CHEN25
Associate II

We are developing a Bluetooth application using the STM32WB55RG. According to the documentation, I found that using the Router and service approach can achieve a one-to-many connection. I want to know if, once a peripheral establishes a connection with the router, it can still connect to other phones. Can the router simultaneously connect to two phones, as shown in the diagram below? Additionally, I found an open-source project on GitHub that has a server-multiple client connection feature, but I am not sure how it is implemented. Could you provide any documentation on server-multiple client connections?企业微信截图_20241030104206.png

stm32-hotspot/STM32WB-BLE-sensors-multiple-links: This example implements a multilink communication between a STM32WB5MM-DK board and up to 8 smartphones through Bluetooth® LE

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @CHEN25 

I've been able to make it work on both Web Bluetooth App and my phone and also using two Smartphone (an Iphone and another android phone)

IMG20241122152349.jpg

. You just have to:

  • Go to the example BLE_p2pServer on CubeMX and open it on CubeIDE.
  • On the project (in CubeIDE), go to Application > User > STM32_WPAN > App > app_ble.c
  • Between the comments /* USER CODE BEGIN HCI_EVT_LE_CONN_COMPLETE */ and /* USER CODE END HCI_EVT_LE_CONN_COMPLETE */, put this line of code
    Adv_Request(APP_BLE_FAST_ADV);
    to restart the advertising after the connection of the first central device. 

Now, your project will give you the opportunity to connect to the first device and after that you can connect to a second one will the first one is still able to advertise.

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.

View solution in original post

6 REPLIES 6
STTwo-32
ST Employee

Hello @CHEN25 and welcome to the ST Community.

The WB device can support 2 connections as peripheral device (meaning connection to 2 central/master devices) and in // can manage additional connections with 6 peripherals (being a central/master device in this case). So, you can connect your router to two smartphones and connect a server to a Smartphone and a Router.

For more details about how to build a BLE application, you may want to take a look at the AN5289.

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.

Thank you for your answer.AN5289 is useful for my development process, but it doesn't seem to mention how to build a P2PSEVER that can be connected by multiple Client.As you said the WB device supported connecting to two central devices, but there is no mention of it in any of the docs or the official routines.It confuses me.I try to set #define CFG_BLE_ NUM_LINK 8 but it doesn't help, my device can still only be connected by one central device, what should I do to make it work as I want?

Hello @CHEN25 

On the P2P Server example, you have to restart advertising after connecting to the first client. That can be done using the command "Adv_Request(APP_BLE_FAST_ADV);" between "/* USER CODE BEGIN HCI_EVT_LE_CONN_COMPLETE */" and "/* USER CODE END HCI_EVT_LE_CONN_COMPLETE */" on the app_ble.c file of the P2PSEVER (make sure that you are having the last version of the STM32CubeWB V1.20.0).

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.

Thanks!I tried that, but the fact is that the second client can establish a new connection with the server only when the first client disconnects, and there is no effect of simultaneous connections. I have also confirmed that I am using STM32CubeWB V1.20.0. And here is part of the configuration for the test demo.

CHEN25_0-1732267451451.png

CHEN25_1-1732267542526.pngCHEN25_2-1732267689897.png

 

Hello @CHEN25 

I've been able to make it work on both Web Bluetooth App and my phone and also using two Smartphone (an Iphone and another android phone)

IMG20241122152349.jpg

. You just have to:

  • Go to the example BLE_p2pServer on CubeMX and open it on CubeIDE.
  • On the project (in CubeIDE), go to Application > User > STM32_WPAN > App > app_ble.c
  • Between the comments /* USER CODE BEGIN HCI_EVT_LE_CONN_COMPLETE */ and /* USER CODE END HCI_EVT_LE_CONN_COMPLETE */, put this line of code
    Adv_Request(APP_BLE_FAST_ADV);
    to restart the advertising after the connection of the first central device. 

Now, your project will give you the opportunity to connect to the first device and after that you can connect to a second one will the first one is still able to advertise.

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.

Thanks for your answer, I tried to start a new p2psever project from example and it works fine on this new one.