how to reduce the power consumption in ble_app_uart?

We've started development on a project using ble_app_uart as its base. We're using the nRF52832, Segger Embedded Studio (version 5.42a), and nRF5 SDK version 17.0.2. Minimizing power consumption is a critical factor for us; currently, the board's average current consumption is 25mA during the advertisement state. Can you suggest methods to reduce power consumption in the ble_app_uart example code? We don't need to use UART, so are there ways to remove it from the code and, in doing so, reduce power consumption?

controller :- nrf52832 

ide :- seggar embedded studio (5.42a) 

sdk :- nrf5sdk 17.0.2 

Parents
    • Power Optimization Steps

      1. Remove UART (app_uart / UART driver)

      The ble_app_uart example initializes and runs UART continuously via the app_uart module. This keeps the UART peripheral active and contributes to a constant power drain.

      Actions:

      • Remove the call to app_uart_init(...) in main.c.

      • Delete or comment out:

        #include "app_uart.h"
        #include "nrf_uart.h"
        
      • Remove the uart_event_handle(...) function and related logic.

      • If you’re not using logs over RTT or UART, also disable NRF_LOG.

      2. Disable Unused Peripherals

      Peripherals like SPI, TWI, ADC, etc., if initialized but not used, can increase power consumption.

      Checklist:

      • Review all nrf_drv_*_init() and nrfx_*_init() calls.

      • Open sdk_config.h and disable unused modules by setting:

        #define UART_ENABLED 0
        #define APP_UART_ENABLED 0
        #define NRF_LOG_ENABLED 0
        #define NRFX_UART_ENABLED 0
        #define NRFX_UARTE_ENABLED 0
        #define BSP_BTN_BLE_ENABLED 0
        

      3. Optimize Advertising Interval

      Adjust the advertising interval to a larger value for lower power. In main.c:

      #define APP_ADV_INTERVAL 1600  // 1000 ms = 1600 * 0.625 ms
      

      Pass this value to the advertising module using ble_advertising_init().

      Nordic recommends 1000–2000 ms for ultra-low-power advertising.

      4. Ensure Sleep Mode is Entered Properly

      Between BLE events, the CPU should enter sleep (WFE).

      Your main loop should look like:

      while (true)
      {
          idle_state_handle();
      }
      

      And idle_state_handle() should call:

      void idle_state_handle(void)
      {
          if (NRF_LOG_PROCESS() == false)
          {
              nrf_pwr_mgmt_run(); // internally calls __WFE()
          }
      }
      

      Confirm nrf_pwr_mgmt_init() is called during initialization.

      5. Enable the On-Chip DC-DC Regulator

      If your hardware has the required external components (inductor), enable the DC/DC converter:

      NRF_POWER->DCDCEN = 1;
      

      To change output voltage, modify the UICR register (run once):

      NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
      NRF_UICR->REGOUT0 = (UICR_REGOUT0_VOUT_1V8 << UICR_REGOUT0_VOUT_Pos);
      NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
      NVIC_SystemReset(); // Reset to apply changes
      

      6. Verify LFCLK Configuration

      Ensure that nrf_drv_clock_init() is called before using SoftDevice or nrf_pwr_mgmt_run().

      The 32.768 kHz LFCLK is essential for BLE and accurate RTC timing while sleeping.

      Expected Power Consumption (nRF52832 + SoftDevice S132)

      Configuration Avg. Current Draw
      UART + Logs + 100ms Adv Interval 1–10 mA
      UART removed + 1s Adv Interval 20–50 µA
      Sleep mode (no advertising) 2–3 µA

      Conclusion

      With UART disabled, peripherals shut down, advertising optimized, and proper sleep configuration, the power consumption of the ble_app_uart example can be brought down from ~25 mA to under 50 µA.

    Reply
      • Power Optimization Steps

        1. Remove UART (app_uart / UART driver)

        The ble_app_uart example initializes and runs UART continuously via the app_uart module. This keeps the UART peripheral active and contributes to a constant power drain.

        Actions:

        • Remove the call to app_uart_init(...) in main.c.

        • Delete or comment out:

          #include "app_uart.h"
          #include "nrf_uart.h"
          
        • Remove the uart_event_handle(...) function and related logic.

        • If you’re not using logs over RTT or UART, also disable NRF_LOG.

        2. Disable Unused Peripherals

        Peripherals like SPI, TWI, ADC, etc., if initialized but not used, can increase power consumption.

        Checklist:

        • Review all nrf_drv_*_init() and nrfx_*_init() calls.

        • Open sdk_config.h and disable unused modules by setting:

          #define UART_ENABLED 0
          #define APP_UART_ENABLED 0
          #define NRF_LOG_ENABLED 0
          #define NRFX_UART_ENABLED 0
          #define NRFX_UARTE_ENABLED 0
          #define BSP_BTN_BLE_ENABLED 0
          

        3. Optimize Advertising Interval

        Adjust the advertising interval to a larger value for lower power. In main.c:

        #define APP_ADV_INTERVAL 1600  // 1000 ms = 1600 * 0.625 ms
        

        Pass this value to the advertising module using ble_advertising_init().

        Nordic recommends 1000–2000 ms for ultra-low-power advertising.

        4. Ensure Sleep Mode is Entered Properly

        Between BLE events, the CPU should enter sleep (WFE).

        Your main loop should look like:

        while (true)
        {
            idle_state_handle();
        }
        

        And idle_state_handle() should call:

        void idle_state_handle(void)
        {
            if (NRF_LOG_PROCESS() == false)
            {
                nrf_pwr_mgmt_run(); // internally calls __WFE()
            }
        }
        

        Confirm nrf_pwr_mgmt_init() is called during initialization.

        5. Enable the On-Chip DC-DC Regulator

        If your hardware has the required external components (inductor), enable the DC/DC converter:

        NRF_POWER->DCDCEN = 1;
        

        To change output voltage, modify the UICR register (run once):

        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
        NRF_UICR->REGOUT0 = (UICR_REGOUT0_VOUT_1V8 << UICR_REGOUT0_VOUT_Pos);
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
        NVIC_SystemReset(); // Reset to apply changes
        

        6. Verify LFCLK Configuration

        Ensure that nrf_drv_clock_init() is called before using SoftDevice or nrf_pwr_mgmt_run().

        The 32.768 kHz LFCLK is essential for BLE and accurate RTC timing while sleeping.

        Expected Power Consumption (nRF52832 + SoftDevice S132)

        Configuration Avg. Current Draw
        UART + Logs + 100ms Adv Interval 1–10 mA
        UART removed + 1s Adv Interval 20–50 µA
        Sleep mode (no advertising) 2–3 µA

        Conclusion

        With UART disabled, peripherals shut down, advertising optimized, and proper sleep configuration, the power consumption of the ble_app_uart example can be brought down from ~25 mA to under 50 µA.

      Children
      No Data
      Related