Quality RTOS & Embedded Software

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


How to control fall into SLEEP mode

Posted by mrazoun on October 25, 2016

Hi, sorry for beginner's questions. How is it possible to control falling into SLEEP mode ?

When I'm using the peripheral (for example UART) which is not working in SLEEP mode I have to inform somehow FreeRTOS that the task need uP in RUN. Now I made it through proper setting of constant configEXPECTEDIDLETIMEBEFORESLEEP and parameter "xTicksToWait" in function ulTaskNotifyTake(). After that it depends on condition "if( xExpectedIdleTime >= configEXPECTEDIDLETIMEBEFORESLEEP )" (function portTASK_FUNCTION() in task.c) if uP goes into SLEEP or not. Is it possible only by this way ?

My setup : EFM32GG (Cortex-M3), FreeRTOSLowPowerTickManagementBURTC.c, FreeRTOS V8.2.3, SLEEP = EM2 Thank's in advance. Zdenek

How to control fall into SLEEP mode

Posted by rtel on October 25, 2016

In FreeRTOSLowPowerTickManagementBURTC.c you will see a function called vPortSuppressTicksAndSleep() which handles the entry into and out of sleep mode.

In that function you will see a call to SLEEP_Sleep() - which if I recall correctly is a call into the SiLabs library, and the library function should not put the MCU into a sleep mode that is too low for the peripherals being used. So the first question is, did you use the SiLabs library functions to initialise the UART? If so, why does the sleep manager not know that it cannot go into a sleep mode lower than the minimum the UART can use?

Just above there you will see a macro called configPRESLEEPPROCESSING() being called. That allows you to insert any code you want, and if the code the macro executes decides you should not go into sleep mode then set its parameter (xModifiableIdleTime) to zero and you will not go into sleep mode. Note this is a macro, not a function, so in the macro's implementation you have to access the xModifiableIdleTime variable directly.

How to control fall into SLEEP mode

Posted by mrazoun on October 26, 2016

Thank's for your very heplfull message. Now I understood this and I will modify my source code according to your explanation.

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

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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner