2022-07-14 11:54 AM
Hi, I'm trying to use FreeRTOS Tickless idle mode. When I am debugging my code (using breakpoints), I see that the code enters vPortSuppressTicksAndSleep function.
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can set its parameter to 0 to indicate that its implementation contains its own wait for interrupt or wait for event instruction, and so wfi should not be executed again. However, the original expected idle time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 )
{
__asm volatile( "dsb" ::: "memory" );
__asm volatile( "wfi" );
__asm volatile( "isb" );
}
configPOST_SLEEP_PROCESSING( xExpectedIdleTime );
I also see that xExpectedIdleTime has a valid value. But after configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); xModifiableIdleTime becomes 0 and it doesn't enter if( xModifiableIdleTime > 0 ) condition. Also the comment above mentioning "configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again." is confusing me.
Can someone shed some light on this?