Linux Low Power Mode on STM32F7 Print


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

Support for the low-power mode is enabled in the standard networking project available from the Emcraft software distribution. 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 130 mA 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 170 mA:

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

~ # echo mem > /sys/power/state
PM: suspend of devices complete after 32.716 msecs
PM: late suspend of devices complete after 0.275 msecs
PM: early resume of devices complete after 0.035 msecs
PM: resume of devices complete after 138.811 msecs
Restarting tasks ... done.
~ #

At this time, the power consumption goes down dramatically and should measure at less then 2 mA:

Activate the P9.10 GPIO to wake the system up. In our testing, we just tied a wire connected to the P9.10 signal available on the breadboard area to the 3.3V power, as a way to create a trigger on the GPIO line:

PM: suspend of devices complete after 0.846 msecs
PM: late suspend of devices complete after 0.227 msecs
PM: early resume of devices complete after 0.022 msecs
PM: resume of devices complete after 83.704 msecs
Restarting tasks ...
done.
~ #

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

~ # ping 172.17.0.1 &
[1] 22 ping 172.17.0.1
~ # PING 172.17.0.1 (172.17.0.1): 56 data bytes
64 bytes from 172.17.0.1: seq=0 ttl=64 time=0.461 ms
64 bytes from 172.17.0.1: seq=1 ttl=64 time=0.473 ms
64 bytes from 172.17.0.1: seq=2 ttl=64 time=0.471 ms
64 bytes from 172.17.0.1: seq=3 ttl=64 time=0.476 ms
echo mem > /sys/power/state

PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.01 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
Suspending console(s) (use no_console_suspend to debug)

...

PM: suspend of devices complete after 32.699 msecs
PM: late suspend of devices complete after 0.218 msecs
PM: early resume of devices complete after 0.034 msecs
PM: resume of devices complete after 139.004 msecs
Restarting tasks ... done.
~ # PHY: 00:00 - Link is Up - 100/Full
64 bytes from 172.17.0.1: seq=9 ttl=64 time=0.581 ms
64 bytes from 172.17.0.1: seq=10 ttl=64 time=0.468 ms
64 bytes from 172.17.0.1: seq=11 ttl=64 time=0.470 ms
64 bytes from 172.17.0.1: seq=12 ttl=64 time=0.454 ms
64 bytes from 172.17.0.1: seq=13 ttl=64 time=0.475 ms
64 bytes from 172.17.0.1: seq=14 ttl=64 time=0.472 ms
...

Similarly, if you were running any operations with the on-module NAND Flash prior to suspending the system, these operations will automatically resume when the system wakes up. The following test illustrates this:

~ # flash_eraseall -j /dev/mtdblock2
flash_eraseall: /dev/mtdblock2: not a char device
~ # flash_eraseall -j /dev/mtd2
Erasing 128 Kibyte @ d00000 - 100% complete.Cleanmarker written at ce0000.
~ #
~ #
~ # mount -t jffs2 /dev/mtdblock2 /mnt
~ # ls -l /mnt
~ #
~ # mkdir /m
~ # mount -o nolock 172.17.0.1:/work/psl/tmp /m
~ # ls -l /m/networking.uImage
-rwxr-xr-x 1 1542 100 2126448 May 5 2016 /m/networking.uImage
~ # time cp /m/networking.uImage /mnt &
[1] 42 time cp /m/networking.uImage /mnt
~ # echo mem > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.05 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.03 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
...
PM: suspend of devices complete after 32.702 msecs
PM: late suspend of devices complete after 0.218 msecs
PM: early resume of devices complete after 0.031 msecs
PM: resume of devices complete after 139.028 msecs
Restarting tasks ... done.
~ # PHY: 00:00 - Link is Up - 100/Full
real 0m 8.46s
user 0m 0.00s
sys 0m 5.35s
[1] Done time cp /m/networking.uImage /mnt
~ #
~ # ls -l /mnt/networking.uImage
-rwxr-xr-x 1 root root 2126448 Jan 1 00:30 /mnt/networking.uImage
~ # md5sum /m/networking.uImage /mnt/networking.uImage
45e90d70f2e02ca50a03dfc096fb12db /m/networking.uImage
45e90d70f2e02ca50a03dfc096fb12db /mnt/networking.uImage
~ #