# Holybro Pixhawk RPi CM4 Baseboard
The Holybro Pixhawk RPi CM4 Baseboard (opens new window) is a single-board solution that pre-integrates a (swappable) Pixhawk flight controller with the Raspberry Pi CM4 companion computer ("RPi"). The baseboard has a compact form factor with all the connections needed for development.
The flight controller module is internally connected to RPi CM4 through TELEM2
, but may alternatively be connected using Ethernet with the provided external cable.
This baseboard is plug-in compatible with Holybro Pixhawk 5X, Holybro Pixhawk 6X, and any other Pixhawk controller that follows the Pixhawk Autopilot Bus Standard (opens new window) guidelines for mechanical compatibility across vendors.
Note
The board follows the Pixhawk Connector Standard (opens new window) and Pixhawk Autopilot Bus Standard (opens new window) (including the guidelines for "mechanical compatibility across vendors").
# Purchase
Holybro Pixhawk RPi CM4 Baseboard (opens new window) (www.holybro.com)
The baseboard can be purchased with or without an RPi CM4 and/or flight controller:
- The Raspberry Pi CM4 (CM4008032) supplied by Holybro has the following specification:
- RAM: 8GB
- eMMC: 32GB
- Wireless: No
- The recommended minimum specification for the RPi CM4 is:
- RAM: 4GB (or 8GB)
- eMMC: 16GB
- Wireless: Yes
- The Raspberry Pi CM4 (CM4008032) supplied by Holybro has the following specification:
# Connections & Ports
Note
The Holybro Documentation (opens new window) has more detailed (and possibly more "up to date") port and connection information.
The diagram below shows all the connectors and ports on the baseboard.
# RPi CM4 & FC Serial Connection
The flight controller TELEM2
port is internally connected to RPi CM4 as shown:
RPi CM4 | FC TELEM2 (FMU) |
---|---|
GPIO14 | TXD |
GPIO15 | RXD |
GPIO16 | CTS |
GPIO17 | RTS |
Note
The connection must be also be configured in both RPi and PX4 (unless Ethernet is used instead).
# Installing the Flight Controller
A plug-compatible flight controller such as Holybro Pixhawk 5X and Holybro Pixhawk 6X can simply be pushed into the module slot.
Flight controllers that have a different form factor will need additional wiring.
# Installing the RPi CM4 Companion
This section shows how to install/attach a Raspberry Pi CM4 to the baseboard.
To install the Raspberry Pi CM4 companion computer:
Disconnect the
FAN
wiring.Remove these 4 screws on the back side of the baseboard.
Remove the baseboard case, install the CM4, and use the 4 screws to attach it (as shown):
Reattach the cover.
# Power Module Wiring
The PM03D power module is supplied with the board.
The RPi CM4 and flight controller must be powered separately:
- The flight controller is powered via the CLIK-Mate cable to
POWER1
orPOWER2
port - The RPi CM4 is powered by the
USB C
(CM4 Slave) connection. You can also use your own power supply to power the RPi CM4 baseboard.
The image below shows the wiring in greater detail.
# Flashing the RPi CM4
This section explains how you install your preferred Linux distro, such as "Raspberry Pi OS 64bit" onto the RPi EMCC.
Notes:
- If you are using PX4, you will need to use PX4 version 1.13.1 or newer for PX4 to recognize this baseboard.
- The fan does not indicate if the RPi CM4 is powered/running or not.
- The power module plugged into Power1/2 does not power the RPi part. You can use the additional USB-C Cable from the PM03D power module to the CM4 Slave USB-C port.
- The Micro-HDMI port is an output port.
- RPi CM4 boards that do not have Wifi device will not connect automatically. In this case you will need to plug it into a router or plug a compatible Wifi dongle into the CM4 Host ports.
# Flash EMMC
To flash a RPi image onto EMMC.
Switch Dip-Switch to
RPI
.Connect computer to USB-C CM4 Slave port used to power & flash the RPi.
Get
usbboot
, build it and run it.sudo apt install libusb-1.0-0-dev git clone --depth=1 https://github.com/raspberrypi/usbboot, cd usbboot make sudo ./rpiboot
You can now install your preferred Linux distro using The
rpi-imager
. Make sure you add WiFi and SSH settings (hidden behind the gear/advanced symbol).sudo apt install rpi-imager rpi-imager
Once done, unplugging USB-C CM4 Slave (this will unmount the volumes, and power off the CM4).
Switch Dip-Switch back to
EMMC
.Power on CM4 by providing power to USB-C CM4 Slave port.
To check if it’s booting/working you can either:
- Check there is HDMI output
- Connect via SSH (if set up in rpi-imager, and WiFi is available).
# Configure PX4 to CM4 MAVLink Serial Connection
Note
If you are using Ethernet to connect the FC and RPi, this setup is not needed.
The Pixhawk FC module is internally connected to the RPi CM4 using TELEM2
(/dev/ttyS4
).
The FC and RPi CM4 must both be configured to communicate over this port.
# FC Serial Port Setup
The FC should be set up to connect to the TELEM2
port correctly by default.
If not, you can configure the port using the parameters as shown.
To enable this MAVLink instance on the FC:
Connect a computer running QGroundControl via USB Type C port on the baseboard labeled
FC
-
MAV_1_CONFIG
=102
MAV_1_MODE = 2
SER_TEL2_BAUD
=921600
Reboot the FC.
# RPi Serial Port Setup
On the RPi side:
Connect to the RPi (using WiFi, a router, or a Wifi Dongle).
Enable the RPi serial port by running
RPi-config
- Go to
3 Interface Options
, thenI6 Serial Port
. Then choose:login shell accessible over serial → No
serial port hardware enabled
→Yes
- Go to
Finish, and reboot. (This will add
enable_uart=1
to/boot/config.txt
, and removeconsole=serial0,115200
from/boot/cmdline.txt
Now MAVLink traffic should be available on
/dev/serial0
at a baudrate of 921600.
# Try out MAVSDK-Python
Make sure the CM4 is connected to the internet, e.g. using a wifi, or ethernet.
Install MAVSDK Python:
python3 -m pip install mavsdk
Copy an example from the MAVSDK-Python examples (opens new window).
Change the
system_address="udp://:14540"
tosystem_address="serial:///dev/serial0:921600"
Try out the example. Permission for the serial port should already be available through the
dialout
group.
# Ethernet Connection (Optional)
The flight controller module is internally connected to RPi CM4 from TELEM2
(Serial).
You can also set up a local Ethernet connection between them using the supplied cable. Ethernet connectivity provides a fast, reliable, and flexible communication alternative to using USB or other serial connections.
Note
For more general information see: PX4 Ethernet Setup.
# Connect the Cable
To set up a local ethernet connection between CM4 and the flight computer, the two ethernet ports need to be connected using the provided 8 pin to 4 pin connector.
The pinout of the cable is:
CM4 Eth 8 Pin | FC ETH 4 Pin |
---|---|
A | B |
B | A |
C | D |
D | C |
- | N/A |
- | N/A |
- | N/A |
- | N/A |
# IP Setup on CM4
Since there is no DHCP server active in this configuration, the IP addresses have to be set manually:
First, connect to the CM4 via SSH by connecting to the CM4’s WiFi (or use a Wifi dongle).
Once the ethernet cables are plugged in, the eth0
network interface seems to switch from DOWN to UP.
You can check the status using:
ip address show eth0
You can also try to enable it manually:
sudo ip link set dev eth0 up
It then seems to automatically set a link-local address, for this example it looks like this:
ip address show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 169.254.21.183/16 brd 169.254.255.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::yyyy:yyyy:yyyy:yyyy/64 scope link
valid_lft forever preferred_lft forever
This means the CM4’s ethernet IP is 169.254.21.183.
# IP Setup on FC
Now connect to the NuttX shell (using a console, or the MAVLink shell), and check the status of the link:
ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx at DOWN
inet addr:0.0.0.0 DRaddr:192.168.0.254 Mask:255.255.255.0
For this example, it is DOWN at first.
To set it to UP:
ifup eth0
ifup eth0...OK
Now check the config again:
ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx at UP
inet addr:0.0.0.0 DRaddr:192.168.0.254 Mask:255.255.255.0
However, it doesn’t have an IP yet. Set one that is similar to the one on the RPi CM4:
ifconfig eth0 169.254.21.184
Then check it:
ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx at UP
inet addr:169.254.21.184 DRaddr:169.254.21.1 Mask:255.255.255.0
Now the devices should be able to ping each other.
Note that this configuration is ephemeral and will be lost after a reboot, so we’ll need to find a way to configure it statically.
# Ping Test
First from the CM4:
ping 169.254.21.184
PING 169.254.21.184 (169.254.21.184) 56(84) bytes of data.
64 bytes from 169.254.21.184: icmp_seq=1 ttl=64 time=0.188 ms
64 bytes from 169.254.21.184: icmp_seq=2 ttl=64 time=0.131 ms
64 bytes from 169.254.21.184: icmp_seq=3 ttl=64 time=0.190 ms
64 bytes from 169.254.21.184: icmp_seq=4 ttl=64 time=0.112 ms
^C
--- 169.254.21.184 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3077ms
rtt min/avg/max/mdev = 0.112/0.155/0.190/0.034 ms
Then from the flight controller in NuttShell:
ping 169.254.21.183
PING 169.254.21.183 56 bytes of data
56 bytes from 169.254.21.183: icmp_seq=0 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=1 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=2 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=3 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=4 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=5 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=6 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=7 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=8 time=0 ms
56 bytes from 169.254.21.183: icmp_seq=9 time=0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10010 ms
# MAVLink/MAVSDK Test
For this, we need to set the MAVLink instance to send traffic to the CM4's IP address:
For an initial test we can do:
mavlink start -o 14540 -t 169.254.21.183
This will send MAVLink traffic on UDP to port 14540 (the MAVSDK/MAVROS port) to that IP which means MAVSDK can just listen to any UDP arriving at that default port.
To run a MAVSDK example, install mavsdk via pip, and try out an example from MAVSDK-Python/examples (opens new window).
For instance:
python3 -m pip install mavsdk
wget https://raw.githubusercontent.com/mavlink/MAVSDK-Python/main/examples/tune.py
chmod +x tune.py
./tune.py
# See Also
- Get The Pixhawk Raspberry Pi CM4 Baseboard By Holybro Talking With PX4 (opens new window) (px4.io blog):
- Tutorial showing how to connect Pixhawk 6X + Raspberry Pi on CM4 baseboard via wired Ethernet.