This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Application with FreeRTOS - lowest possible current in idle.

I am about to start new quite complex project with nRF52 and I thought that maybe it is high time to use freeRTOS port from SDK.  As the device is going to be powered with a CR2032 battery I wanted to check how the current consumption looks like. There are some similar post on the Nordic DevZone so I have read them first. After that my impression was that there are some problems and the power consumption with FreeRTOS is not well optimized so it is not a good choice for battery devices. None of the posts I have read used SDK15 so I have decided to test it myself based on ble_app_hrs_freertos example.

If I understand correctly tickless idle should be the lowest power mode and there should be no extra interrupts needed normally by any RTOS. I have tried different freeRTOS configurations (for example using RTC instead of SysTick). I have also disabled nrf log module but I am not able to get the DC base under 780 uA. 

In nrf52832 product specification I can see that typical ultra-low power current consumption for System ON, Full RAM retention, Wake on any event is less than 2 uA and thats what I would expect in idle state for application running with FreeRTOS and tickless idle enabled. I know that I can easily achieve such low values without RTOS (I already do that in another project) but my question is what is the lowest possible value for current in tickless idle for application with FreeRTOS. Has anyone achieved values that are near to those from product specification? It should be possible to achieve 2 uA with tickless idle, isn't it? If someone knows the recipe for the success it is welcomed to share the FreeRTOS config :).

  • Hi,

    Not sure how you are calculating the base current.

    But can you do a simple idle test with the following change in SDK\external\freertos\portable\CMSIS\port_cmsis_systick.c file

    //#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)

    Notice that i have commented out now the #if 0 line. If you get better results, then i will remove them and check that in the SDK.

  • Dear @Aryan,

    I am using Rigol oscilloscope and uCurrent GOLD to measure the actual current consumption.

    I have done your simple test and the result looks really promising. On the range of 1mV/uA I do not see any DC base. To do tests on 1mV/nA I need to do some application adjustments cause there will be 10k resistor in series with battery. 

    Can you confirm me that what I should measure in idle state is something about 2-3 uA?

  • Hi guys i have tried the solution you have proposed with commenting out `#if 0` and the result is much worse on my custom nrf52832 board when advertising.

    ble_app_hrs_freertos:

     - Without modification:

        - with adv active: 850uA

        - after adv timeout: 8uA

     - With modification:

        - with adv active: 6mA

        - after adv timeout: 8uA

    ble_app_hrs:

        - with adv active: 525uA

        - after adv timeout: 8uA

    ble_app_hrs (sdk_14.2):

        - with adv active: 534uA

        - after adv timeout: 8uA

    my_custom_app (sdk_14.2):

        - with adv active: 84uA

        - without adv: 54uA

    I'm not sure why my custom app consumes only 84uA and ble_app_hrs more and why the implementation with RTOS consumes double the without.

  • I have investigated more i have found out that the solution by disabling NRF_LOG_ENABLED solved the current consumption issue. I was trying to find why log was consuming power by enabling NRF_LOG_ENABLED, set the NRF_LOG_DEFERRED to 0 and removing the m_logger_thread and it did decrease but then i got some HARDFAULT. I guess it was related by printing in the interrupt?

    Here are the results with the NRFFOSDK-11174 set to 1 and NRF_LOG_ENABLED 0:

    ble_app_hrs_freertos:
        - with adv active: 150uA
        - after adv timeout: 9uA

Related