FreeRTOS Idle Task For Power Saving Mode
FreeRTOS Idle Task For Power Saving Mode
Saving Mode
Idle Task
• Idle task is automatically created when the
scheduler starts. When no tasks are available
for the CPU then this task will run.
• When a task is deleted, the memory used by it
will not be free immediately. This will be
done in the idle task.
• It is possible to perform a specific “Hook
Function” in the idle task.
• In Arduino the loop() function is hooked to
FreeRTOS Idle Task and will be called
whenever the scheduler runs its Idle Task.
ATMega328: Power Saving Mode
• It is common to use the idle hook function to
place the microcontroller CPU into a power
saving mode (sleeping modes).
• Sleep Modes allow the user to stop or turn off
the unused modules in the Microcontroller
which significantly reduce the power
consumption.
• There are six sleep modes in ATmega328P:
ATMega328: Power Saving Mode
• ATmega328P has a Brown-out Detector
(BOD) which monitors the supply voltage at
the time of sleep mode.
• An internal or external Arduino interrupts or
a Reset can wake up the Arduino from the
sleep mode.
• The MCU consumes about 10mA when
operated in Active mode at 5V supply and at
16MHz. When in the Power-down mode the
MCU consumes between 4μA and 8μA.
ATMega328: Power Saving Mode
• With FreeRTOS, we can enter a sleep power
mode in the idle task and wake up from the
sleep mode using scheduler ticks (watchdog
timer interrupts).
• We can adjust the length of time that the
Arduino MCU will sleep before being
awoken by the Watchdog Timer, by
configuring the setting in the
FreeRTOSVariant.h file contained within the
Arduino_FreeRTOS library.
Example
• Entering sleep mode example in idle task: