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

FreeRTOS Tick time modification

I need to minimize current consumption when using FreeRTOS. I have merged freertos with the ble_app_uart example using SDK 15.3.0. I am getting the average current as 9.162 uA when FreeRTOS is configured with NRF_LOG_ENABLED set to 0. The FreeRTOS ticks I guess approx. at 1 sec. I want to reduce this 1 sec time to msec so what changes I need to do? I am testing on nrf5283 development board. I have attached two images: image uart_freertos_4.png showing time between the ticks which I want to change, and uart_freertos_3.png giving the average current consumption which I want to reduce it as close a s 2-3 uA.

Parents Reply Children
  • Hi @sara, 

    I was banging my head for several weeks on a similar phenomena (in SDK 14.2)

    Apparently, there is a shortcoming in freeRTOS power optimization.

    See this post for details and workaround.

    I Hope this helps.

    Good luck.

  • Thanks for your sharing.

    I am still confused by a question.

    When you open the log log task will be created and vApplicationIdleHook() will run and it's electric currents is 6ma.

    Here is the setting

    #define configUSE_IDLE_HOOK 1
    #define NRF_LOG_ENABLED 1


    #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)
    {
    /* No SD - we would just block interrupts globally.
    * BASEPRI cannot be used for that because it would prevent WFE from wake up.
    */
    do{
    __WFE();
    } while (0 == (NVIC->ISPR[0] | NVIC->ISPR[1]));
    }
    }

    void main(void)
    {
    log_init();
    clock_init();
    #if NRF_LOG_ENABLED
    // Start execution.
    if (pdPASS != xTaskCreate(logger_thread, "LOGGER", 256, NULL, 1, &m_logger_thread))
    {
    APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
    }
    #endif
    // Activate deep sleep mode.
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    ble_stack_init();
    gap_params_init();
    gatt_init();
    advertising_init();
    services_init();
    conn_params_init();
    nrf_sdh_freertos_init(NULL, NULL);
    // advertising_start();
    LogD("ble_init_ok\r\n");
    // Start FreeRTOS scheduler.
    vTaskStartScheduler();
    for (;;)
    {
    APP_ERROR_HANDLER(NRF_ERROR_FORBIDDEN);
    }

    }

Related