Skip to main content
Associate II
October 30, 2024
Solved

stm32wb55 p2prouter and service

  • October 30, 2024
  • 1 reply
  • 1453 views

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

Best answer by STTwo-32

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

1 reply

STTwo-32
Technical Moderator
November 19, 2024

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

CHEN25Author
Associate II
November 22, 2024

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?

STTwo-32
Technical Moderator
November 22, 2024

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