Linux

What you can do with a Yocto-built image on your module (user space), independent of the BSP. It applies to images built with our BSPs — see the Yocto Guide for building the images.

General

CPU Temperature

The SoC provides the internal temperature. The resolution is 1000ths of °C, therefore you must divide it by 1000 to obtain °C.

cat /sys/class/thermal/thermal_zone0/temp

Sleep Mode / Low Power

All our modules support suspend-to-RAM.

Suspending the system

This command suspends the device:

echo mem > /sys/power/state

Selecting the suspend mode (s2idle vs. deep)

mem can enter different sleep modes. The available modes are listed in /sys/power/mem_sleep — the currently selected one is enclosed in brackets:

cat /sys/power/mem_sleep
[s2idle] deep
  • deep — suspend-to-RAM: the SoC enters the low-power modes. This is the default on our modules.

  • s2idle — suspend-to-idle: only the CPUs are put to idle, peripherals keep running; much faster to enter/resume, but far less power saving.

Switch the mode (example: select deep) before suspending:

echo deep > /sys/power/mem_sleep

Wakeup

To wake up the system after suspend, different wakeup sources can be defined.

To find all possible wakeup properties run:

find /sys/devices -name wakeup

EXAMPLE - Enabling a peripheral as wakeup source:

echo enabled > /sys/devices/platform/soc/<peripheral>/power/wakeup

EXAMPLE - Enabling the serial UART as wakeup source:

echo enabled > /sys/devices/platform/soc/<serial_tty_path>/power/wakeup

EXAMPLE - Waking up after 15 seconds using the RTC wakealarm:

echo +15 > /sys/class/rtc/rtc0/wakealarm

SoC-specific low-power modes

On all our modules, echo mem > /sys/power/state triggers suspend-to-RAM (Linux exposes freeze and mem in /sys/power/state). The SoC-specific mode the system actually enters depends on the devicetree configuration and on the defined wakeup sources.

The official ST Wiki gives a detailed overview for the STM32MP1/MP2: https://wiki.st.com/stm32mpu/wiki/Category:Platform_power (see also ST application note AN5726 for the STM32MP2 low-power modes).

Hint

If no_console_suspend is set on the kernel command line, the trusted firmware will tell you which mode is entered (STM32MP):

NOTICE:  Entering CStop Mode.

Known Issues (STM32MP1)

  • USB-OHCI:

    • Suspend/resume only working when defined as Wakeup-Source, meaning CStandby mode not supported when active.

    • Suspend fails with hang-up when not defined as Wakeup-Source.

    • If CStandby desired you have to modify devicetree:

    &usbh_ohci {
       status = "disabled";
    };
    
  • LCD:

    • Suspend/resume to CStandby destroys display. Display does not come back when resuming (only LCD, DSI displays work fine).

Graphics

Note

The topics in this section require an image with the Weston desktop installed, e.g. karo-image-weston or karo-image-qt6 (both BSPs) — see the image tables in the Yocto Guide.

Test the GPU

GLmark2 will only run smooth on processors having a GPU (e.g. NXP i.MX8/9, STM32MP25).

XDG_RUNTIME_DIR=/run/user/$UID glmark2-es2-wayland --fullscreen

Play a Video

Play the file named test.mp4:

XDG_RUNTIME_DIR=/run/user/$UID gst-play-1.0 --videosink=waylandsink test.mp4

Run the gstreamer test screen:

XDG_RUNTIME_DIR=/run/user/$UID gst-launch-1.0 videotestsrc ! waylandsink