Holybro CM4 + Pixhawk 5X setup troubleshoot thread

I got the CM4 + Pixhawk 6X combo to work.

Below are the steps taken to flash the CM4 part, boot it, and connect it to PX4.

Notes

  • The fan does not indicate if the CM4 is powered/running or not. It seems to always be running.
  • The power module plugged into Power1/2 does not power the Rpi part. You can use the additional cable from the power module to the CM4 Slave USB-C port.
  • The Micro-HDMI port is an output port.
  • Some CM4 might not have wifi device and therefore won’t connect automatically, unless you plug in a compatible wifi dongle into the CM4 Host ports.

Flash EMMC

We need to flash a RPi image onto EMMC.

  1. Switch Dip-Switch to RPI.
  2. Connect computer to USB-C CM4 Slave port used to flash and power the RPi.
  3. 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
  1. You can now install your favorite Linux distro, e.g. Raspberry Pi OS 64bit, using The rpi-imager. Make sure to add wifi and ssh settings (hidden behind the gear/advanced symbol).
sudo apt install rpi-imager
rpi-imager
  1. Once done, unmount the volumes, and power off the CM4 by unpluggin USB-C CM4 Slave.
  2. Switch Dip-Switch back to EMMC.
  3. Power on CM4 by providing power to USB-C CM4 Slave port.
  4. To check if it’s booting/working, either check HDMI output, or connect via ssh (if set up in rpi-imager, and wifi is available).

Connect PX4 to CM4 via serial

Pixhawk 6X talks to CM4 using Telem2 (/dev/ttyS4).

  1. To enable this MAVLink instance, set the params:
  • MAV_1_CONFIG: 102
  • MAV_1_MODE: 2
  • SER_TEL2_BAUD: 921600
  1. reboot the FMU

  2. On the RPi side, I would connect it to Wifi using a Wifi Dongle.

  3. Enable serial port to FMU by using raspi-config: Go to 3 Interface Options, then I6 Serial Port.
    Choose

  • login shell accessible over serial → No
  • serial port hardware enabled → Yes
    Finish, and reboot.
    (This will add enable_uart=1 to /boot/config.txt, and remove console=serial0,115200 from /boot/cmdline.txt
  1. 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:
python3 -m pip install mavsdk
  1. Copy an example from the MAVSDK-Python examples.
  2. Change the system_address="udp://:14540" to system_address="serial:///dev/serial0:921600"
  3. Try out the example. Permission for the serial port should already be available through the dialout group.
2 Likes