Hi, I am trying to figure out is the FreeRTOS support DeepSleepMode or LowPower mode ? if no,Is there any way to hooke the OS to lowpower or sleep mode? Any piece of code example will be appreciated. Thanks,
The way it is often done is by defining an idle task (executed when nothing else is ready to execute) which puts the processor in whatever sleep mode you want.
The easy way to hook into idle task without having to modify FreeRTOS code is to use void vApplicationIdleHook( void ) function to do the job putting processor in sleep mode. To use it you have to include #define configUSE_IDLE_HOOK 1 in your FreeRTOSConfig.h file.
Thanks for quick answer. In that case when I call vApplicationIdleHook( void ) what makes the processors to wake up again? I guess that in case of idle task, interrupt will wakeup the system. Also is there any watchdog timer for each task ? Thanks
Almost all CPUs are woken up from sleep mode by interrupt. So the same applies to FreeRTOS. When CPU will be woken up by interrupt, interrupt service routine will wake up any task waiting for data provided by this ISR. CPU will be active until all pending tasks will be executed and then idle task will be executed. This in turn will call vApplicationIdleHook( void ) putting CPU back into sleep mode. Please note that FreeRTOS uses tick timer interrupt to run preemptive scheduler. This interrupt occurs (usually) every 1ms. So CPU will be woken up every 1ms, any pending task will be executed and then idle task will be called to put CPU back to sleep. Regarding watchdog timer question there is no such timer for each task. You have to implement it yourself if you really need it. Hope that helps, Adam
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.