STM32MP157F-DK2 OpenSTLinux with 60 series

This guide integrates a DVK-ST60-2230C populated with a ST60-2230C-UU using a USB/USB (Wi-fi/Bluetooth) interface to a STM32MP157F-DVK2 using ST’s OpenSTLinux Yocto Dunfell. This integration is performed on a Ubuntu 20.04 PC.

Prerequisites

ST provides thorough instruction on setting up a PC build system. It’s highly recommended to go over these instructions carefully as they cover instructions for several different types of setups. Section 3 covers setting up a Linux PC in subsections 3.1 and 3.2 which is needed for this guide.

https://wiki.st.com/stm32mpu/wiki/PC_prerequisites

Hardware physical setup

Hardware used is the STM32MP157F-DK2 development kit from ST with the DVK-ST60-2230C with a ST60-2230C-UU variant installed on the DVK. Physical connections include power, serial console, and usb cable between STM32MP157F-DK2 and DVK-ST60-2230C.

stm32 and st60-2230c-uu

Installing OpenSTLinux distribution

These instructions and more are covered here in ST’s wiki with the exception of the Wifi driver and firmware integration.

Install OpenSTLinux

cd ~/projects
mkdir openstlinux-5.10-dunfell-mp1-21-11-17
cd openstlinux-5.10-dunfell-mp1-21-11-17

repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-5.10-dunfell-mp1-21-11-17
repo sync

Initialize the Environment

Initialize the environment (in this example, DISTRO openstlinux-weston and MACHINE stm32mp1 are used). Other DISTRO and MACHINE settings can be reviewed on ST Wiki: https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_distribution

DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

Read and Accept the EULA.

Read EULA

Accept EULA

Integrate meta-layer

Download the meta-layer (meta-laird-cp) release 9.32.0.6

Place the meta-laird-cp layer inside the folder: layers/

cd layers/
git clone https://github.com/LairdCP/meta-laird-cp

Note at the time of this guide release 9.32.0.6 was used. If there are issues integrating the latest driver try switching to this release. Always open a support ticket at https://www.ezurio.com/resources/support (scroll to bottom and hit “Open a Support Ticket”) if there are technical questions or issues.

Remove WLAN, bluetooth, and wireless from the kernel

Build the kernel menuconfig and remove WLAN, bluetooth, and wireless from the kernel. The meta-laird-cp will replace these drivers and firmware.

>>cd ~/projects/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1

bitbake -c menuconfig virtual/kernel
  • deselect Device Drivers -> Network device support -> Wireless LAN kernel menuconfig WLAN
  • deselect Networking support -> Bluetooth subsystem support
  • deselect Networking support -> Wireless kernel menuconfig WLAN

add to conf/bblayers.conf

This adds our meta-laird-cp to the Yocto layers. The path used below will need to be altered depending on the path used on the PC.

>>vi conf/bblayers.conf

BBLAYERS =+ "/home/travis/projects/openstlinux-5.10-dunfell-mp1-21-11-17/layers/meta-laird-cp"

add to conf/local.conf

Set the wpa supplicant provider, BBMASK for openssl, and append to the image packages needed. If using a different hardware interface than USB/USB be sure to change the sterling60-firmware-xxx-xxx to the specific interface to be used.

>>vi conf/local.conf

PREFERRED_PROVIDER_wpa-supplicant = "sterling-supplicant"
PREFERRED_PROVIDER_wpa-supplicant-cli = "sterling-supplicant"
PREFERRED_PROVIDER_wpa-supplicant-passphrase = "sterling-supplicant"

BBMASK += " \ 
    meta-laird-cp/recipes-packages/openssl \ 
    meta-laird-cp/recipes-packages/.*/.*openssl10.* \ 
    "

# For the 60 series radios this needs to point to the specific firmware used, in this case usb/usb
PREFERRED_RPROVIDER_wireless-regdb-static = "sterling60-firmware-usb-usb" 

# this must be _append, IMAGE_INSTALL += will cause issues
IMAGE_INSTALL_append += "\
        iproute2 \
        rng-tools \
        ca-certificates \
        tzdata \
        alsa-utils \
        htop \
        ethtool \
        iperf3 \
        tcpdump \
        iw \
        kernel-module-sterling-backports-laird \
        sterling60-firmware-usb-usb \
        sterling-supplicant \
        lrd-networkmanager-sterling \
        lrd-networkmanager-sterling-nmcli \
        "

Sample images are provided in Yocto layer in: meta-laird-cp/recipes-packages/images/. For this guide the IMAGE_INSTALL_append includes everything needed and will be added into st-image-core.

bitbake image

Build the image (in this example st-image-core is used). Other images can be reviewed on ST Wiki: https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_distribution#Images

bitbake st-image-core

flashing image

Flashing the STM32MP157F-DK2 can be done a couple ways.

We’re using method 1, flashing over USB in DFU mode. In order to connect in USB DFU mode the mode switches need set accordingly. Set BOOT0 and BOOT2 to OFF to put the device in USB DFU mode and reset the device.

  1. Open up STM32CubeProgrammer: stm32cubeprogrammer_1_open.png

  2. Select USB port and select refresh to show STM32MP157F-DK2 is in DFU mode: stm32cubeprogrammer_2_scan_usb_dfu.png

  3. Select Open File: stm32cubeprogrammer_3_open_file.png

  4. Select the corresponding tsv file to flash: stm32cubeprogrammer_4_select_tsv.png

  5. Browse to files in: ~/projects/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/images/stm32mp1 stm32cubeprogrammer_5_browse_to_files.png

  6. Start Download: stm32cubeprogrammer_6_start_download.png

  7. Wait for flashing service completed successfully: stm32cubeprogrammer_7_download_finished_popup.png

  8. Flashing Completed: stm32cubeprogrammer_8_download_finished.png

  9. Reset the mode switches back to boot from microSD card (BOOT0 and BOOT2 set to ON) and reset the device.

  10. Connect to the serial console to interact with the linux console.

DVK-ST60-2230C checks

Wifi dmesg check

In the dmesg check that backports (driver) is loaded, ieee80211 phy1 comes up and downloads firmware to the Wi-Fi module, and that Bluetooth comes up.

[   14.528114] Loading modules backported from Summit Linux version LRD-REL-9.32.0.6-0-gb207f99f9276
[   14.535616] Backport generated by backports.git v9.32.0.6
[   15.036803] PMU_EN GPIO not configured
[   15.039272] ieee80211 phy0: priv->pcmd_buf = eb1f6934
[   15.065439] ieee80211 phy0: lrdmwl: found firmware image <lrdmwl/88W8997_usb.bin>
[   15.086164] ieee80211 phy0: start to download FW...
[   15.380172] ieee80211 phy0: info: FW download over, size 379228 bytes, ret 0
[   15.385973] ieee80211 phy0: Firmware download complete, port will reset with new interface...
[   15.394611] lrdmwl_usb: probe of 2-1.1:1.0 failed with error -115
[   15.436567] usbcore: registered new interface driver lrdmwl_usb
[   16.535983] stm32-dwmac 5800a000.ethernet eth0: PHY [stmmac-0:00] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[   16.575961] dwmac4: Master AXI performs any burst length
[   16.579862] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
[   16.596237] stm32-dwmac 5800a000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   16.616139] stm32-dwmac 5800a000.ethernet eth0: registered PTP clock
[   16.628882] stm32-dwmac 5800a000.ethernet eth0: configuring for phy/rgmii-id link mode
[   16.973181] usb 2-1.1: USB disconnect, device number 3
[   17.285987] usb 2-1.1: new high-speed USB device number 4 using ehci-platform
[   17.460219] PMU_EN GPIO not configured
[   17.462705] ieee80211 phy1: priv->pcmd_buf = 5e3302fe
[   17.463938] ieee80211 phy1: lrdmwl: found firmware image <lrdmwl/88W8997_usb.bin>
[   17.490626] ieee80211 phy1: Skipping FW download, continuing with initialization...
[   17.565267] ieee80211 phy1: OTP data len = 0
[   17.568747] ieee80211 phy1: Adjusting combo 0's number of supported interfaces to 2
[   17.584212] ieee80211 phy1: mwl_reg_notifier set=0 core 00
[   17.598326] ieee80211 phy1: Sending regulatory hint for 00
[   17.598378] ieee80211 phy1: Radio Type ST60 (0x0)
[   17.601646] ieee80211 phy1: Num mac 2 : OTP Version (1)
[   17.615937] ieee80211 phy1: Firmware version: 5.6.43.5
[   17.620767] ieee80211 phy1: Firmware OTP region: ff, country: 00
[   17.632680] ieee80211 phy1: Deep Sleep is disabled
[   17.644073] ieee80211 phy1: 2G enabled, 5G enabled
[   17.647798] ieee80211 phy1: 2 TX antennas, 2 RX antennas. (00000003)/(00000003)
[   17.667494] ieee80211 phy1: mwl_reg_notifier set=1 driver 00
[   17.669028] ieee80211 phy1: Validating lrdmwl/regpwr.db
[   17.669054] ieee80211 phy1: Module signature marker not found 892
[   17.673785] ieee80211 phy1: checking lrdmwl/regpwr.db for region:ff country:00
[   17.673806] ieee80211 phy1: Region ff country 00 not found in lrdmwl/regpwr.db.
[   18.563230] ieee80211 phy1: WMM Turbo=1
[   18.717696] Bluetooth: Core ver 2.22
[   18.737492] NET: Registered protocol family 31
[   18.740562] Bluetooth: HCI device and connection manager initialized
[   18.758081] Bluetooth: HCI socket layer initialized
[   18.768664] Bluetooth: L2CAP socket layer initialized
[   18.781038] Bluetooth: SCO socket layer initialized
[   18.813850] usbcore: registered new interface driver btusb
[   18.829806] Bluetooth: hci0: unexpected event for opcode 0x0000

Wifi interface check

Note: the OUI c0:ee:40 is Ezurio. OUIs can be checked on Wireshark’s OUI Lookup Tool.

root@stm32mp1:~# iw dev
phy#1
        Interface wlan0
                ifindex 4
                wdev 0x100000001
                addr c0:ee:40:46:c0:20
                type managed
                txpower 20.00 dBm
root@stm32mp1:~#

Connect to wifi network example

Example of connecting to a network with NetworkManager (nmcli) to SSID “test” and password “password1”.

nmcli con add con-name "test" ifname wlan0 type wifi ssid "test" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "password1" 

Wifi Performance

root@stm32mp1:~# iperf3 -c 10.0.0.3
Connecting to host 10.0.0.3, port 5201
[  5] local 192.168.8.224 port 40996 connected to 10.0.0.3 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  13.2 MBytes   110 Mbits/sec    0    621 KBytes
[  5]   1.00-2.00   sec  16.6 MBytes   139 Mbits/sec    0   1.21 MBytes
[  5]   2.00-3.00   sec  15.7 MBytes   132 Mbits/sec    0   1.55 MBytes
[  5]   3.00-4.00   sec  19.5 MBytes   163 Mbits/sec    0   1.73 MBytes
[  5]   4.00-5.00   sec  19.2 MBytes   161 Mbits/sec    0   1.91 MBytes
[  5]   5.00-6.00   sec  18.0 MBytes   151 Mbits/sec    1   1.40 MBytes
[  5]   6.00-7.00   sec  15.7 MBytes   132 Mbits/sec    0   1.50 MBytes
[  5]   7.00-8.00   sec  15.3 MBytes   129 Mbits/sec    0   1.50 MBytes
[  5]   8.00-9.00   sec  16.0 MBytes   134 Mbits/sec    0   1.50 MBytes
[  5]   9.00-10.00  sec  18.0 MBytes   151 Mbits/sec    0   1.74 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   167 MBytes   140 Mbits/sec    1             sender
[  5]   0.00-10.03  sec   166 MBytes   139 Mbits/sec                  receiver

iperf Done.
root@stm32mp1:~#

root@stm32mp1:~# iperf3 -c 10.0.0.3 -R
Connecting to host 10.0.0.3, port 5201
Reverse mode, remote host 10.0.0.3 is sending
[  5] local 192.168.8.224 port 40992 connected to 10.0.0.3 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  11.9 MBytes   100 Mbits/sec
[  5]   1.00-2.00   sec  11.0 MBytes  91.9 Mbits/sec
[  5]   2.00-3.00   sec  11.2 MBytes  93.7 Mbits/sec
[  5]   3.00-4.00   sec  12.6 MBytes   105 Mbits/sec
[  5]   4.00-5.00   sec  12.5 MBytes   105 Mbits/sec
[  5]   5.00-6.00   sec  11.7 MBytes  98.4 Mbits/sec
[  5]   6.00-7.00   sec  9.86 MBytes  82.8 Mbits/sec
[  5]   7.00-8.00   sec  8.98 MBytes  75.3 Mbits/sec
[  5]   8.00-9.00   sec  10.8 MBytes  90.9 Mbits/sec
[  5]   9.00-10.00  sec  12.8 MBytes   107 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.01  sec   116 MBytes  97.0 Mbits/sec   71             sender
[  5]   0.00-10.00  sec   113 MBytes  95.1 Mbits/sec                  receiver

iperf Done.
root@stm32mp1:~# 

Bluetooth scan

root@stm32mp1:~# bluetoothctl
Agent registered
[CHG] Controller C0:EE:40:46:C0:23 Pairable: yes
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller C0:EE:40:46:C0:23 Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller C0:EE:40:46:C0:23 Discovering: yes
[NEW] Device 52:71:79:87:90:86 52-71-79-87-90-86
[NEW] Device E7:A3:99:CE:06:A2 BL654 BME280 Sensor
[bluetooth]#

Additional Resources