I am trying to use the tickless low power feature of FreeRtos in my application.
I noticed that portSUPPRESS_TICKS_AND_SLEEP never get called, the only way to make it work is disabling the only task that i have in my test application. This is very weird because the test task that i have only does this:
I disabled all the interrupts that puts some data into this queue, so it would block indefinitely, leaving the system in IDLE state, i am using the IdleHook callback to make sure it is locked in this state, but still the portSUPPRESS_TICKS_AND_SLEEP doesnt get called. This is VERY frustrating.
configUSE_TICKLESS_IDLE is 2
configEXPECTED_IDLE_TIME_BEFORE_SLEEP is 200
INCLUDE_vTaskSuspend is 1
I really cant figure out what is happening, Could you guys help me?
Tried different values. Still not working. xExpectedIdleTime is always 0 when my test tasking is running which is why portSUPPRESS_TICKS_AND_SLEEP never get called. This two conditions are true in most times:
else if( uxHigherPriorityReadyTasks != pdFALSE )
{
/* There are tasks in the Ready state that have a priority above the
idle priority. This path can only be reached if
configUSE_PREEMPTION is 0. */
xReturn = 0;
}
I also modified my test task like this and still didnt work:
It is acting like even with vTaskDelayUntil or xQueueReceive blocking my task, it always counts as a Ready state. Cant figure out why this is happening.
Update: Now there is something even more weird, i switched from FreeRtos v9 to FreeRtos v8.1 and it worked with the same application source code. I only got only one warning during the build related to cast in task.c.
This is on an MSP430F - did you provide your own implementation of the tickless idle feature? Which compiler are you using? If IAR then you should be able to use their StateViewer plug-in to see which task the system thinks is running.
Yes, i made my own implementation, but the problem was that the portSUPPRESS_TICKS_AND_SLEEP never get called. With some debugging i discovered that was because there was always at least one task in ready state which was not true since my only task was blocked due to vTaskDelayUntil.
Then I switched to FreeRtos 8.1 and the problem was gone.
Are you using software timers? If so, then the change history for V8.2 could have explained it perhaps, but I’m not sure about 8.1: http://www.freertos.org/History.txt
I am not using software timers. I just ported the freertos v9 to msp430fr4133 and made a simple tasks (that sleeps/blocks most of the time), but no matter what i do, all tasks always stays in ready status and then i couldnt make the tickless feature work.
I moved to freertos v8,1 and everything worked, but i get some warnings during the compilation.
I believe that is a problem with my enviroment and compiler, because there is a example code on freertos v9 with the msp430fr5 series that is very similar with my current msp430.
It always returns 0 because of this condition inside the prvGetExpectedIdleTime() function:
else if( uxHigherPriorityReadyTasks != pdFALSE )
{
/* There are tasks in the Ready state that have a priority above the
idle priority. This path can only be reached if
configUSE_PREEMPTION is 0. */
xReturn = 0;
}