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

How to set TX power in ADV and Scanning mode

I am using "ble_app_hrs_rscs_relay" example. I am not able to set the TX power of advertising and scanning both. Currently the avg current is too high. 

I also tried using this function

err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV ,m_advertising.adv_handle, -20);

but no difference, I have the following questions related to this issue

1) What am I doing wrong here? Is there any parameter I am not parsing correctly?

According to the data sheet the current should not be greater then 7.5mA at TX +4dBm output power.

2) While using power profiler does it also include the LCD current consumption for NRF52DK (PCA10040), how ever I have turn off all the leds in the code?

3) Can I also set the TX or RX power while scanning. I know there is a scanning gap role (BLE_GAP_TX_POWER_ROLE_SCAN_INIT). Please explain by example.

enum BLE_GAP_TX_POWER_ROLES
{
BLE_GAP_TX_POWER_ROLE_ADV = 1, /**< Advertiser role. */
BLE_GAP_TX_POWER_ROLE_SCAN_INIT = 2, /**< Scanner and initiator role. */
BLE_GAP_TX_POWER_ROLE_CONN = 3, /**< Connection role. */
};

4) Can you explain what is the param handle in this function may be I have a wrong understanding of it

sd_ble_gap_tx_power_set(uint8_t role, uint16_t handle, int8_t tx_power)

Parents
  • Hi,

    It doesn't look like the TX power changed based on the power profiler plot. Current peaks are close to what you can expect with 0 dBm and LDO regulator. You can play around with the Online power profiler here to see what the expected consumption is with different configurations: https://devzone.nordicsemi.com/nordic/power/ 

    1. I'm not sure why the power settings are not being applied. Please try to add the code below after advertising init and see if you get the same result.

        err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0 /* Handle is always 0 with current Softdevices */, -20);
        APP_ERROR_CHECK(err_code);
        err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, 0, -20);
        APP_ERROR_CHECK(err_code);
    

    2. It's only measuring the VDD current going into the nRF51. LEDs and other external circuitries are excluded.

    3. See the code snippet in point 1 above.

Reply
  • Hi,

    It doesn't look like the TX power changed based on the power profiler plot. Current peaks are close to what you can expect with 0 dBm and LDO regulator. You can play around with the Online power profiler here to see what the expected consumption is with different configurations: https://devzone.nordicsemi.com/nordic/power/ 

    1. I'm not sure why the power settings are not being applied. Please try to add the code below after advertising init and see if you get the same result.

        err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0 /* Handle is always 0 with current Softdevices */, -20);
        APP_ERROR_CHECK(err_code);
        err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, 0, -20);
        APP_ERROR_CHECK(err_code);
    

    2. It's only measuring the VDD current going into the nRF51. LEDs and other external circuitries are excluded.

    3. See the code snippet in point 1 above.

Children
  • Hi,

    Now I am able to reduce the TX power, now ever I am seeing spikes of current consumption going up to max 14.262 mA. Can you tell what are they? I am suspecting this might be scanning for scan request at this stage. See the below image.

      

    Below is the previous reading before reducing TX power:

    but still there is no effect on the current consumption while scanning after using this function

    err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_SCAN_INIT, 0, -20);
    APP_ERROR_CHECK(err_code);

    Do I have to put this function before starting scanning?

    Regards,

    Salman

  • Hi Salman,

    Salman said:
    Now I am able to reduce the TX power, now ever I am seeing spikes of current consumption going up to max 14.262 mA. Can you tell what are they? I am suspecting this might be scanning for scan request at this stage.

     Yes, this is the RADIO in RX mode. It is not affected by the TX power setting.

    Salman said:
    but still there is no effect on the current consumption while scanning after using this function

     The RADIO is in RX when scanning. The -20 dBm will be used when sending out scan requests or initiating new connections. 

    Regards,

    Vidar

Related