Quickstart Manual - phyFLEX-STM32MP2x FPSC Alpha Kit (L-1091e.A0)
Table of Contents
| Compatible BSPs | BSP Release Type | BSP Release Date | BSP Status |
|---|---|---|---|
| BSP-Yocto-OpenSTLinux-STM32MP2-ALPHA1 | Major Release | In Progress |
PHYTEC Documentation
PHYTEC will provide a variety of hardware and software documentation for all of our products. This includes any or all of the following:
- Quickstart Guide: A short guide on how to set up and boot a phyFLEX board, along with brief information on building a BSP, the device tree, and accessing peripherals.
- Hardware Manual: A detailed description of the System on Module and accompanying carrier board.
- Yocto Manual: A comprehensive guide for the Yocto version the phyFLEX uses. This guide contains an overview of Yocto, introducing, installing, and customizing the PHYTEC BSP; how to work with programs like Bitbake; and much more.
- BSP Manual: A manual specific to the BSP version of the phyFLEX. Information such as how to build the BSP, booting, updating software, device tree, and accessing peripherals can be found here.
- Development Environment Guide: This guide shows how to work with the Virtual Machine (VM) Host PHYTEC has developed and prepared to run various Development Environments. There are detailed step-by-step instructions for Eclipse and Qt Creator, which are included in the VM. There are instructions for running demo projects for these programs on a phyFLEX product as well. Information on how to build a Linux host PC yourself is also a part of this guide.
- Pin Muxing Table: phyFLEX SOMs have an accompanying pin table (in Excel format). This table will show the complete default signal path, from the processor to the carrier board. The default device tree muxing option will also be included. This gives a developer all the information needed in one location to make muxing changes and design options when developing a specialized carrier board or adapting a PHYTEC SOM to an application.
On top of these standard manuals and guides, PHYTEC will also provide Product Change Notifications, Application Notes, and Technical Notes. These will be done on a case-by-case basis. Most of the documentation can be found on the applicable download page of our products.
Supported Hardware
This BSP supports the phyFLEX-STM32MP2x FPSC-Gamma SOM with the Libra Rapid Development Kit. The STM32MP2 BSP is a unified BSP, which means in the future it will support a set of different PHYTEC Carrier Boards (CB) with different Systems on Module (SOMs). These hardware sets are called MACHINE.
If you need to figure out the corresponding MACHINE name of your board, go to phyFLEX-STM32MP2x FPSC Product Page (Downloads under the heading "Software Linux BSP-Releases / Software Manuals", click on the corresponding BSP release).
Example: Release page for STM32MP2 PD25.1.0 Release: BSP-Yocto-OpenSTLinux-STM32MP2-PD25.1.0
If you choose a specific Machine Name in the section Supported Machines, you can see which Article Numbers are available under this machine and also a short description of the hardware information. In case you only have the Article Number of your hardware, you can leave the Machine Name drop-down menu empty and only choose your Article Number. Now it should show you the necessary Machine Name for your specific hardware.
View of the Libra Rapid Development Kit
Getting Started with the included SD Card
This section is designed to get the board up and running with the SD card included in the kit, which has been prepared with pre-built images.
Included in the Kit
Alpha phyFLEX-STM32MP2x FPSC-Gamma SOM on Alpha Libra Rapid Development Kit (PD-05036-ALPHA.A1)
Power adapter supplying 24 V / 1 A (SV055)
2x USB-A to USB-C cable (WK560)
- Ethernet cable (WK114)
- SD Card with prepared prebuilt images
2.54 10P to DB9P Female (WF072)
2 x 2.54 10P to DB9P Male (WF228)
Booting from the SD Card
This section describes how to boot the phyFLEX-STM32MP2 with the pre-built images on the included SD card.
- Insert the micro SD card into the SD card slot of the board.
- Check that the S1 DIP Switch is in the default position (boot from SD):
- Plug the USB cable into the USB debug connector (X14, shown on ) and your host PC. You should see 4 new devices appear: /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 and /dev/ttyUSB3 . A Linux terminal will be accessible on /dev/ttyUSB0.
- Start your favorite terminal software (e.g., Minicom or Tera Term) on your host PC and configure it for 115200 baud, 8 data bits, no parity, and 1 stop bit (8n1) with no handshake.
- Example to launch minicom on /dev/ttyUSB0:
host:~$sudo minicom -D /dev/ttyUSB0
- Connect the power supply to the power connector.
Warning
If you are using a power adapter other than the one provided, please note the polarity of the power component X8. Ensure that your power adapter is correctly set up to use the polarity as shown below.
Warning
If the USB-PD port (X2) is mounted, do not use it in parallel with the 24V Power-In connector (X8). This may damage your device!
Tips
Be aware that as soon as the Libra FPSC is supplied with power, the SD Card boot sequence will begin. Ensure that all cables are connected to the board!
The console output can be viewed in your terminal window. If everything was done correctly, the login prompt will be shown at the end of the booting process:
ST OpenSTLinux - Weston - (A Yocto Project Based Distro) 5.0.6-snapshot stm32mp25x-libra-fpsc-1a6-b1-6f-aa-0c-ab ttySTM0 stm32mp25x-libra-fpsc-1a6-b1-6f-aa-0c-ab login: root (automatic login) root@stm32mp25x-libra-fpsc-1a6-b1-6f-aa-0c-ab:~#
Log-in is done automatically as root (no password is required).
Prebuild Images
PHYTEC provides pre-built images and release notes for the phyFLEX-STM32MP2 Libra Rapid Development Kit. They can be downloaded here: https://download.phytec.de/Software/Linux/BSP-Yocto-STM32MP2/
Building the BSP
This section will guide you through the general build process of the STM32MP2 BSP using our phyLinux script (based on repo tool) and the Yocto environment provided by OpenSTLinux.
tips
For more information on our provided Yocto OpenSTLinux BSP, please refer to our Yocto OpenSTLinux Manual.
Get and Initialize the BSP Environment
To learn how to obtain and initialize the BSP environment, please refer to our Yocto OpenSTLinux Manual. In this manual, you will also find out how to choose the right OpenSTLinux Distribution and the right BSP Image for your project.
Build Process
Now that the build environment is ready, you can start the first build process, using the following command:
host:~/BSP/build$ bitbake <BSP_IMAGE>
Example to build the "st-image-weston":
host:~/BSP/build$ bitbake st-image-weston
Generated BSP Image Binaries
All images generated by Bitbake are deployed to ~/BSP/build/tmp-glibc/deploy/images/<MACHINE>. The following list shows the generated files used for flashing the phyFLEX-STM32MP2x:
| Binary subfolder location | Binary file name | Description | |
|---|---|---|---|
arm-trusted-firmware | tf-a-<BOOTLOADER_DEVICE_TREE_NAME>-optee-programmer-usb.stm32 | TF-A binary for USB serial boot mode (STM32CubeProgrammer) |
For more details on TF-A BL2, please refer to: |
| tf-a-<BOOTLOADER_DEVICE_TREE_NAME>-optee-programmer-uart.stm32 | TF-A binary for UART serial boot mode (STM32CubeProgrammer) | ||
| tf-a-<BOOTLOADER_DEVICE_TREE_NAME>-optee-emmc.stm32 | TF-A binary for FSBL partition (eMMC boot device) | ||
| tf-a-<BOOTLOADER_DEVICE_TREE_NAME>-optee-sdcard.stm32 | TF-A binary for FSBL partition (SD-card boot device) | ||
fip | fip-<BOOTLOADER_DEVICE_TREE_NAME>-ddr-optee-programmer-usb.bin | FIP binary for FIP DDR partition used on USB serial boot mode (STM32CubeProgrammer) |
TF-A FIP binary encapsulates u-boot and OP-TEE. For more details, please refer to: |
fip-<BOOTLOADER_DEVICE_TREE_NAME>-optee-programmer-usb.bin | FIP binary for FIP partition used on USB serial boot mode (STM32CubeProgrammer) | ||
fip-<BOOTLOADER_DEVICE_TREE_NAME>-optee-emmc.bin | FIP binary for FIP partition of eMMC | ||
fip-<BOOTLOADER_DEVICE_TREE_NAME>-optee-sdcard.bin | FIP binary for FIP partition of SDCARD | ||
| - | st-image-bootfs-<DISTRO>-<MACHINE>.bootfs.ext4 | Binary for bootfs partition on eMMC and microSD card devices | |
st-image-vendorfs-<DISTRO>-<MACHINE>.vendorfs.ext4 | Binary for vendorfs partition on eMMC and microSD card devices | ||
<BSP_IMAGE>-<DISTRO>-<MACHINE>.rootfs.ext4 | Binary for rootfs partition on eMMC and microSD card devices | ||
st-image-userfs-<DISTRO>-<MACHINE>.userfs.ext4 | Binary for userfs partition on eMMC and microSD card devices | ||
<BSP_IMAGE>-<DISTRO>-<MACHINE>.rootfs.wic <BSP_IMAGE>-<DISTRO>-<MACHINE>.rootfs.bmap <BSP_IMAGE>-<DISTRO>-<MACHINE>.rootfs.wic.bz2 | WIC file to create SD card image | ||
Programming the Target
Connecting the Board via USB DFU Link to use STM32MPCubeProgrammer
STM32MPCubeProgrammer tool is used for flashing the eMMC or SD Card.
Installing and using the tool is described in our Yocto OpenSTLinux Manual(in the section Programming the Target).
To download the BSP with STM32MPCubeProgrammer, change the BOOT mode tothe UART/USB boot mode.
For the Libra carrier board:
- Switch OFF the board
- Change the S1 DIP switch to UART/USB boot mode:
- Switch ON the board.
- Connect a USB-C to X18 and to the host PC that contains the BSP image.
The board is now ready for programming with STM32MPCubeProgrammer.
Create an SD Card Image (with PC Host SD Card Reader)
When booting from an SD card, another possibility (apart from using STM32CubeProgrammer) is to create an SD Card image that contains all BSP binary files in correctly preformatted partitions. This can be done from a .wic file or .raw file.
Please refer to the Yocto OpenSTLinux Manual to learn how to create an SD card.
System Booting
The phyFLEX-STM32MP2 can boot from the following devices:
- eMMC
- UART / USB (for USB DFU programming)
- SD-Card
And optionally from following other memory types (not tested) :
- serial NOR (QSPI/OCTOSPI)
- serial NAND (QSPI/OCTOSPI)
- parallel NAND (FMC)
- HyperFlash (OCTOSPI)
The boot source is chosen by setting the S1 DIP switch.
Booting from SD Card
Booting from the SD Card is useful in several situations (for example, when the bootloader in Flash memory has crashed).
To boot from the SD card, set the S1 DIP switch as follows:
There are two ways to create a bootable SD card (refer to Programming the target). You can either use:
- Use a single prebuilt SD card image
- Use STM32MPCubeprogrammer to flash the SD card from a target
Booting from eMMC Flash
- First, you have to follow the procedure to flash the eMMC: Programming the target
- After flashing, power off the board. Then set the S1 DIP switch to the correct positions:
- When powering the board again, the system will boot from eMMC.
Accessing Peripherals (in Linux userspace)
The following sections provide an overview of the supported hardware components and their operating system drivers on the STM32 platform.
UARTs (tty)
The STM32MP2 SoC provides up to 5 x UART, 4 x USART, and 1 x LPUART. phyFLEX-STM32MP2x FPSC-Gamma and carrier board are configured by default with 3 UARTs:
| FPSC interface | STM32MP25 interface | Linux Device | Function on Libra Carrier Board | RTS/CTS |
|---|---|---|---|---|
| UART1 | USART6 | /dev/ttySTM2 | UART available either on:
| yes |
| UART2 | UART5 | /dev/ttySTM1 | UART available either on:
| yes |
| UART3 | USART2 | /dev/ttySTM0 | UART available either on:
| no |
Below are some Linux userspace commands to test the UART on the target:
- Sending a message on STM32MP2 UART5:
target$ echo "test" > /dev/ttySTM1
- Receiving a message on STM32MP2 UART5:
target$ cat /dev/ttySTM1
- Be sure that the baud rate is set correctly on the host and target. To get the currently configured baud rate, you can use the command stty on the target.
Command to get tty help:
target$ tty --help
FD CAN Bus
For an overview of the Linux Controller Area Network (CAN) framework, please refer to https://wiki.st.com/stm32mpu/wiki/CAN_overview
PhyFLEX-STM32MP2x FPSC-Gamma and carrier board provide 3 FD CAN bus:
| FPSC interface | STM32MP25 interface | Linux device |
|---|---|---|
| CAN1 | FDCAN1 | can0 |
| CAN2 | FDCAN2 | can1 |
| CAN3 | FDCAN3 | can2 |
Below are some examples of how to send or receive data on a SocketCAN interface using the can-utils package with the cansend and candump commands:
Prerequisite: At least two nodes are required to communicate on a CAN network.
- Initialize CAN0 Link with 1Mbit/s:
target$ ip link set can0 up type can bitrate 1000000
- The command below allows you to get details on the created link:
target$ ip -details link show can0
4: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
can state STOPPED (berr-counter tx 0 rx 0) restart-ms 0
m_can: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1
m_can: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..32 dbrp_inc 1
clock 100000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536 parentbus platform parentdev 402d0000.can
- To send a single frame, use the cansend utility (cansend <device> <can_frame>):
target$ cansend can0 123#1122334455667788
- To receive CAN messages, use the candump utility:
target$ candump can0 can0 123 [8] 00 11 22 33 44 55 66 77 can0 123 [8] 00 11 22 33 44 55 66 77
- To print help on the candump utility, use: "candump -h."
Network
Two Gigabit Ethernet ports are provided by our SOM and carrier board:
Ethernet Interface | Linux Device | Function on the Libra Carrier board |
X25 | end0 | First Ethernet connection from the PHY populated on the SOM |
| X22 | end1 | Second Ethernet connection from the PHY populated on the SBC |
The interfaces offer a standard Linux network port that can be programmed using theBSD socket interface. The BSP contains different Network tools that allow for the configuration and testing of the Ethernet connections.
For information about these different tools and how to use them, please refer tohttps://wiki.st.com/stm32mpu/wiki/Network_tools
Example of how to assign a given IP address to an Ethernet end0 interface:
ifconfig end0 10.48.1.324
Create an SSH Connection with USB Dual Role or Ethernet
When the target is running on Linux, you can create an SSH connection with Ethernet or USB Dual Role (Ethernet over USB gadget is enabled by default).
To create an SSH connection over Ethernet, proceed as follows:
- Plug an Ethernet cable between the carrier board (X25 or X22) and the PC Host.
- Configure the network of your carrier board (we support that end0 is configured with 192.168.3.11)
- Configure you host PC ethernet (for exemple 192.168.3.10).
target$ ifconfig
end0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.163.3.11 netmask 255.255.255.0 broadcast 192.163.3.255
ether ee:6a:ec:ab:d9:e5 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 56 base 0x8000
end1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 8a:a7:3a:00:43:da txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 59- Connect to the target (to create a new remote terminal through SSH):
host:~$ ssh [email protected]
- You can also copy any file from the host to the target with the following command:
host:~$ scp ~/myFile [email protected]:/home/root
To create an SSH connection over USB Dual role (USB1 on X18), you can proceed the same way. In this case, the target IP address of this interface is by default 192.168.7.1:
target$ ifconfig
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.1 netmask 255.255.255.0 broadcast 192.168.7.255
inet6 fe80::438:b1ff:fe80:3010 prefixlen 64 scopeid 0x20<link>
ether 06:38:b1:80:30:10 txqueuelen 1000 (Ethernet)
RX packets 36 bytes 5226 (5.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32 bytes 7900 (7.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Audio
On the PEB-AV-10, we use the TI TLV320AIC3007 audio codec. Audio support is done via the SAI2 interface and controlled via I2C.
- To check if your sound card driver is loaded correctly and to check which audio output device is available:
target$ aplay -L
- You will get output similar toː
null
Discard all samples (playback) or generate zero samples (capture)
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
oss
Open Sound System
pipewire
PipeWire Sound Server
speex
Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=PHYFLEXLIBRA
PHYFLEX-LIBRA, 402a0004.audio-controller-tlv320aic3x-hifi tlv320aic3x-hifi-0
Default Audio Device
usbstream:CARD=PHYFLEXLIBRA
PHYFLEX-LIBRA
USB Stream Output- To test Audio Playback:
target$ aplay /usr/share/sounds/alsa/Front_Center.wav
- You may have to select the audio device:
target$ aplay -D plughw:PHYFLEXLIBRA /usr/share/sounds/alsa/Front_Center.wav
- Run speaker-test to identify channel numbers (Left, Right...). For example, to check the right and left channels (2 channels):
target$ speaker-test -c 2 -t wav
- You may have to select the audio device:
target$ speaker-test -c 2 -t wav -D plughw:PHYFLEXLIBRA
- To inspect your sound card capabilities, call:
target$ alsamixer -c PHYFLEXLIBRA
You should see a lot of options, as the audio-ICs have many features you can play with. It might be better to open alsamixer via ssh (see Create an SSH Connection with USB OTG or Ethernet) instead of the serial console, as the console graphical effects are better.
SD/MMC card
The STM32MP2 supports a slot for Secure Digital Cards to be used as general-purpose block devices. These devices can be used in the same way as any other block device.
Warning
These kinds of devices are hot-pluggable. Nevertheless, you must ensure not to unplug the device while it is still mounted. This may result in data loss!
After inserting an SD/MMC card, the kernel will generate new device nodes in /dev. The full device can be reached via its /dev/mmcblk0 device node. SD/MMC card partitions will show up in the following way:
/dev/mmcblk0p<Y>
<Y> counts as the partition number starting from 1 to the max count of partitions on this device. The partitions can be formatted with any kind of file system and also handled in a standard manner, e.g. the mount and umount commands work as expected.
Tip
These partition device nodes will only be available if the card contains a valid partition table (”hard disk” like handling). If no partition table is present, the whole device can be used as a file system (”floppy” like handling). In this case, /dev/mmcblk1 must be used for formatting and mounting. The cards are always mounted as being writable.
eMMC Devices
PHYTEC modules like phyFLEX-STM32MP2x FPSC-Gamma are populated with an e.MMC memory chip as the main storage. e.MMC devices contain raw Multi-Level Cells (MLC) or Triple-Level Cells (TLC) combined with a memory controller that handles ECC and wear leveling. They are connected via an SD/MMC interface to the STM32MP2 and are represented as block devices in the Linux kernel like SD cards, flash drives, or hard disks.
The electric and protocol specifications are provided by JEDEC (https://www.jedec.org/standards-documents/technology-focus-areas/flash-memory-ssds-ufs-emmc/e-mmc). The eMMC manufacturer’s datasheet is relatively short and meant to be read together with the supported version of the JEDEC e.MMC standard.
PHYTEC currently utilizes the e.MMC chips with JEDEC Version 5.0 and 5.1.
GPIOs
The phyFLEX-STM32MP2 Libra carrier board has a set of pins specifically dedicated to user I/Os. 36 GPIO come from the GPIO expander; the others are connected directly to the STM32MP2 balls. On the FPSC pinout, there are 7 free GPIOs. But note that the default state of the STM32MP2 I/O pins is GPIOs if not muxed as an alternate function. Accessing GPIOs from userspace can be done using the libgpiod.
Note
On Linux of default BSP (for Libra board), FPSC GPIO3 (PG15) and FPSC GPIO4 (PI6) are not usable as they are used as interrupt by the gpio expander driver.
To see how to access the GPIOs, please refer to https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
Examples:
- List all lines of specified gpiochips, their names, consumers, and their settings:
target$ gpioinfo
gpiochip0 - 16 lines:
line 0: "PA0" unused input active-high
line 1: "PA1" unused input active-high
...- Read the values of the specified GPIO lines (not valid if the line is already requested). The line will then be configured as input.
target$ gpioget PB9 --> to get value of GPIO PB9 "PB9"=active
- Set the values of the specified GPIO lines, potentially keeping the lines exported, and wait until timeout, user input or signal (not valid if the line is already requested).
target$ gpioset PB9=0 --> get GPIO PB9 and set it low Ctrl + C target$ gpioset PB9=1 --> get GPIO PB9 and set it high Ctrl + C
Warning
Most CPU IOs are used for special functions (pin-muxed as alternate functions). Before using a user IO, refer to the schematic or the hardware manual of your board to ensure that it is not already in use.
LEDs
If any LEDs are connected to GPIOs, you can access them by a special LED driver (gpio-leds) interface instead of the general GPIO interface (section GPIOs). You will then access them using /sys/class/leds/. The maximum brightness of the LEDs can be read from the max_brightness file. The brightness file will set the brightness of the LED (taking a value from 0 up to max_brightness). Most LEDs do not have hardware brightness support and therefore, will just be turned on by all non-zero brightness settings.
Here is a simple example:
- To get all LEDs available, type:
target$ ls /sys/class/leds pca963x:blue/ pca963x:green/ pca963x:red/
Here, the LEDs are the three possible colors from an RGB LED driven by a dimmer present on the phyFLEX-STM32MP2 Libra. By default, the RGB LED is off. But this RGB LED can also be used as a "user LED".
led-1 is for the red color, led-2 for green, and led-3 for blue.
- Example to make the RGB color bright blue:
target$ cd /sys/class/leds target$ echo 10 > pca963x:blue/brightness
- Example to turn the RGB LED Blue color OFF:
target$ echo 0 > pca963x:blue/brightness
I2C Bus
The STM32MP2 SoC provides up to 9 I²C FM (Fast-Mode). The phyFLEX-STM32MP2x FPSC Gamma is configured with the following five Fast-Mode I²C modules:
| FPSC interface | STM32MP2 interface | Linux device | Function on the SOM / Libra Board |
|---|---|---|---|
| I2C1 | I2C7 | not accessible (secure only) | reserved for the I²C devices on the SOM (PMIC). |
| I2C2 | I2C2 | /dev/i2c-0 | used by the carrier board (by plenty of devices). |
| I2C3 | I2C8 | /dev/i2c-2 | used by the carrier board (by plenty of devices). |
| I2C4 | I2C1 | Not used | reserved for the carrier board (used by SFP+ X113 not mounted for Libra STM32MP2). |
| I2C5 | I2C4 | /dev/i2c-1 | reserved for the carrier board (used by P3T1750DPZ Temperature sensor). |
Warning
By default, in the current BSP configuration, I2C7 of the phyFLEX-STM32MP2 SOM is secure and not accessible through Linux.
EEPROM
Warning
EEPROM from the SOM is currently not available from Linux (I2C7 of the phyFLEX-STM32MP2 SOM is secure only).
The Libra carrier board provides two EEPROMs.
It is possible to read and write directly to the device:
/sys/class/i2c-dev/i2c-0/device/0-0051/eeprom /sys/class/i2c-dev/i2c-0/device/0-0052/eeprom
- To read and print the first 1024 bytes of the EEPROM as a hex number, execute:
target$ dd if=/sys/class/i2c-dev/i2c-0/device/0-0051/eeprom bs=1 count=1024 | od -x
- To fill the whole EEPROM with zeros, use:
target$ dd if=/dev/zero of=/sys/class/i2c-dev/i2c-0/device/0-0051/eeprom bs=4096 count=1
This operation takes some time as the EEPROM is relatively slow.
RTC
Warning
RTC from the SOM is currently not available from Linux (I2C7 of the phyFLEX-STM32MP2 SOM is secure only).
The STM32MP25 internal RTC is available.
RTCs can be accessed via /dev/rtc*.
- Check the available RTC:
target$ ls /sys/class/rtc target$ rtc0
Tip
This will list all RTCs, including the non-I²C RTCs. Linux assigns RTC device IDs based on the device tree aliases entries, if present.
- To find the name of the RTC devices, you can read their sysfs entry with:
target$ cat /sys/class/rtc/rtc*/name stm32_rtc 46000000.rtc
| RTC Devices | Name | Description |
|---|---|---|
| /dev/rtc0 | stm32_rtc 46000000.rtc | Internal RTC of the CPU |
As time is set according to the value of rtc0 during system boot, rtc0 should always be the RTC that is being backed up.
- Date and time can be manipulated with the date command and the hwclock tool. Example to set the date on /dev/rtc0:
target$ date 0711101425 Fri Jul 11 10:14:00 UTC 2025 target$ hwclock -w
SPI Bus
The STM32MP2 SoC provides up to 8 SPI interfaces and 2 OSPI. The phyFLEX-STM32MP2 is configured with 3 SPI and 1 QSPI.
By default, when no device is connected to SPI, the Linux SPI driver used in the BSP is spidev.
| FPSC interface | STM32MP2 interface | Linux Device | Function on Libra board |
|---|---|---|---|
SPI1 | SPI3 | /sys/bus/spi/devices/spi2.0 | ADC chip (MCP3208-BI/SL) |
SPI2 | SPI8 | /sys/bus/spi/devices/spi3.0 | TPM chip (SLB 9670) |
SPI3 | SPI2 | /sys/bus/spi/devices/spi1.0 | not used - managed by spidev kernel driver by default (/dev/spidev1.0) |
QSPI | QSPI1 | /sys/bus/spi/devices/spi0.0 | QSPI NOR (MT25QU512ABB8E12) |
Displays
Display currently supported: AC209 10" USB capacitive LCD screen - 1280x800 pixels (ph128800t006-zhc01).
This display can be connected through different interfaces of the Libra board:
- LVDS1 on X43/X44 connectors
- LVDS2 with PEB-AV-10 PHYTEC addon connected on Audio/Video connectors X46/X50
- MIPI DSI with PEB-AV-12 PHYTEC addon connected on X39
By default, the PHYTEC BSP is configured for the AC209 on the LVDS1 interface.
Switching between those 3 different configurations is explained in phyFLEX-Libra-rdk Device Tree Overlay
Note
USB Host 2.0 and USB 2.0/3.2 Dual role
Both USB Host and Dual Role use the same framework.
To learn about the Linux USB framework and how to use it, please refer to the USB framework: https://wiki.st.com/stm32mpu/wiki/USB_overview
| FPSC interface | STM32MP2 interface | Linux Device | Function on the Libra board |
|---|---|---|---|
USB1 | USB1(USB3DR) | USB 2.0/3.2 Dual role is available on X18 (USB) (USB 2.0 Dual role only on standard KIT) | |
USB2 | USB2 (USBH) | USB HOST 2.0 on USB 2xTyp A (X16) |
For more software details about the USB3DR (USB3 Dual Role) internal peripheral, please refer to https://wiki.st.com/stm32mpu/wiki/USB3DR_internal_peripheral
For more software details about the USBH internal peripheral, please refer to https://wiki.st.com/stm32mpu/wiki/USBH_internal_peripheral
Watchdog
The STM32MP2 includes several Watchdog circuit called "IWDG" (Independent WatchDoG) that can reset the board when the system hangs (due to software or hardware failures).
Two independent watchdogs (IWDG1 and IWDG2) are dedicated to MPU:
- IWDG1 can be allocated to the Cortex-A secure, which can export it to non-secure through SMC.
- IWDG2 can be allocated to the Cortex-A non-secure. In this configuration, the secure monitor (from OP-TEE or TF-A) is able to receive IWDG early interrupts that can be used to save some logs before reset.
The STM32MP25x also includes 3 others whatchdogs (IWDG3, IWDG4, IWDG5), but these are allocated to the Cortex M33 or M0+.
How to enable the IWDG2 and configure its timeout value
The IWDG2 watchdog is enabled by default in the stm32mp2xx-phyflex-fpsc-g-som.dtsi kernel device tree with a custom timeout value in seconds (timeout-sec):
&arm_wdt {
timeout-sec = <32>;
status = "okay";
};By default, the Watchdog Timer Linux framework support and the IWDG support are activated in the Linux kernel. This configuration can be changed through the Menuconfig tool:
Device Drivers ---> [*] Watchdog Timer Support ---> [*] Disable watchdog shutdown on close [*] Update boot-enabled watchdog until userspace takes over <*> ARM Secure Monitor Call based watchdog support <*> STM32 Independent WatchDoG (IWDG) support
With the option "Update boot-enabled watchdog until userspace takes over" (enabled by default), the kernel will ping the watchdog as long as an application opens the /dev/watchdog file (used by systemd).
How to use the watchdog in Linux using systemd
systemd can use the Hardware watchdog to check for system hangs (when the system is running or during reboot). This feature is enabled by default, with the RuntimeWatchdogSec= option in the file system.conf in /lib/systemd/system.conf.d/00-systemd-conf.conf :
RuntimeWatchdogSec=30s ShutdownWatchdogSec=10min
When RuntimeWatchdogSec is not set or equal to 0, the Watchdog is not used. Setting this option to a different value allows you to use it.
RuntimeWatchdogSec defines the timeout value of the watchdog, while ShutdownWatchdogSec defines the timeout when the system is rebooted. For more detailed information about hardware watchdogs under systemd refer to http://0pointer.de/blog/projects/watchdog.html.
To get more information on the IWDG internal peripheral, please refer to:
https://wiki.st.com/stm32mpu/wiki/IWDG_internal_peripheral
https://wiki.st.com/stm32mpu/wiki/IWDG_device_tree_configuration
To get more information on the IWDG Linux Kernel support and how to use and trace/debug the WDT framework, please refer to:
https://wiki.st.com/stm32mpu/wiki/Watchdog_overview
Device Tree (DT)
STM32MP2x BSP Device Tree Concept
All device tree documentation can be found under:
host:~/PHYTEC_STM32MP13x_BSP/build/tmp-glibc/work-shared/<MACHINE>/kernel-source/Documentation/devicetree/bindings
An introduction to the device tree usage can be found in the Linux kernel: Documentation/devicetree/usage-model.rst. The device tree files are used during boot time by the Trusted Firmware (TF-A), the Bootloader (U-Boot),the secure monitor (OP-TEE), and the Linux kernel.
STM32MP documentation about the STM32MP2x Device Tree can be found at:
- https://wiki.st.com/stm32mpu/wiki/Device_tree
- https://wiki.st.com/stm32mpu/wiki/STM32_MPU_device_tree
- https://wiki.st.com/stm32mpu/wiki/Category:Device_tree_configuration
As shown in the STM32MP2x device tree documentation, the device tree organization depends on whether you are using the standard STM device tree structure or the device tree generated by the STM32CubeMX tool. We recommend using the standard STM device tree structure to conform to the upstream kernel. In this BSP customization chapter, we are presenting the standard STM device tree organization.
Note that in this STM documentation, the concept is exactly the same for the phyFLEX-STM32MP2x boards, but with those two main differences:
- Device tree files of our boards contain "phyflex-fpsc-g-som" or "phyflex-libra-rdk".
- The main Device tree source file (.dts) of our boards doesn't have the same name between the bootloaders (TF-A, U-boot), OP-TEE, and the kernel.
Refer to the following section for the phyFLEX and Libra carrier board device tree file organization: phyFLEX-STM32MP2x and phyFLEX-Libra RDK Device Tree
Device tree source files:
.dts: The device tree source (DTS) that can be processed by DTC (Device Tree Compiler) into a binary device tree called "device tree blob" (.dtb). This device tree blob can be parsed by the embedded software components: LinuxKernel, U-Boot, and TF-A.
For each SOM version (MACHINE), it is assigned a .dts file (one for TF-A, one for u-boot, and one for Linux).
.dtsi: Source files that can be included from a DTS file.
For example, in the Linux kernel, our stm32mp257f-phyflex-libra-rdk.dts DTS files include stm32mp257.dtsi, stm32mp25xf.dtsi, stm32mp25xx-phyflex-fpsc-g-som.dtsi and stm32mp257f-phyflex-libra-rdk-pinctrl.dtsi.
STM32MP2 Pin Muxing
The STM32MP2 SoC contains many peripheral interfaces. To reduce package size and lower overall system cost while maintaining maximum functionality, many of the STM32MP2 terminals can multiplex up to 16 signal functions. The STM32MP2 BSP is based on the pin controller Linux kernel framework (pinctrl) with a specific pinctrl-stm32 driver. The configuration is performed in the device tree source (DTS).
Please refer to the ST documentation to learn about pinctrl and how to configure it in the device tree:
- https://wiki.st.com/stm32mpu/wiki/Pinctrl_overview
- https://wiki.st.com/stm32mpu/wiki/Pinctrl_device_tree_configuration
phyFLEX-STM32MP2x and phyFLEX-Libra RDK Device Tree
As seen in the previous section, the DTS of the stm32mp25x-phyflex-libra-rdk-x machines contains the specific SoC dtsi files. In addition to those .dtsi, other dtsi are included to specify the Board Hardware specificities, which are split into two boards: the SOM and the Baseboard (one dtsi per board):
- SOM: stm32mp25xx-phyflex-fpsc-g-som.dtsi => contains the Hardware specificities common to all the STM32MP25XX-phyFLEX SOM declinations (or Yocto machines)
- Baseboard:stm32mp257f-phyflex-libra-rdk.dts => contains the Hardware configuration of the phyFLEX-Libra RDK.
Info
The hardware differences between the different STM32MP2XX-phyFLEX SoM configs are set in the .dts files. This is done by including different DDR configuration dtsi files (TF-A only), and enabling/disabling SoC optional features (like GPU/NPU, Ethernet, CAN, ...) or SOM configuration (like USB3.2 vs PCIe, or other optional external devices ).
SOM and Baseboard .dtsi include other .dtsi files (for pin control, for example).
Below is the complete list of our PHYTEC custom DTS files (.dts & .dtsi) for the phyFLEX-STM32MP2x SOM andphyFLEX-Libra RDK used by each software component (Linux Kernel, U-Boot, OP- TEE, and TF-A).
To know how to modify those sources and rebuild the BSP image, refer to the next sections.
| Sources | DTS files path | DTS file name (.dts) | phyFLEX-STM32MP2x files | Libra RDK files | |
peripheral configuration | pin control | peripheral configuration | |||
Linux Kernel | arch/arm64/boot/dts/st/ | stm32mp257f-phyflex-libra-rdk.dts | stm32mp25xx-phyflex-fpsc-g-som.dtsi | stm32mp25xx-phyflex-fpsc-g-som-pinctrl.dtsi | stm32mp257f-phyflex-libra-rdk.dts |
| U-Boot | arch/arm/dts | stm32mp257f-phyflex-fpsc-g-somX.dts ex: stm32mp257f-phyflex-fpsc-g-som.dts, stm32mp257f-phyflex-fpsc-g-som-4Gb.dts | stm32mp25xx-phyflex-fpsc-g-som.dtsi Copied from kernel + adding the following interfaces from Libra kernel dtsi:
| stm32mp25xx-phyflex-fpsc-g-som-pinctrl.dtsi Partially copied from kernel pinctrl dtsi file | None |
U-Boot add-ons files : stm32mp257f-phyflex-fpsc-g-somX-u-boot.dtsi | |||||
| OP-TEE | core/arch/arm/dts | stm32mp257f-phyflex-fpsc-g-somX.dts ex: stm32mp257f-phyflex-fpsc-g-som.dts, stm32mp257f-phyflex-fpsc-g-som-4Gb.dts | Partially copied from kernel + adding regulator, low power, clock, and secure configs: stm32mp25xx-phyflex-fpsc-g-som.dtsi | None | None |
OP-TEE Clock Tree configuration file: stm32mp257f-phyflex-fpsc-g-som-rcc.dtsi OP-TEE memory mapping configuration file: stm32mp257f-phyflex-fpsc-g-som-resmem.dtsi OP-TEE RIF configuration file: stm32mp257f-phyflex-fpsc-g-som-rif.dtsi | |||||
| TF-A | fdts | stm32mp257f-phyflex-fpsc-g-somX.dts ex: stm32mp257f-phyflex-fpsc-g-som.dts, stm32mp257f-phyflex-fpsc-g-som-4Gb.dts | Partially copied from kernel + adding clock tree config: stm32mp25xx-phyflex-fpsc-g-som.dtsi | stm32mp25xx-phyflex-fpsc-g-som-pinctrl.dtsi Partially copied from kernel pinctrl dtsi file | None |
TF-A firmware configuration file: stm32mp257f-phyflex-fpsc-g-som-fw-config.dts TF-A Clock Tree configuration file: stm32mp257f-dk-ca35tdcid-rcc.dtsi (from ST dk board) | |||||
tip
When customizing the BSP, the device tree (DT) can also be automatically generated thanks to the STM32CubeMX tool. Note that this is a partial device tree, as some manual code needs to be added. But the generated "pinctrl" device tree node can be reused (no manual code needed in this node).
For further information about the pin muxing tool, refer to STM32CubeMX.
phyFLEX-Libra RDK Device Tree Overlay
phyFLEX-Libra-rdk add-ons (expansions, phyCAM, etc), or specific connector configurations are managed by Device Tree Overlay(DTO).
DTOs are device tree blob fragments that allow specific parts of a Kernel device tree to be overridden on-the-fly, before booting the Kernel. This allows you to make small changes without defining a new complete device tree or modifying the original one.
The phyFLEX-Libra-rdk DTO defined the necessary Kernel device tree adaptation for the specific add-ons/connectors config. One or more DTO can be applied by U-Boot over the machine device tree (DTB) before booting the kernel (through boot.scr.cmd script).
phyFLEX-Libra-rdk DTO source files (.dtso) are stored separately from the other kernel device tree source files, in a subdirectory called "overlays": arch/arm64/boot/dts/st/overlays/
Like classic device tree, the Device Tree Overlay sources are processed by DTC (Device Tree Compiler), but into a binary with .dtbo extension. Those binaries are then stored on the target under: /boot/overlays/
List of phyFLEX-Libra RDK Device Tree Overlays
Device Tree Overlay Name | Description |
|---|---|
stm32mp257f-phyflex-libra-rdk-ksp-0221-bluetooth-uart.dtbo | KSP-0221 expansion board for bluetooth |
stm32mp257f-phyflex-libra-rdk-ksp-0221-wlan-sdio.dtbo | KSP-0021 expansion board for Wifi |
stm32mp257f-phyflex-libra-rdk-lvds-etml1010g3dra.dtbo | Overlay for screen etml1010g3dra |
stm32mp257f-phyflex-libra-rdk-lvds-ph128800t006-zhc01.dtbo | Overlay for screen ph128800t006-zhc01 |
stm32mp257f-phyflex-libra-rdk-pcie.dtbo | Overlay for PCIe (usable only for phyFLEX-STM32MP2x with 2Gb RAM) |
stm32mp257f-phyflex-libra-rdk-usb3ss.dtbo | Overlay for USB3 Super Speed (usable only for phyFLEX-STM32MP2x with 4Gb RAM) |
stm32mp257f-phyflex-libra-rdk-peb-av-10-etml1010g3dra.dtbo | PEB-AV-10 expansion board for AC200 LVDS display (etml1010g3dra) and sound |
stm32mp257f-phyflex-libra-rdk-peb-av-10-ph128800t006-zhc01.dtbo | PEB-AV-10 expansion board for AC209 LVDS display (ph128800t006-zhc01) and sound |
stm32mp257f-phyflex-libra-rdk-peb-av-12-etml1010g3dra.dtbo | PEB-AV-12 expansion board MIPI to LVDS for AC200 display (etml1010g3dra) |
stm32mp257f-phyflex-libra-rdk-peb-av-12-ph128800t006-zhc01.dtbo | PEB-AV-12 expansion board MIPI to LVDS for AC209 display (ph128800t006-zhc01) |
stm32mp257f-phyflex-libra-rdk-vm016-csi1.dtbo | phyCAM-M VM-016 B&W or COL |
How to Apply the Device Tree Overlay
The board must be booted and accessible through a remote console. Device tree overlays can be applied either from u-boot or from userspace:
Applying DTO from userspace
- Edit the /boot/overlays/overlays.txt file
target$ vi /boot/overlays/overlays.txt
This file specifies the DT overlays to apply with the following syntax:
overlay=aa bb cc dd
- aa, bb, cc, dd correspond to a device tree name file (without extension) located in/overlays/ directory:
/overlays/aa.dtbo
/overlays/bb.dtbo
/overlays/cc.dtbo
/overlays/dd.dtbo
Edit the file to enable/disable any DTO located in the /overlays/ directory.
tip
You will need to use the following basic vi command:
<Inser> or <i> => to enter Edit mode
Esc => to escape the Edit mode
:wq => save the modifications and quit the file
:q! => quit the file without saving
- force filesystem sync:
target$ sync
- reboot the board:
target$ reboot
Applying DTO from U-Boot
Device tree overlays to apply can also be set on U-Boot with the following commands:
STM32MP> setenv overlay 'aa bb cc' STM32MP> saveenv
With aa, bb, cc, dd corresponding to a device tree name file (without extension) located in /overlays/ directory:
/overlays/aa.dtbo
/overlays/bb.dtbo
/overlays/cc.dtbo
/overlays/dd.dtbo
If you want to modify an existing overlay variable, you can use the following command:
STM32MP> editenv overlay
Once you have saved the u-boot environments with "saveenv", you can continue the normal boot with the u-boot command "boot".
Note
This method will create the "overlay" u-boot env variable, and in this case, the content of /boot/overlays/overlays.txt will be ignored.
To use the overlays.txt file instead, remove the "overlay" env var with the following u-boot command: setenv overlay
Modifying the Device Tree
Modifying the device tree is a mandatory step when customizing the BSP for a custom carrier board. It is possible to do that using the OpenSTLinux Yocto build environment.
Please refer to our Yocto OpenSTLinux Manual.
OpenSTLinux Yocto SDK
When a Yocto distribution has been modified and validated on target, it is pertinent to build a new Software Development Kit that integrates the modifications and redistributes this SDK to developers.
The procedure to build, install, and use the SDK is described in our Yocto OpenSTLinux Manual.


