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, 

           I had similar issue,did you find the way to resolve the  500uA  after stack is initialize (advertising  not work yet) ?

  • Hi David!

    I can confirm, that Aryan's answer worked for me. I just changed #if 0 to #if 1

    # file port_cmsis_systick.c
    
    #if 1  // 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)

    This did its job for demo project.

    Also for this project I had to do few more things:

    1. As far as I used floating point calculations, I had to chnage my main.c module as follows:

    int main(void)
    {
        NVIC_SetPriority(FPU_IRQn, APP_IRQ_PRIORITY_LOW);
        NVIC_EnableIRQ(FPU_IRQn);
    
        /* application code */
        ...
    }
    
    #define FPU_EXCEPTION_MASK 0x0000009F
    
    void FPU_IRQHandler(void)
    {
        uint32_t *fpscr = (uint32_t *)(FPU->FPCAR+0x40);
        (void)__get_FPSCR();
    
        *fpscr = *fpscr & ~(FPU_EXCEPTION_MASK);
    }

    2. We use SAADC module for some measurements and I had to uninitialise it after usage like this after each usage:

    nrf_drv_saadc_uninit();
       
    NRF_SAADC->INTENCLR = (SAADC_INTENCLR_END_Clear << SAADC_INTENCLR_END_Pos);
    
    NVIC_ClearPendingIRQ(SAADC_IRQn);

    And now average power consumption is about 30uA.

    p.S. Sorry for late answer, so much work here...

  • Hi Elias,

    Just started with this board recently, still facing the 7mA issue. Are those the only changes you did? I still could not get it down to anywhere close to 30uA like yours. Thanks.

    Regards,

    Rahmat

  • Hi Rahmat,

    yes, make sure that UART and logging is switched off in your sdk_config.h and that you are not running your application with debugger.

    Maybe some more information about your application could help to point you.

    Cheers,

    Elias

Reply Children
Related