How to control fall into SLEEP mode

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

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

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