Quality RTOS & Embedded Software

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




Loading

Questions about portSUPPRESS_TICKS_AND_SLEEP()

Posted by kyle-shneider on January 23, 2017

It is written in the docs

The value of portSUPPRESSTICKSAND_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 portSUPPRESSTICKSANDSLEEP. 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 portSUPPRESSTICKSANDSLEEP 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.


Questions about portSUPPRESS_TICKS_AND_SLEEP()

Posted by rtel on January 23, 2017

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


Questions about portSUPPRESS_TICKS_AND_SLEEP()

Posted by kyle-shneider on January 23, 2017

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


Questions about portSUPPRESS_TICKS_AND_SLEEP()

Posted by rtel on 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 configUSETICKLESSIDLE 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 portSUPPRESSTICKSAND_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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS