Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

BLE TX Power Configuration During Connection and in Bootloader + Power Optimization

Current Setup

I'm currently setting TX power during advertising using the following code:

err_code = ble_advertising_init(&m_advertising, &init);
APP_ERROR_CHECK(err_code);
ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);

// Set low TX power for better battery life
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 
                                   m_advertising.adv_handle, 
                                   RADIO_TXPOWER_TXPOWER_0dBm);
APP_ERROR_CHECK(err_code);


This successfully sets TX power during advertising, but I need help with additional scenarios.

Questions

1. Setting TX Power During Connection Mode

How do I change the TX power once the device is in a connected state? I assume I need to use BLE_GAP_TX_POWER_ROLE_CONN instead of BLE_GAP_TX_POWER_ROLE_ADV, but I'm unsure about:

  • When to call this (which event?)
  • What handle to use for the connection
  • Sample code would be appreciated

2. Setting TX Power in Bootloader

How can I configure lower TX power in the bootloader (DFU mode) for better battery life during firmware updates?

  • Where in the bootloader code should this be configured?
  • Are there any specific considerations for DFU reliability?

3. Bootloader Power Consumption Optimization

I want to minimize power consumption in the bootloader. What settings would you recommend?

I'm considering:

  • Increasing advertising interval to maximum
  • Increasing connection interval to maximum

Question: Will maxing out advertising and connection intervals cause DFU failures or significantly increase update time?

Environment

  • SDK Version: nrf5sdk latest version
  • SoC: nrf52811 on actual device / nrf52840 on dk

Any guidance, code examples, or documentation references would be greatly appreciated!


Additional Context

The goal is to maximize battery life while maintaining reliable BLE connectivity and DFU capability. Any other power optimization tips for both application and bootloader would be welcome.

  • Hi

    1. To set the radio TX power in a connection, use the sd_ble_gap_tx_power_set() function with the BLE_GAP_TX_POWER_ROLE_CONN handle. As long as the device is connected when called, there shouldn't be any specific rules on when to call it or not.

    /**@brief Set the radio's transmit power.
     *
     * @param[in] role The role to set the transmit power for, see @ref BLE_GAP_TX_POWER_ROLES for
     *                 possible roles.
     * @param[in] handle   The handle parameter is interpreted depending on role:
     *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_CONN, this value is the specific connection handle.
     *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_ADV, the advertising set identified with the advertising handle,
     *                       will use the specified transmit power, and include it in the advertising packet headers if
     *                       @ref ble_gap_adv_properties_t::include_tx_power set.
     *                     - For all other roles handle is ignored.
     * @param[in] tx_power Radio transmit power in dBm (see note for accepted values).
     *
     * @note Supported tx_power values: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +3dBm and +4dBm.
      *       In addition, on some chips following values are supported: +2dBm, +5dBm, +6dBm, +7dBm and +8dBm.
     *       Setting these values on a chip that does not support them will result in undefined behaviour.
      * @note The initiator will have the same transmit power as the scanner.
     * @note When a connection is created it will inherit the transmit power from the initiator or
     *       advertiser leading to the connection.
     *
     * @retval ::NRF_SUCCESS Successfully changed the transmit power.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
     * @retval ::BLE_ERROR_INVALID_ADV_HANDLE Advertising handle not found.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
     */
    SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(uint8_t role, uint16_t handle, int8_t tx_power));
    

    2. If you do DFU over Bluetooth LE, you set the TX power with the sd_ble_gap_tx_power_set() function as well. If you set it when it is set to advertise it should also keep that TX power when connected. 

    3. Increasing the connection intervals will likely increase the update time as well, as that would make the connection itself be slower. All in all I don't think the advertising and connection interval will be important factors here. Why exactly are you so worried about the power consumption during DFU? I'd recommend playing around with the Online Power Profiler for BLE to get some estimates on what you can expect with different settings. In general I'd say that the quicker the DFU is completed, the more power is saved, as that will lower the uptime altogether. 

    Best regards,

    Simon

Related