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

Tx Power using SoftDevices S140 nrf52840

Hi,

I am using SD calls to start an advertisement of BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED :

          sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);

The call to set TX power:

err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV ,  m_adv_handle, POS_08dBm);

m_adv_handle is BLE_GAP_ADV_SET_HANDLE_NOT_SET,

It seems that tx power is set not.

Questions:

1.  how to create a valid handle of m_adv_handle for the call through S140 SD?

2. If NULL handle, can be used, how to set tx power correctly?

Thank You,

David Zhou

Parents
  • That looks like the correct API usage to me. 

    "It seems that tx power is set not."
    How do you know? Can you share any measurements with us?


  • Hi Haakonsh,

    My program is based on

         ..\nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_beacon

    and using softDevice call to Advertise:

        err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);

    The call to set  TX POWER  with BLE_GAP_TX_POWER_ROLE_SCAN_INIT

       err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, BLE_CONN_HANDLE_INVALID, -20 ); 

      doesn't change the TX power for Advertising ( it is easily testable, e.g. using Android phone, it always reports the same RSSI from the unit, no matter what setting of the tx_power ( int the above case, it is -20).

     ( I also tested with Proximity example, which is BLE API based, change tx power with BLE_GAP_TX_POWER_ROLE_ADV, will change the rssi from -50dBm to -100dBm, with 8 and -40 tx power settings respectively.)

    But if the call set  TX POWER  with BLE_GAP_TX_POWER_ROLE_ADV  

      err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, BLE_CONN_HANDLE_INVALID, -20 ); 

    The program generates run-time error with error code :  12292

    Thank You

    David

  • Have you tried calling sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, BLE_CONN_HANDLE_INVALID, -20 )  before you start advertiments? 

  • I did. The call sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, BLE_CONN_HANDLE_INVALID, -20 ), is before start advertisements.

    It generates 12292 run-time error.

    David

Reply Children
Related