FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2014 Threads] configUSE_TICKLESS_IDLEPosted 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_IDLEPosted 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_IDLEPosted 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_IDLEPosted 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_IDLEPosted 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_IDLEPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|