cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect an STM32WB server to multiple clients

STTwo-32
ST Employee

The STM32WB as a server can be connected to 8 clients max for the STM32WB3x and STM32WB5x.
In contrast, 5 clients max for the STM32WB1x using the stm32wbxx_BLE_Stack_full_fw.bin stack (from STM32CubeWB version 1.21.0).

To achieve this, the server node must continuously restart advertising as long as the number of active connections is below the maximum supported connections. This maximum is defined by the CFG_BLE_NUM_LINK parameter in the app_conf.h file.

For example, in the BLE_p2pServer application, you need to modify the app_ble.c file. Specifically, add the following lines in the HCI_LE_CONNECTION_COMPLETE_EVENT section:

/* USER CODE BEGIN HCI_EVT_LE_CONN_COMPLETE */
/* restart advertising */
   Adv_Request(APP_BLE_FAST_ADV);
/* USER CODE END HCI_EVT_LE_CONN_COMPLETE */

This process restarts the advertising each time a new connection is established until the number of connections reaches the value defined by CFG_BLE_NUM_LINK (up to a maximum of 8).

Related links

Version history
Last update:
‎2025-02-21 1:51 AM
Updated by:
Contributors