Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

High power consumption of softdevice

Hello!

I am working on firmware for device that has freertos in the base and implements BLE beacon and 1 service with 7 characteristics. Everything works. But power consumption is too high.

After plenty of tests on final HW, I've created playground based on ble_app_hrs_freertos_pca10040_s132 sample project and switched to sparkfun board.

When have just FreeRTOS with no user-defined tasks, consumption is about 1uA.

After I call  ble_stack_init with code below, I got about 500uA. It is without advertising at all.

static void ble_stack_init(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}

When beacon is enabled I have cca 650uA.

When GATT and beacon are working I have cca 750uA.

I measure with multimeter.

Results seems fine for me except for those 500uA after stack is initialized. Why is it so high? What can I do to lower it?

  • SDK v 15.0
  • NRF_LOG_ENABLED is 0
  • Using RELEASE configuration.
  • Tried S132 and S140 - result is the same
Parents
  • Hi Elias, 

    What are the clock configurations you are using? When you enable the softdevice, it will start RTC0 as a house keeping timer. This needs LFCLK.

  • Hi Aryan,

    I use defaults from ble_app_hrs_freertos_pca10040_s132 example.

    // <e> NRFX_RTC_ENABLED - nrfx_rtc - RTC peripheral driver
    //==========================================================
    #ifndef NRFX_RTC_ENABLED
    #define NRFX_RTC_ENABLED 0
    #endif
    // <q> NRFX_RTC0_ENABLED  - Enable RTC0 instance
     
    
    #ifndef NRFX_RTC0_ENABLED
    #define NRFX_RTC0_ENABLED 0
    #endif
    
    // <q> NRFX_RTC1_ENABLED  - Enable RTC1 instance
     
    
    #ifndef NRFX_RTC1_ENABLED
    #define NRFX_RTC1_ENABLED 0
    #endif
    
    // <q> NRFX_RTC2_ENABLED  - Enable RTC2 instance
     
    
    #ifndef NRFX_RTC2_ENABLED
    #define NRFX_RTC2_ENABLED 0
    #endif
    
    // <o> NRFX_RTC_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt 
    #ifndef NRFX_RTC_MAXIMUM_LATENCY_US
    #define NRFX_RTC_MAXIMUM_LATENCY_US 2000
    #endif
    
    // <o> NRFX_RTC_DEFAULT_CONFIG_FREQUENCY - Frequency  <16-32768> 
    
    
    #ifndef NRFX_RTC_DEFAULT_CONFIG_FREQUENCY
    #define NRFX_RTC_DEFAULT_CONFIG_FREQUENCY 32768
    #endif
    
    // <q> NRFX_RTC_DEFAULT_CONFIG_RELIABLE  - Ensures safe compare event triggering
     
    
    #ifndef NRFX_RTC_DEFAULT_CONFIG_RELIABLE
    #define NRFX_RTC_DEFAULT_CONFIG_RELIABLE 0
    #endif
    
    // <o> NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // <e> NRFX_RTC_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef NRFX_RTC_CONFIG_LOG_ENABLED
    #define NRFX_RTC_CONFIG_LOG_ENABLED 0
    #endif
    // <o> NRFX_RTC_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRFX_RTC_CONFIG_LOG_LEVEL
    #define NRFX_RTC_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> NRFX_RTC_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_RTC_CONFIG_INFO_COLOR
    #define NRFX_RTC_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> NRFX_RTC_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef NRFX_RTC_CONFIG_DEBUG_COLOR
    #define NRFX_RTC_CONFIG_DEBUG_COLOR 0
    #endif

    Anything else I can provide?

  • ah., good observation, I did not realize that hrs example with and without freertos are behaving differently at ble_stack_init power consumption wise. I can reproduce this now. I will try to find why this is happening. Will get back to you soon. Until then you can go ahead in your project development and we can come to some workaround for this when i have an answer

  • Thank you very much, Aryan! Looking forward for solution. If I will have some new information regarding issue, I will also let you know.

  • I think i found the problem.

    It is in port_cmsis_systick.c

    #if 0  // With FreeRTOS sd_app_evt_wait increases power consumption with FreeRTOS compared to _WFE (NRFFOSDK-11174)
    #ifdef SOFTDEVICE_PRESENT
                if (nrf_sdh_is_enabled())
                {
                    uint32_t err_code = sd_app_evt_wait();
                    APP_ERROR_CHECK(err_code);
                }
                else
    #endif
    #endif // (NRFFOSDK-11174)

    I do not remember the exact way i came to a conclusion that sd_app_evt_wait was consuming more power with freertos. Hence I created an internal ticket NRFFOSDK-11174 to investigate why this happened. I remembered that i was reading more power with freertos and using sd_wait function. While using WFI it was less. This technically did not make sense, but i decided to comment out sd_app_evt_wait function until i get more results. But I am not able to reproduce this anymore. So i think this comment is the problem on SDK 15.

    Please change line 231 in port_cmsis_systick.c to below

    #ifdef SOFTDEVICE_PRESENT
                if (nrf_sdh_is_enabled())
                {
                    uint32_t err_code = sd_app_evt_wait();
                    APP_ERROR_CHECK(err_code);
                }
                else
    #endif
    

    I will try to push these changes to official SDK for the next release.

  • I tried this actualy...

    If I use  sd_app_evt_wait(), then average consumption is about 7mA (without DCDC) and 5mA (with DCDC enabled).

    Something is definitely wrong there.

Reply Children
Related