2022-08-30 12:18 PM
Hi,
is there any option to set different tx power level (aci_hal_set_tx_power_level) when device is connected and is still advertising in background? My goal is to set minimum tx power level for advertising and maximum for connection, when both states are working simultaneously.
Best,
Mateusz
2022-08-31 07:26 AM
Hello,
It's not possible to do this with the basic advertising, but you can use the additional beacon (see ACI_GAP_ADDITIONAL_BEACON_START command) or the extended advertising (see ACI_GAP_ADV_SET_CONFIGURATION command) which allow to set output power in parameter.
In order to have a different tx power level for advertising and for connection, once you are connected to your device, stop the advertising, change the tx power level using aci_hal_set_tx_power_level command and then restart advertising (additional or extended). If you didn't stop the advertising before to change the tx power level, the tx power level will change for advertising and for the connection.
Best Regards
2022-08-31 12:42 PM
@Remy ISSALYS thank You for answer.
How can I stop advertising? After successfully device connection, I cannot stop advertising - aci_gap_set_non_discoverable function returns 12 (I can't find any list of error values description). I'm not using sequencer, so I'm doing it in main program while(true) loop, not in SVCCTL_App_Notification.
Best,
Mateusz
2022-09-01 01:51 AM
Hello,
Which type of advertising are you using ? You can find the list of error codes value in STM32WB_BLE_Wireless_Interface.html file. The value 0x12 indicated Invalid HCI Command Parameters.
Best Regards
2022-09-01 02:18 AM
Hi!
Before device connection I'm using regular advertising (aci_gap_set_discoverable with aci_gap_update_adv_data).
//EDIT:
return value is 0xC (12 in decimal) - Command Disallowed.
2022-09-01 05:52 AM
Hi,
Are you sure your device still advertising once it's connected ? if you try to send the aci_gap_set_non_discoverable command before the connection, is it working ?
Best Regards
2022-09-01 06:32 AM
Good point - device automatically stops advertising after connection. How can I prevent this behavior? I set NumOfLinks in SHCI_C2_Ble_Init_Cmd_Packet_t to 2.
//EDIT:
ok, it is not so bad - if advertising stops always after connection_completed, it's ok - I can start new one. But I don't know if it's expected behavior...
Best
Mateusz
2022-09-02 02:53 AM
Hello,
If your code is based on STM32CubeWB example, the advertising is stopped after connection. So, in this case if you want to perform another connection, you should restart the advertising.
Best Regards
2022-09-02 06:04 AM
Hello,
In this case, my code is not based on any ST sample. The aci_gap_set_non_discoverable function is not called (I set breakpoint there to by 100% sure) - advertasing stops right after connection automatically.