Issues with Setting Advertisement Data on STM32WB
Hi,
I have an STM32WB and I'm working with an example. I'm trying to understand how to add data to the advertisement data, including the name:
- I thought that all advertisement data is set here,
ret = aci_gap_set_discoverable(ADV_IND,
Min_Inter,
Max_Inter,
CFG_BLE_ADDRESS_TYPE,
NO_WHITE_LIST_USE, /* use white list */
sizeof(_advData),
(uint8_t*) _advData, BleApplicationContext.BleApplicationContext_legacy.advtServUUIDlen,
BleApplicationContext.BleApplicationContext_legacy.advtServUUID,
0,
0);
and that I don't need to call any other function. Is this correct? Because there are other functions like hci_le_set_advertising_data or aci_gap_update_adv_data.
- I found that the maximum size for advertisement data is 31 bytes, but from version BLE 5 should be able to set size of adv data more then 31 Bytes, Is it able to extend this data with STM32 Stack? How?
Here is how I fill my advData
static uint8_t _advData[BLE_ADV_DATA_SIZE /* flags */] = {
/* first block - setting flags */
0x02,
AD_TYPE_FLAGS,
FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE, // 2 = no time limit
/* second block - name */
BLE_BLE_NAME_FIX_PART_SIZE + 1, // 3 + 1 is name flag
AD_TYPE_COMPLETE_LOCAL_NAME, // 9 = AD_TYPE_COMPLETE_LOCAL_NAME
'G', // [5] G
'W', // [6] W
':', // [7] :
BLE_DEV_MANUF_DATA_SIZE + 1, // 8 + 1 manuf data flag
AD_TYPE_MANUFACTURER_SPECIFIC_DATA, // FF = Complete local name
0, // index [10]
1, // index [11]
2, // index [12]
3, // index [13]
4, // index [14]
5, // index [15]
6, // index [16]
7, // index [17]
};
When I call advData only with the function aci_gap_set_discoverable, it does not work correctly (see photo 1). However, if I additionally call the function hci_le_set_advertising_data(sizeof(_advData), (uint8_t*) _advData);, it works (see photo 2). If I call the function aci_gap_update_adv_data(sizeof(_advData), (uint8_t*) _advData); instead, it again does not work and is the same as photo 1.
What is the correct way to fill advertisement data?


Thank you!