Power-Saving Mode
The RTL8721Dx has an advanced Power Management Controller (PMC), which can flexibly power up different power domains of the chip, to achieve the best balance between chip performance and power consumption. AON, SYSON, SOC are three main power domains in digital system. Functions in different power domains will be turned off differently in different power-saving modes.
Power domains and wakeup sources
To simplify the power management for typical scenarios, the RTL8721Dx supports two low-power modes, which are sleep mode and deep-sleep mode. Tickless is a FreeRTOS low power feature, which just gates the CPU (no clock or power be turned off) when it has nothing to do. Sleep mode flow and deep-sleep mode flow are based on Tickless. The following table explains power-saving related terms.
Mode |
AON domain |
SYSON domain |
SOC domain |
Description |
---|---|---|---|---|
Tickless |
ON |
ON |
ON |
|
Sleep |
ON |
ON |
Clock-gated or power-gated |
|
Deep-sleep |
ON |
OFF |
OFF |
|
The FreeRTOS supports a low-power feature called tickless. It is implemented in an idle task which has the lowest priority. That is, it is invoked when there is no other task under running. Note that unlike the original FreeRTOS, the RTL8721Dx does not wake up based on the xEpectedIdleTime.
FreeRTOS tickless in an idle task
The figure above shows idle task code flow. In idle task, it will check sleep conditions (wakelock, sysactive_time, details in Section Wakelock APIs and pmu_set_sysactive_time) to determine whether needs to enter sleep mode or not.
If not, the CPU will execute an ARM instruction WFI (wait for interrupt) which makes the CPU suspend until the interrupt happens. Normally systick interrupt resumes it. This is the software tickless.
If yes, it will execute the function
freertos_pre_sleep_processing()
to enter sleep mode or deep-sleep mode.
Note
Even FreeRTOS time control like software timer or vTaskDelay is set, it still enters the sleep mode if meeting the requirement as long as the idle task is executed.
configUSE_TICKLESS_IDLE must be enabled for power-saving application because sleep mode flow is based on tickless.