This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime

Hello,

 

I am using nRF52840, SDK_16.0.0, S140 SoftDevice and Segger 4.16 for flashing the image. I am using ‘ble_app_blinky’.

 

I have few queries on setting Tx power level. I am using sd_ble_gap_tx_power_set() to change power level.

 

1) In example code what will be the default Tx power level.

 

2) To increase Tx power level during Advertisement I am adding below code within advertising_init(). Is this fine.

 

              err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);

              APP_ERROR_CHECK(err_code);

   

              err_code = sd_ble_gap_tx_power_set( BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, 8); // Set to +8 dBm

              APP_ERROR_CHECK(err_code);

 

3) Similarly, I want to increase Tx power during Connection established. For this, where can I call sd_ble_gap_tx_power_set(). Whether as part of conn_params_init() after ble_conn_params_init() or under BLE_GAP_EVT_CONNECTED case of ble_evt_handler().

              sd_ble_gap_tx_power_set( BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, 8); // Set to 8 dBm

 

4) Once after disconnection we need Advertisement packets to be stared. Once again do we need to call sd_ble_gap_tx_power_set() as part of advertising_start() to set power level of Advertisement packet.

 

5) Need more inputs on below statement in ble_gap.h. Assume my Central / Initiator has 0 dBm and my Peripheral / Advertiser has 8 dBm. Once Connection request is received whether Peripheral Tx power will be changed from 8 dBm to 0 dBm.

    “When a connection is created it will inherit the transmit power from the initiator or advertiser leading to the connection. “

6) In Advertisement or Connection mode whether can I change Tx power level dynamically. Use case is, when my battery is getting depleted I want to reduce Tx power level so that I can maintain better battery life. advertising_init() is called only once. Whether can I call  sd_ble_gap_tx_power_set() as part of advertising_start().

 

Thanks & Regards

Vishnu Beema

Parents
  • Thank you for inputs. Please find my response & few more queries.

     

    1) In ble_app_proximity example, I am not able to find the Tx settings changes based on Connection handler.

    a) Based on point ‘5’, in Peripheral, once connection is established, it will inherit Tx settings used during Advertisement. But as part of point ‘2&3’ how to set different levels using connection handler.

    b) Once connection is established, based on algorithm in point ‘6’ whether can I call sd_ble_gap_tx_power_set() at any time.

    2) I am bit confused with point 4. Once Tx powered configured to 8 dBm. It will be inherited the same after connection established. Even after disconnect and re-start Advertisement, still it should inherit the same Tx during Advertisement. In that case still do we need to call sd_ble_gap_tx_power_set() as part of advertising_start().

     

    3) Without "Tx Power" Service 0x1804, whether can I use GAP 0x0A "Tx Power level" as part of Advertisement packet. Any difference between these two.

    Thanks & Regards

    Vishnu Beema

Reply
  • Thank you for inputs. Please find my response & few more queries.

     

    1) In ble_app_proximity example, I am not able to find the Tx settings changes based on Connection handler.

    a) Based on point ‘5’, in Peripheral, once connection is established, it will inherit Tx settings used during Advertisement. But as part of point ‘2&3’ how to set different levels using connection handler.

    b) Once connection is established, based on algorithm in point ‘6’ whether can I call sd_ble_gap_tx_power_set() at any time.

    2) I am bit confused with point 4. Once Tx powered configured to 8 dBm. It will be inherited the same after connection established. Even after disconnect and re-start Advertisement, still it should inherit the same Tx during Advertisement. In that case still do we need to call sd_ble_gap_tx_power_set() as part of advertising_start().

     

    3) Without "Tx Power" Service 0x1804, whether can I use GAP 0x0A "Tx Power level" as part of Advertisement packet. Any difference between these two.

    Thanks & Regards

    Vishnu Beema

Children
No Data
Related