Hello, I have a problem on getting the dynamic tx power to work properly on the BL5340 using the hci_pwr_ctrl. I tried the example, it build and flash correctly, no error being thrown out. The dynamic transmit power worked flawlessly I can see the step change that reflect on the RSSI. However, during connection, I have the code to sweep through the TX power, however, the RSSI does not reflect the change with going from -20 dBM to 20 dBm, RSSI remained the same at around -40 dBm at 1m distance.
Below is the modified code with tx power sweep
void modulate_tx_power(void *p1, void *p2, void *p3)
{
int8_t txp_get = 0;
uint8_t idx = 0;
while (1) {
if (!default_conn) {
printk("Set Tx power level to %d\n", txpower[idx]);
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
0, txpower[idx]);
k_sleep(K_SECONDS(5));
printk("Get Tx power level -> ");
get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
0, &txp_get);
printk("TXP = %d\n", txp_get);
idx = (idx+1) % DEVICE_BEACON_TXPOWER_NUM;
} else {
int8_t rssi = 0xFF;
for(int8_t i = -20;i<=20;i++){
read_conn_rssi(default_conn_handle, &rssi);
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,default_conn_handle, i);
printk("Connected (%d) - RSSI = %d\n",
default_conn_handle, rssi);
k_sleep(K_SECONDS(1));
}
}
}
}