Skip to content

Holybro Pixhawk RPi CM4 Baseboard

The Holybro Pixhawk RPi CM4 Baseboard 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.

RPi CM4 with Pixhawk

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 guidelines for mechanical compatibility across vendors.

INFO

The board follows the Pixhawk Connector Standard and Pixhawk Autopilot Bus Standard (including the guidelines for "mechanical compatibility across vendors").

Purchase

  • Holybro Pixhawk RPi CM4 Baseboard (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

Connections & Ports

INFO

The Holybro Documentation 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.

Schematic diagram

RPi CM4 & FC Serial Connection

The flight controller TELEM2 port is internally connected to RPi CM4 as shown:

RPi CM4FC TELEM2 (FMU)
GPIO14TXD
GPIO15RXD
GPIO16CTS
GPIO17RTS

INFO

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.

Image showing separate baseboard, baseboard cover, RPi, Flight controller, screws

To install the Raspberry Pi CM4 companion computer:

  1. Disconnect the FAN wiring.

    HB_Pixhawk_CM4_Fan

  2. Remove these 4 screws on the back side of the baseboard.

    Bottom of the board showing screws in corners holding the cover

  3. Remove the baseboard case, install the CM4, and use the 4 screws to attach it (as shown):

    HB_Pixhawk_CM4_Screws

  4. 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 or POWER2 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.

Image showing writing from the PM03D power module to the baseboard

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.

  1. Switch Dip-Switch to RPI.

  2. Connect computer to USB-C CM4 Slave port used to power & flash the RPi.

  3. Get usbboot, build it and run it.

    sh
    sudo apt install libusb-1.0-0-dev
    git clone --depth=1 https://github.com/raspberrypi/usbboot
    cd usbboot
    make
    sudo ./rpiboot
  4. 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).

    sh
    sudo apt install rpi-imager
    rpi-imager
  5. Once done, unplugging USB-C CM4 Slave (this will unmount the volumes, and power off the CM4).

  6. Switch Dip-Switch back to EMMC.

  7. Power on CM4 by providing power to USB-C CM4 Slave port.

  8. 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).

INFO

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:

  1. Connect a computer running QGroundControl via USB Type C port on the baseboard labeled FC

    Image of baseboard showing FC USB-C connector

  2. Set the parameters:

    • MAV_1_CONFIG = 102
    • MAV_1_MODE = 2
    • SER_TEL2_BAUD = 921600
  3. Reboot the FC.

RPi Serial Port Setup

On the RPi side:

  1. Connect to the RPi (using WiFi, a router, or a Wifi Dongle).

  2. Enable the RPi serial port by running RPi-config

    • Go to 3 Interface Options, then I6 Serial Port. Then choose:
      • login shell accessible over serial → No
      • serial port hardware enabledYes
  3. Finish, and reboot. (This will add enable_uart=1 to /boot/config.txt, and remove console=serial0,115200 from /boot/cmdline.txt

  4. Now MAVLink traffic should be available on /dev/serial0 at a baudrate of 921600.

Try out MAVSDK-Python

  1. Make sure the CM4 is connected to the internet, e.g. using a wifi, or ethernet.

  2. Install MAVSDK Python:

    sh
    python3 -m pip install mavsdk
  3. Copy an example from the MAVSDK-Python examples.

  4. Change the system_address="udp://:14540" to system_address="serial:///dev/serial0:921600"

  5. 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.

INFO

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.

HB_Pixhawk_CM4_Ethernet_Cable

The pinout of the cable is:

CM4 Eth 8 PinFC ETH 4 Pin
AB
BA
CD
DC
-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:

sh
ip address show eth0

You can also try to enable it manually:

sh
sudo ip link set dev eth0 up

It then seems to automatically set a link-local address, for this example it looks like this:

sh
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:

sh
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:

sh
ifup eth0

ifup eth0...OK

Now check the config again:

sh
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:

sh
ifconfig eth0 169.254.21.184

Then check it:

sh
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:

sh
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:

sh
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

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:

sh
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.

For instance:

sh
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