Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists