Power overview
目录
Framework purpose
The purpose of this article is to explain how to handle the STM32MP15x low-power modes:
- Low-power modes available on the device
- Linux software overview
- How to enter and exit the low-power modes on Arm® Cortex®-A7 core
- How to enter a platform low-power mode
Low-power modes available on the device
Refer to STM32MP15 reference manuals for the full description of low-power modes.
The AN5109 low-power application note also gives details on these modes.
The modes are handled by the RCC and the PWR peripherals.
The table below explains the device hardware states corresponding to each low-power mode.
The term "subsystem" either refers to Arm® Cortex®-A7 (also called MPU) or to Arm® Cortex®-M4 (also called MCU). A mode prefixed by 'C' corresponds to a subsystem mode.
A platform mode is the combination of MPU and MCU modes.
Level | Mode | Vddcore state | Clocks state |
---|---|---|---|
Subsystem | MPU CRun | on | on |
MPU CStop | on | Subsystem off | |
MPU CStandby | on | Subsystem off | |
MCU CRun | on | on | |
MCU CStop | on | Subsystem off |
MPU mode | MCU mode | Platform mode | Vddcore state | Clocks state |
---|---|---|---|---|
CRun | CRun | Run | On | On |
CStop | CRun | Run | On | On |
CStandby | CRun | Run | On | On |
CRun | CStop | Run | On | On |
CStop | CStop | Stop/LPLV-Stop/Standby | On/Retention/Off | Off/Off/Off |
CStandby | CStop | Stop/LPLV-Stop/Standby | On/Retention/Off | Off/Off/Off |
<securetransclude src="ProtectedTemplate:ReviewsComments" params="BPU W1929: Would be nice also to say what is supported and what is not on the referenced boards"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="BPU W1929: For customer understanding, it would be good to also detail the boot sequence realized in case of platform stop and standby with DDR in SR"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="BPU W1929: VBAT mode is not mentioned"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="OlivierB W2007: There is a link to AN5109 at the bottom of the page, in which the answers to the 3 above comments are found"></securetransclude>{{#set:Has reviews comments=true}}
Wakeup sources
The above modes are exited due to a wakeup event.
The following table gives the list of wakeup sources available in each mode.
Mode | Available wakeup sources |
---|---|
CStop/CStandby/Stop | BOR, PVD, AVD, Vbat mon, Temp mon, LSE CSS, RTC, TAMP, USB, CEC, ETH, USART, I²C, SPI, LPTIM, IWDG, GPIO, Wakeup pins (from PWR) |
LPLV-Stop | BOR, PVD, AVD, Vbat mon, Temp mon, LSE CSS, RTC, TAMP, IWDG, GPIO, Wakeup pins (from PWR) |
Standby | BOR, Vbat mon, Temp mon, LSE CSS, RTC, TAMP, IWDG, Wakeup pins (from PWR) |
<securetransclude src="ProtectedTemplate:ReviewsComments" params="BPU W1929: Would be nice also to mention that the source giving the higest constraint will be the one choosen for the wakeup"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="OBI W2007: There is a sentence in paragraph 3.3.3 explaining that there is a consistency check. Also AN5109 explains this in full details"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="BPU W1929: Would be nice to mention a way to check which makeup sources are activated on the board"></securetransclude>{{#set:Has reviews comments=true}}
<securetransclude src="ProtectedTemplate:ReviewsComments" params="OBI W2007: Agree. Comment added in paragraph 3.3.3"></securetransclude>{{#set:Has reviews comments=true}}
Software overview
The Linux® suspend framework is used to trigger a low-power mode entry/exit sequence.
Refer to Documentation/power| |}} Documentation/power for more details.
The user application issues a suspend request to the kernel. This request is handled by the suspend Framework, which notifies all the device drivers to prepare for low-power entry. It then calls the PSCI service.
In addition to this centralized suspend process, most of the drivers implement the runtime pm feature.
It is used to dynamically disable the resources of the peripherals (clocks and power when applicable) in case of inactivity (see Documentation/power/runtime_pm.txt| |}} Documentation/power/runtime_pm.txt ).
Component description
Kernel components:
- Suspend framework: this framework schedules the overall sequence by stopping all the ongoing tasks
- GenPD driver: this driver is used for low-power mode selection according to the activated wakeup sources.
- PSCI library: this is a set of standardized functions to request a low-power service to the secure monitor
- RCC driver: this driver handles the circuit non-secure clocks
Secure monitor components:
- PWR driver: this driver is responsible for configuring the low-power mode
- PSCI library: this is a set of standardized functions handling the low-power services
- Low power driver: the role of this driver is to choose the low-power mode according to the programmed wakeup source(s)
- RCC driver: this driver handles the circuit secure clocks
API description
The suspend process is triggered from the user space through standard commands.
The system sleep control file is the state file, located under: /sys/power/
Only the 'mem' command is supported:
- The whole system activity is stopped and a low-power mode is entered. The software selects the deepest mode according to the activated wakeup source(s).
Example: Board $> echo mem > /sys/power/state
Further details can be found in Documentation/power/interface.txt| |}} Documentation/power/interface.txt
STMicroelectronics deliveries propose a default mapping of the low-power modes for each type of board.
Note that this default mapping can be changed thanks to the device tree. Refer to paragraph 3.3.2.
Software configuration
Menuconfig (Linux® kernel)
The suspend to RAM feature is activated by default in STMicroelectronics deliveries.
It can be deactivated through the kernel menuconfig using Power management options/Suspend to RAM and standby: Menuconfig or how to configure kernel .
Device tree (secure monitor)
The default low-power mode mapping can be modified through the secure monitor device tree.
Below an example:
&pwr { system_suspend_supported_modes = < STM32_PM_CSLEEP_RUN STM32_PM_CSTOP_ALLOW_STOP STM32_PM_CSTOP_ALLOW_LP_STOP STM32_PM_CSTOP_ALLOW_LPLV_STOP STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR >; system_off_soc_mode = <STM32_PM_CSTOP_ALLOW_STANDBY_DDR_OFF>; };
For detailed information on the device tree concept, refer to Device tree.
Example of wakeup source activation
The activation of a wakeup source is done in the corresponding driver.
For example, activating UART4 as wakeup source is done thanks to the following commands:
Board $> echo enabled > /sys/devices/platform/soc/40010000.serial/tty/ttySTM0/power/wakeup Board $> echo enabled > /sys/devices/platform/soc/40010000.serial/power/wakeup
It is possible to check the state of each wakeup source (activated or not) by displaying the 'wakeup' attribute.
Note that the software implements a consistency check between the selected wakeup source and the appropriate low-power mode.
How to enter and exit low-power modes
Platform low-power
Select the platform allowed modes depending on the required wakeup source.
Activate the wakeup source(s) (peripheral dependent).
Call the low-power mode on both sides (MPU and MCU).
MPU side
Activate the wakeup source(s) (peripheral dependent)
Call the low-power mode by issuing the following command:
echo mem > /sys/power/state
Note that in Weston configuration the low-power mode is entered upon a 'systemctl suspend' command.
MCU side
Please refer to Coprocessor power management for Arm® Cortex®-M4 commands.
Example: entering/exiting MPU CStop mode
Enable at least one wakeup source from table 2.1 in CStop category, for example USART:
Board $> echo enabled > /sys/devices/platform/soc/40010000.serial/tty/ttySTM0/power/wakeup Board $> echo enabled > /sys/devices/platform/soc/40010000.serial/power/wakeup
Call the low-power entry:
Board $> echo mem > /sys/power/state
or for the Weston configuration:
Board $> cat /etc/systemd/sleep.conf [Sleep] SuspendMode= HibernateMode= HybridSleepMode= SuspendState=mem HibernateState=mem HybridSleepState=mem
Board $> systemctl suspend
The MPU is now in CStop mode, and can be woken up by sending a character to the console.
How to trace and debug
The suspend/resume process execution is logged in the MPU console. It gives useful information on the platform state (sleeping or active).
root@stm32mp1:~# echo mem > /sys/power/state [ 1072.267571] PM: suspend entry (deep) [ 1072.269687] PM: Syncing filesystems ... done. [ 1072.279114] Freezing user space processes ... (elapsed 0.008 seconds) done. [ 1072.292835] OOM killer disabled. [ 1072.296046] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 1072.303431] Suspending console(s) (use no_console_suspend to debug) [ 1072.332520] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget [ 1072.332537] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 [ 1072.332546] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 [ 1072.468536] Disabling non-boot CPUs ... [ 1072.507876] CPU1 killed. [ 1072.509635] Enabling non-boot CPUs ... [ 1072.510508] CPU1 is up [ 1072.527553] dwmac4: Master AXI performs any burst length [ 1072.527583] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found [ 1072.527621] stm32-dwmac 5800a000.ethernet eth0: ERROR failed to create debugfs directory [ 1072.527631] stm32-dwmac 5800a000.ethernet eth0: stmmac_hw_setup: failed debugFS registration [ 1072.588234] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget [ 1072.738469] OOM killer enabled. [ 1072.741575] Restarting tasks ... done. [ 1072.752596] PM: suspend exit
It is also possible to monitor the hardware signals related to the system low-power modes thanks to the HDP internal peripheral.
Please refer to HDP Linux driver for its configuration.
To go further
Refer to STM32MP15 reference manuals for a detailed description of low-power modes and peripheral wakeup sources.
The AN5109 low power application note gives additional information on the hardware settings used for low-power management. <securetransclude src="ProtectedTemplate:ArticleBasedOnModel" params="Framework overview article model"></securetransclude> <securetransclude src="ProtectedTemplate:PublicationRequestId" params="10387 | 2019-01-21 | AnneJ"></securetransclude>