Zephyr - How to set BLE Adversting Tx Power (part 2)

Folllow-up questions for this thread https://devzone.nordicsemi.com/f/nordic-q-a/84769/zephyr---how-to-set-ble-adversting-tx-power

1.In the nRF SDK there are TX power defines ( in \mesh\bearer\include\radio_config.h)

typedef enum
{
#ifdef NRF52840_XXAA
RADIO_POWER_NRF_POS8DBM = 0x08,
RADIO_POWER_NRF_POS7DBM = 0x07,
RADIO_POWER_NRF_POS6DBM = 0x06,
RADIO_POWER_NRF_POS5DBM = 0x05,
#endif
RADIO_POWER_NRF_POS4DBM = 0x04,
#ifdef NRF52_SERIES
RADIO_POWER_NRF_POS3DBM = 0x03,
#endif
#ifdef NRF52840_XXAA
RADIO_POWER_NRF_POS2DBM = 0x02,
#endif
RADIO_POWER_NRF_0DBM = 0x00,
RADIO_POWER_NRF_NEG4DBM = 0xFC,
RADIO_POWER_NRF_NEG8DBM = 0xF8,
RADIO_POWER_NRF_NEG12DBM = 0xF4,
RADIO_POWER_NRF_NEG16DBM = 0xF0,
RADIO_POWER_NRF_NEG20DBM = 0xEC,
RADIO_POWER_NRF_NEG30DBM = 0xD8,
#ifdef NRF52_SERIES
RADIO_POWER_NRF_NEG40DBM = 0xD8
#endif
} radio_tx_power_t;

Does anything similar exist in the Zephyr environment?

2.What's the proper sequence to dynamically update the TX power? 

Does the command  

bt_hci_cmd_send_sync(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL..) API?
take effect on the running BT stack?
Is  bt_le_adv_stop  needed before calling bt_hci_cmd?
Is device reset needed ? I could not find an API to disable the stack i.e bt_disable 
Thanks
Andy
Thanks
Andy
Parents
  • Googled this. 

    Those are static configuration options

    What I need is a set of values that I can pass to the API to set the tx power dynamically

    Can I just pass the same values as in nrf radio_config.h ?
    What about the questions regarding dynamic setting of tx power?

    Is  a restart of the ble stack required? If so - what's the API?
    I do not see a bt_disable() API , only bt_enabled.

    Or just stopping advertising will do?

Reply
  • Googled this. 

    Those are static configuration options

    What I need is a set of values that I can pass to the API to set the tx power dynamically

    Can I just pass the same values as in nrf radio_config.h ?
    What about the questions regarding dynamic setting of tx power?

    Is  a restart of the ble stack required? If so - what's the API?
    I do not see a bt_disable() API , only bt_enabled.

    Or just stopping advertising will do?

Children
Related