Linux Low Power Mode on STM32H7

This application note explains how to use the Linux low power mode (the so-called "suspend to RAM") on the Emcraft Systems STM32H7 System-On-Module (SOM). When suspended, the SOM consumes approximately 5 mA @3.3V, at the same time providing instantaneous wake-up on configured I/O events, such as GPIO triggers.

1. Understanding Implementation

1.1. Power Consumption in Normal (Run) Mode

Support for the low power mode is enabled in the standard rootfs project available from the Emcraft software distribution and installed on each module shipped by Emcraft. With Linux booted up to the shell, and with no commands entered from the interactive shell or a shell script, the system is idling awaiting user input or some other I/O events. The power consumption of the SOM is around 80 mA @3.3V on the average at such times. If you create some load for the system, the power consumption will go up. For instance, using the following shell commands to create an endless command loop:

/ # while echo hey > /dev/null > do > echo Linux is running > done Linux is running Linux is running <...> ^C / #

You should measure The SOM power consumption of around 130 mA @3.3V.

1.2. Power Consumption in Low Power Mode

Now, let's put the system into the low power mode. This is done by running the following command:

/ # echo mem > /sys/power/state [ 370.654742] PM: suspend entry (deep) [ 370.657323] Filesystems sync: 0.000 seconds [ 370.661361] Freezing user space processes [ 370.666958] Freezing user space processes completed (elapsed 0.001 seconds) [ 370.672871] OOM killer disabled. [ 370.676023] Freezing remaining freezable tasks [ 370.682016] Freezing remaining freezable tasks completed (elapsed 0.001 seconds) [ 370.688316] printk: Suspending console(s) (use no_console_suspend to debug)

At this time, the power consumption goes down dramatically and should measure about 5 mA @3.3V.

1.3. Resuming from Low Power Mode

Press the BTN1 User Button on the STM32H7-BSB board to wake the system up:

[ 370.871644] OOM killer enabled. [ 370.874772] Restarting tasks ... done. [ 370.883581] PM: suspend exit / #

Note also that the system automatically restores the TCP/IP stack on wake-up from the suspended state. The following test illustrates this:

1.4. Configuring GPIO Key as a Wake-up Source

The default trigger used for system wake-up is the BTN1 User Button on the STM32H7-BSB development board. It is connected to the PH.2 GPIO on the STM32H7. The button is configured in the rootfs.dts file correspondingly. The button-1 node in gpio-keys specifies the gpio-key,wakeup property to enable wake-up from this pin: