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.