Questions about portSUPPRESS_TICKS_AND_SLEEP()

kyle-shneider wrote on Monday, January 23, 2017:

It is written in the docs

The value of portSUPPRESS_TICKS_AND_SLEEP()'s single parameter equals the total number of tick periods before a task is due to be moved into the Ready state. The parameter value is therefore the time the microcontroller can safely remain in a deep sleep state, with the tick interrupt stopped (suppressed).

So, how is user able to control this parameter?
I’m working in IAR IDE with stm32l151 chip and using default implementation of portSUPPRESS_TICKS_AND_SLEEP. I set blinking of a led in Idle task (at every entrance turn on/off) and led blinking was pretty recognizable for a human eye. I’ve tried to always pass to portSUPPRESS_TICKS_AND_SLEEP 2000, 200, 20, 2 ticks (in my project 1 tick = 1 ms) from prvGetExpectedIdleTime but after that led stays active all the way.
Sorry for the noob question but in the docs it’s just far from obvious.

rtel wrote on Monday, January 23, 2017:

Sorry, I don’t follow what it is you are trying to do.
portSUPPRESS_TICKS_AND_SLEEP() is called by the kernel, and the time
passed into the function is calculated internally - it is not something
you set manually.

kyle-shneider wrote on Monday, January 23, 2017:

Thanks for the answer.
But how can i control the time for microcontroller sleep mode using default IAR portSUPPRESS_TICKS_AND_SLEEP implementation?

rtel wrote on Monday, January 23, 2017:

The time the system will sleep is set to be the next time the scheduler
knows a task needs to execute. If this is too short then sleep is not
entered at all (you can set the low limit time).

For example (assuming you have configUSE_TICKLESS_IDLE set to 1), if all
tasks are in the Blocked state, two are blocked indefinitely, one will
time out in 50 ticks, and one will time out in 20 ticks, then
portSUPPRESS_TICKS_AND_SLEEP() will be called (internally, by the RTOS)
with the expected idle time set to 20 as that is the time the scheduler
knows a task next needs to execute.