A big drawback of Raspberry devices is the lack of power management and sleep mode and make it therefore not recommended for battery and solar applications.
The STM32mp1 platform supports power management.
https://www.st.com/en/evaluation-tools/stm32mp157d-dk1.html
The STM32MP157F-DK2 seems to have the same bare PCB as the STM32MP157D-DK1 but has WLAN equipped and comes with a display.
STM32MP157D-DK1 comes with an SDcard containing a Yocto Linux build and supports to plug in a HDMI screen and keyboard.
The serial console uses 115200 baud on /dev/ttyACM0 and ST-LINK connector CN11 while it gets powered from the PWR_IN connector CN6.
screen /dev/ttyACM0 115200 it logs in automatically as root without password
rtcwake -m mem -s 10 puts the device in sleep mode and wakes it up 10 seconds later using the realtime clock
cat /sys/power/state
shows just mem
meaning suspend to RAM
echo mem > /sys/power/state will send it to deep sleep. The WAKE UP button brings it back immediately. 200mA => 1W when running, 80mA => 0.4W when sleeping
80mA are still a lot, they come from the STM32F103 micro-controller used as the ST-LINK debugger, LEDs,
poweroff turns off the device but still consumes 30mA => 0.15W. The wakeup button brings it with a reboot taking time back
STM supports buildroot https://wiki.st.com/stm32mpu/wiki/Category:Buildroot-based_Linux_embedded_software
There are different level of buildroot supports.
The "starter-package" contains already compiled images that are ready to be copied to a SDcard as boot medium https://github.com/bootlin/buildroot-external-st/tree/openstlinux-6.6-buildroot-2025.02.5-mpu-v25.06.11?tab=readme-ov-file#starter-package
It is a Buildroot BR2_EXTERNAL tree that adds configuration for the STM evaluation boards.
To build it from the source mkdir ~/stm-buildroot and cd ~/stm-buildroot
git clone -b st/2025.02.5 https://github.com/bootlin/buildroot.git
git clone -b st/2025.02.5 https://github.com/bootlin/buildroot-external-st.git
cd buildroot/
make BR2_EXTERNAL=../buildroot-external-st st_stm32mp157d_dk1_defconfig
make
gzip -dc sdcard.img.gz | dd of=/dev/sd<x> bs=1M to put it to the SDcard
cat /sys/power/state
shows just mem
meaning suspend to RAM and freeze
rtcwake is in the default build not available
echo freeze > /sys/power/state works but does not significantly reduce power
echo mem > /sys/power/state works and reduces power to 80mA => 0.4W
STM32MP157C-Odyssey https://wiki.seeedstudio.com/ODYSSEY-STM32MP157C/comes with a historical, outdated, messy and buggy debian image. User name is debian and password temppwd.
Power consumption is about 265mA => 1.3W
echo mem | sudo tee /sys/power/state reduces it to 55mA => 0.28W
STM recommends to use yocto or buildroot.
Go at https://buildroot.org/ and decide what version to be used: git, long-term or stable.
Everything can be done as regular user
For git create some working directory and cd to it.: git clone https://gitlab.com/buildroot.org/buildroot.git creates then the subdirectory buildroot
git pull will update it
For the other versions download the *.tar.gz and extract it, a buildroot subdirectory will be created with all required.
A a sdcard image gets created that can be put to an sdcard in different ways.
Using dd
dd if=output/images/sdcard.img of=/dev/sd<?> bs=1M status=progress
sync
As alternative use the raspberries imager*. This is more more user-friendly and safe (especially to select the correct /dev/sd and avoid formatting the wrong disk): Do not filter for boards and select custom image<?>
To communicate it use a 3.3V powered USB TTL UART Adapter where the power pin will not be used.
TX pin 2 on the board is an output so connect it to RX pin of adapter cable
RX pin 1 on the board is an input so connect it to TX pin of adapter cable
screen /dev/ttyUSB0 115200 to communicate with it using 115200 baud rate, 8 bit, no parity bits, a stop bit 1, no flow control.
Creating a bootable SDcard is done by just using two commands
The second command make takes time since it compiles and downloads all for the SDcard
make stm32mp157c_odyssey_defconfig
make
The output subdirectory contains then the SDcard image. Login as root when prompted for password press enter.
Edit .gitignore to have .config checked. Later type git status to track what has been configured
Running the buildroot default image has a much lower power consumption than the debian image: 130mA => 0.65W
poweroff on the default buildroot build fails with
ERROR: stm32mpu1 System Off: operation not handled.
However cat /sys/class/regulator/regulator.*/microvolts can read the PMIC (Power Management Integrated Circuit) chip.
echo mem > /sys/power/state freezes the system.
PSCI (Power State Coordination Interface) and PMIC (Power Management Integrated Circuit) must work together. dmesg | grep psci and dmesg | grep pmic will show if the kernel knows them
The Odyseey uses I2C2 to communicate to the pmic ,STMicroelectronics however uses I2C4.
https://wiki.st.com/stm32mpu/wiki/PMIC_hardware_components#Support_in_Linux_Kernel says;
TF-A is configured to use a secure I²C (I2C4 or I2C6). By default on STMicroelectronics boards, I2C4 is used. Using another I²C (non-secure) is not supported in the TF-A implementation made by STMicroelectronics. But it is possible to modify the code and device tree files to support it.
It then shows an example with I2C2
There are different versions and forks for the different parts as TF-A, u-boot, kernel, around.
Documents from STMicroelectronics refer to what STMicroelectronics publishes
STM32 are 32 bit ARM microcontrollers, that are in generally too small for Linux but also to big to have a DIL case for the hobbyist. However when cost is an issue and a Linux board is too expensive or not robust enough and a small device as a AVR is too much a compromise to write Software or if a hobbyist wants to do something professional, then STM32 are a good choice.
There is good support with gcc. There are different ways to start with programming them. The most modern way is cube that has, libraries, tools, board support packages, high abstraction layer including RTOS, FAT, TCP/IP and USB: http://www.emcu.it/STM32Cube/STM32Cube.html or for the specific micro-controller series F4. Registration is required to get the software.
A tool chain is required and does not come from ST. However ST supports different tool chains and even onces that are free as:
Standalone IDE https://atollic.com/truestudio/
Eclipse based. Two ways for the installation are possible:
Register and get the installer that comes with eclipse and all required
Start an already installed eclipse and follow the steps required to get the plugins. Those steps are roughly adding the update site with the name System Workbench for STM32 - Bare Machine edition and its location then click a couple of time ok or yes until eclipse is happy.