cancel
Showing results for 
Search instead for 
Did you mean: 

Problem trying to remove TX power level AD type from advertising (BLE)

pzt
Associate II

When starting connectable undirected advertising mode by calling "aci_gap_set_discoverable(...)" it turns out that the advertiser sends AD with "Flags" type (0x01) and "TX power level" type (0x0A). As a restriction of the application, I need to remove the "TX power level" AD. From CSS v9 Table 1.1, this data type is optional. So, I've tried to delete this AD type calling "aci_gap_delete_ad_type(0x0A)" after "aci_gap_set_discoverable(...)".

The problem is that sometimes, although the function to start advertising ends with success code, the function to delete AD type returns the error = BLE_STATUS_NOT_ALLOWED (0x46), and that prevents the BLE controller to start the advertising mode.

Is there a way to start advertising only with AD type "Flags", without calling "aci_gap_delete_ad_type(0x0A)"?

Currently I'm using STM32WB v1.11.1 package, but I already tried with v1.9.0 too.

1 ACCEPTED SOLUTION

Accepted Solutions
pzt
Associate II

For now, 1 out of 4 (or 5) attempts the device fails to start scanning or advertising when one of this actions is already on action. I noticed this during the of unrealiable connections (forcing the connection and disconnection of a device every 5 seconds).

If you want to scan and advertise simultaneously, you can implement one of the solutions below:

1. You need to retrieve the return values of every "aci_gap" and, if it fails, you can set a one shot timer to retry the action after timeout;

2. Or you can implement time division multiplexing for advertising and scanning, e.g. 10 seconds for advertising followed by 10 seconds for scanning, and so on.

View solution in original post

2 REPLIES 2
pzt
Associate II

It can be replicated with "BLE_p2pRouteur" BLE application, but not with "BLE_p2pServer" apparently. It seems a time constraint on BLE controller when device has simultaneously central and peripheral GAP role.

pzt
Associate II

For now, 1 out of 4 (or 5) attempts the device fails to start scanning or advertising when one of this actions is already on action. I noticed this during the of unrealiable connections (forcing the connection and disconnection of a device every 5 seconds).

If you want to scan and advertise simultaneously, you can implement one of the solutions below:

1. You need to retrieve the return values of every "aci_gap" and, if it fails, you can set a one shot timer to retry the action after timeout;

2. Or you can implement time division multiplexing for advertising and scanning, e.g. 10 seconds for advertising followed by 10 seconds for scanning, and so on.