匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“Power overview”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
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<sup>®</sup> Cortex<sup>®</sup>-A7 core * How to enter a platform low-power mode ==Low-power modes available on the device== Refer to [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for the full description of low-power modes.<br> The [[STM32MP15 resources#AN5109|AN5109 low-power application note]] also gives details on these modes. The modes are handled by the [[RCC internal peripheral|RCC]] and the [[PWR internal peripheral|PWR]] peripherals. The table below explains the device hardware states corresponding to each low-power mode. The term "subsystem" either refers to Arm<sup>®</sup> Cortex<sup>®</sup>-A7 (also called MPU) or to Arm<sup>®</sup> Cortex<sup>®</sup>-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. {| class="st-table" |- ! Level !! Mode !! Vddcore state !! Clocks state |- | rowspan="5" | Subsystem || MPU CRun || on || on |- | MPU CStop || on || Subsystem off |- | MPU CStandby || on || Subsystem off |- | MCU CRun || on || on |- | MCU CStop || on || Subsystem off |} {| class="st-table" |- ! 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 |} {{ReviewsComments|BPU W1929: Would be nice also to say what is supported and what is not on the referenced boards}} {{ReviewsComments|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}} {{ReviewsComments|BPU W1929: VBAT mode is not mentioned }} {{ReviewsComments|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 }} ===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. {| class="st-table" |- ! 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 internal peripheral|PWR]]) |- | LPLV-Stop || BOR, PVD, AVD, Vbat mon, Temp mon, LSE CSS, RTC, TAMP, IWDG, GPIO, Wakeup pins (from [[PWR internal peripheral|PWR]]) |- | Standby || BOR, Vbat mon, Temp mon, LSE CSS, RTC, TAMP, IWDG, Wakeup pins (from [[PWR internal peripheral|PWR]]) |} {{ReviewsComments|BPU W1929: Would be nice also to mention that the source giving the higest constraint will be the one choosen for the wakeup}} {{ReviewsComments|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 }} {{ReviewsComments|BPU W1929: Would be nice to mention a way to check which makeup sources are activated on the board}} {{ReviewsComments|OBI W2007: Agree. Comment added in paragraph 3.3.3}} ==Software overview== The Linux<sup>®</sup> suspend framework is used to trigger a low-power mode entry/exit sequence. Refer to {{CodeSource | Linux kernel | Documentation/power}} for more details. [[File:Power mgt.png|link=]] 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 {{CodeSource | Linux kernel | 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 {{CodeSource | Linux kernel | 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<sup>®</sup> 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 | 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<sup>®</sup> Cortex<sup>®</sup>-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]].</br> Please refer to [[HDP Linux driver]] for its configuration. ==To go further== Refer to [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for a detailed description of low-power modes and peripheral wakeup sources.<br> The [[STM32MP15 resources#AN5109|AN5109 low power application note]] gives additional information on the hardware settings used for low-power management. <noinclude> [[Category:Power and Thermal|0]] {{ArticleBasedOnModel | Framework overview article model}} {{PublicationRequestId | 10387 | 2019-01-21 |AnneJ}} </noinclude>
该页面使用的模板:
模板:ArticleBasedOnModel
(
查看源代码
)
模板:Board$
(
查看源代码
)
模板:CodeSource
(
查看源代码
)
模板:PublicationRequestId
(
查看源代码
)
模板:ReviewsComments
(
查看源代码
)
返回至
Power overview
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志