Low-Power Management
System considerations
The KW45/K32W1 has a dual-core architecture and has two separated power domains:
The main domain for the Cortex M33
The Radio domain which comprises the Cortex M3 core and the NBU (Narrow Band Unit).
The two power domains can go into or exit independently different low-power modes, namely Wait for instruction (WFI), Deep-sleep mode, Power-down mode, and Deep Power-down mode.
In Wait For Interrupt (WFI) mode, the CPU core is powered ON but is in an idle mode with the clock turned OFF.
In Deep Sleep mode, the fast clock is turned off, and the CPU along with the main power domain are placed into a retention state, with the voltage being scaled down to support state retention only. As no high frequency clock runs in this mode, the voltage applied on the power domain can be reduced to reduce leakage on the hardware logic. This reduces the overall power consumption in the Deep Sleep mode. When waking up from Deep Sleep mode, the core voltage is increased back to nominal voltage, the fast clock (FRO) is turned back on, and the peripheral in this domain can be reused as normal.
In Power-down mode, both the clock, and power are shut off to the CPU and the main peripheral domain. SRAM is retained, but register values are lost. The SDK power manager handles the restore of the processor registers and dependencies such as interrupt controller and similar ones transparently from the application.
In Deep Power-down mode the SRAM is not retained. This is the lowest power mode available. It is exited through the reset sequence.
Parent topic:Low-Power Management
When/how to enter low power
To enable low power at application level, the gAppLowpowerEnabled_d
define should be set to 1
in app_preinclude.h
file.
The system should enter low power when the entire system is idle, and all software layers agree on that. The device enters low power by calling the PWR_EnterLowPower
function.
For FreeRTOS applications, the low-power entry point is placed in the FreeRTOS idle task, which has the lowest priority in the system. From that task, the vPortSuppressTicksAndSleep
function is called, which at its turn, calls the PWR_EnterLowPower
to enter low power.
For the BareMetal examples, the application low power entry point is placed in the main function and is called when there are no messages to be processed by other tasks.
The wake-up sources that can be configured for the application are UART or button. Note that Low-power timer wake-up source and wake-up from the Radio domain are directly enabled from the Connectivity framework.
Each software layer/entity running on the system can prevent it from entering low power by calling PWR_LowPowerEnterCritical function. The system stays awake until all software layers that called PWR_LowPowerEnterCritical call back PWR_LowPowerExitCritical and the system reaches the low-power entry point.
When going to low power, the SDK Power Manager selects the best low-power mode that fits all the constraints.
The default low-power mode for each application is Deep-sleep mode. Users can change the behavior by setting a new low-power constraint for the application.
For example, if the low power constraint set from the application is Deep-sleep mode, and no other constraint is set, theSDK Power Manager selects Deep-sleep the next time the device enters low power. However, there might be a case when a WFI constraint is set (PWR_SetLowPowerModeConstraint (PWR_WFI)) by another component, such as the SecLib module that operates Hardware encryption. In such cases, the SDK Power Manager selects this WFI mode until the constraint is released by the SecLib module (PWR_ReleaseLowPowerModeConstraint(PWR_WFI)).
If it is required to change the mode from Deep-sleep to Power-down mode, the deep sleep constraint (PWR_ReleaseLowPowerModeConstraint(PWR_DeepSleep)) must be released and the power-down constraint (PWR_SetLowPowerModeConstraints(PWR_PowerDown)) must be set. The SDK Power Manager selects the Power-down mode when the device enters low power.
Parent topic:Low-Power Management