Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

configUSE_TICKLESS_IDLE

Posted by l4n4 on April 4, 2014

If we enable the configUSETICKLESSIDLE, it will go to 'idle' only when the xExpectedIdleTime >= 2. Do you think , it's worthwhile to call the __WFI (wait for interrupt) even if the xExpectedIdleTime is < 2 (in term of power saving)? I'm running a 180Mhz cortex M3.

if( xExpectedIdleTime >= configEXPECTEDIDLETIMEBEFORESLEEP ) { portSUPPRESSTICKSAND_SLEEP( xExpectedIdleTime ); } else{ __WFI(); //add wait for interrupt here }


configUSE_TICKLESS_IDLE

Posted by rtel on April 4, 2014

It may be that, in your particular application, you get some benefit from doing that, but if so I would not recommend changing the source code in that way but instead define an idle hook function that just calls wfi.

Regards.


configUSE_TICKLESS_IDLE

Posted by l4n4 on April 4, 2014

The idle hook will be called all the time and before portSUPPRESSTICKSANDSLEEP, so it will always sleep for 1 tick time first before do any further checks. This means : - if xExpectedIdleTime < 2 : this is ok - if xExpectedIdleTime == 2 : Idle hook will sleep for 1 tick and portSUPPRESSTICKSANDSLEEP will not be called. I would like the portSUPPRESSTICKSAND_SLEEP to be called in this condition. - xExpectedIdleTime > 2 : this is ok

Thanks!


configUSE_TICKLESS_IDLE

Posted by rtel on April 4, 2014

How about setting configEXPECTEDIDLETIMEBEFORESLEEP to 0 (may cause a compiler warning where the >= check is performed) then use the configPRESLEEPPROCESSING to check the expected idle time and if the expected idle time is below a threshold set by yourself it can just call wfi and cancel the tickless entry (the macros parameter can be used for cancelling the tickless entry).

Regards.


configUSE_TICKLESS_IDLE

Posted by mplmht on January 10, 2017

I have the same concern here but I would like to keep usage of configEXPECTEDIDLETIMEBEFORESLEEP functionnality which is interesting I beleive.

I would like to get your advice on following code change proposal: - when tickless idle feature is enabled, call to the idle hook when xExpectedIdleTime is below configEXPECTEDIDLETIMEBEFORESLEEP - when tickless idle feature is not enabled, keep calling the idle hook the same way as now.

The code change could look like below in portTASK_FUNCTION function of tasks.c (line 3177 of v9.0.0)?

#if ( configUSE_TICKLESS_IDLE == 0 )
    #if ( configUSE_IDLE_HOOK == 1 )
    {
        extern void vApplicationIdleHook( void );

        /* Call the user defined function from within the idle task.  This
        allows the application designer to add background functionality
        without the overhead of a separate task.
        NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
        CALL A FUNCTION THAT MIGHT BLOCK. */
        vApplicationIdleHook();
    }
    #endif /* ( configUSE_IDLE_HOOK == 1 ) */

/* This conditional compilation should use inequality to 0, not equality
to 1.  This is to ensure portSUPPRESS_TICKS_AND_SLEEP() is called when
user defined low power mode	implementations require
configUSE_TICKLESS_IDLE to be set to a value other than 1. */
#else /* configUSE_TICKLESS_IDLE != 0 */
{
TickType_t xExpectedIdleTime;

    /* It is not desirable to suspend then resume the scheduler on
    each iteration of the idle task.  Therefore, a preliminary
    test of the expected idle time is performed without the
    scheduler suspended.  The result here is not necessarily
    valid. */
    xExpectedIdleTime = prvGetExpectedIdleTime();

    if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
    {
        vTaskSuspendAll();
        {
            /* Now the scheduler is suspended, the expected idle
            time can be sampled again, and this time its value can
            be used. */
            configASSERT( xNextTaskUnblockTime >= xTickCount );
            xExpectedIdleTime = prvGetExpectedIdleTime();

            if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
            {
                traceLOW_POWER_IDLE_BEGIN();
                portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
                traceLOW_POWER_IDLE_END();
            }
            else
            {
                mtCOVERAGE_TEST_MARKER();
                #if ( configUSE_IDLE_HOOK == 1 )
                {
                    extern void vApplicationIdleHook( void );

                    /* Call the user defined function from within the idle task.  This
                    allows the application designer to add background functionality
                    without the overhead of a separate task.
                    NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
                    CALL A FUNCTION THAT MIGHT BLOCK. */
                    vApplicationIdleHook();
                }
                #endif /* configUSE_IDLE_HOOK */
            }
        }
        ( void ) xTaskResumeAll();
    }
    else
    {
        mtCOVERAGE_TEST_MARKER();
    }
}
#endif /* configUSE_TICKLESS_IDLE */

Regards.


configUSE_TICKLESS_IDLE

Posted by rtel on January 10, 2017

Hi - thanks for your input, although I doubt this would be adopted because it would change the existing behaviour, which could cause issues for users that update the version of FreeRTOS they are using in existing applications.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner