# 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.
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
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)|
# Installing the Flight Controller
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:
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
- 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.
- 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
Connect computer to USB-C CM4 Slave port used to power & flash the RPi.
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
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
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
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
MAV_1_MODE = 2
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
- Go to
3 Interface Options, then
I6 Serial Port. Then choose:
login shell accessible over serial → No
serial port hardware enabled→
- Go to
Finish, and reboot. (This will add
/boot/config.txt, and remove
Now MAVLink traffic should be available on
/dev/serial0at 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).
Try out the example. Permission for the serial port should already be available through the
# Ethernet Connection (Optional)
The flight controller module is internally connected to RPi CM4 from
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.
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|
# 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).
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.