Multiple Connections of BLE in Stm32WB55
Hello@STTwo-32 @Remi QUINTIN ,
We are using STM32WB55RG MCU for our development. From the examples I came to know that the BLE device initially starts advertising as peripheral and the mobile device as central will be able to scan the device and initiate the connection. Once connected the device advertising is stopped.
But, I came through the BLE stack document and find out it is possible to have simultaneous connections with the BLE peripheral device upto 8.
I have been trying to have multiple connections of the BLE, like I want the device to be connected as well as advertiser so that it is possible to connect to with other central devices.
Do we have any examples in the STM32WB SDK which shows this behavior of connecting with multiple devices?
If yes, please let me know.
I have tried my side, changing few lines of code in the software as shown below
Firstly, In app_conf.h, i changed maximum number of simultaneous connections that the device will support to 8
#define CFG_BLE_NUM_LINK 8
Secondly, for advertising we use the function Adv_Request, which starts the advertising of the device.
static void Adv_Request(APP_BLE_ConnStatus_t NewStatus)
{
tBleStatus ret = BLE_STATUS_INVALID_PARAMS;
BleApplicationContext.Device_Connection_Status = NewStatus;
/* Start Fast or Low Power Advertising */
ret = aci_gap_set_discoverable(ADV_TYPE,
CFG_FAST_CONN_ADV_INTERVAL_MIN,
CFG_FAST_CONN_ADV_INTERVAL_MAX,
CFG_BLE_ADDRESS_TYPE,
ADV_FILTER,
sizeof(a_LocalName),
(uint8_t*) &a_LocalName,
BleApplicationContext.BleApplicationContext_legacy.advtServUUIDlen,
BleApplicationContext.BleApplicationContext_legacy.advtServUUID,
0,
0);
if (ret != BLE_STATUS_SUCCESS)
{
APP_DBG_MSG("==>> aci_gap_set_discoverable - fail, result: 0x%x \n", ret);
}
else
{
APP_DBG_MSG("==>> aci_gap_set_discoverable - Success\n");
}
/* USER CODE BEGIN Adv_Request_1*/
/* USER CODE END Adv_Request_1*/
/* Update Advertising data */
ret = aci_gap_update_adv_data(sizeof(a_ManufData), (uint8_t*) a_ManufData);
if (ret != BLE_STATUS_SUCCESS)
{
APP_DBG_MSG("==>> Start Fast Advertising Failed , result: %d \n\r", ret);
}
else
{
APP_DBG_MSG("==>> Success: Start Fast Advertising \n\r");
}
return;
}
After connection, How do we re-trigger this adv_request function, so that it is possible for the device to start advertising parallel while connected ?
Please let me know, the possible solutions for this task
