[nRF Connect SDK](Urgent) How to fix Tx power?

Target nRF52832(nrf52dk_nrf52832)
SDK NCS v2.0.0
My project base: \nrf\samples\bluetooth\peripheral_hids_keyboard

Hello.
I want to increase Tx power for test. I already review sample(zephyr/samples/bluetooth/hci_pwr_ctrl) and I found it looks working in log.
I try to put changes into my project; however, it works at first time only.
I disconnect and connect again; I lose my pairing. I could connect again until BLE power off and on.
Can I fix my Tx power using CONFIX_XXX? Or how can fix it?

// main.c
static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl)
{
...
}

static void connected(struct bt_conn *conn, uint8_t err)
{
...
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN, default_conn_handle, 4);
}


Prj.conf
#Tx
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y


Parents
  • Hi,

    I am not sure I understand correctly, but is the problem that you are only able to set the Tx power for the first connection, but not subsequent ones? If so, my first thought is that you are using an invalid connection handle (for instance that you do not update it for subsequent connections). Could that be the case? If not, can you elaborate, explain what you have found by debugging (any error codes returned from bt_hci_cmd_send_sync() for instance?).

Reply
  • Hi,

    I am not sure I understand correctly, but is the problem that you are only able to set the Tx power for the first connection, but not subsequent ones? If so, my first thought is that you are using an invalid connection handle (for instance that you do not update it for subsequent connections). Could that be the case? If not, can you elaborate, explain what you have found by debugging (any error codes returned from bt_hci_cmd_send_sync() for instance?).

Children
Related