Holybro
Holybro ShopPX4 GuideArdupilot WikiContact Us
  • Welcome
  • Flight Controller
    • Pixhawk 6X
      • Overview
      • Technical Specification
      • Sample Wiring Diagram
      • Pixhawk Baseboards
      • Dimensions
        • Rev 8 (Current)
        • Rev 3 & 4
      • PX4 & Ardupilot Guide
      • Supported Firmware
      • Using Analog PM
      • Pixhawk Autopilot FMUv6X Standard
      • Download
    • Pixhawk 6X Pro
      • Overview
      • Technical Specification
      • Sample Wiring Diagram
      • Pixhawk Baseboards
      • Dimensions
      • PX4 & Ardupilot Guide
      • Supported Firmware
      • Using Analog PM
      • Pixhawk Autopilot FMUv6X Standard
      • Download
    • Pixhawk Baseboards
      • Pixhawk Baseboard v1 Ports
      • Pixhawk Baseboard v2 Ports
        • PWM Signal Voltage MOD
      • Pixhawk Baseboard V2 Mounting Plate Dimensions
      • Pixhawk Mini Baseboard Ports
      • Pixhawk Jetson Baseboard
        • Overview & Specification
        • Ports Pinout
        • Wiring & Block Diagram
        • Dimension & Weight
        • Flashing guide
        • CAN setup
        • CSI Camera setup
        • MAVLINK Bridge
        • Reference Links
      • Pixhawk RPi CM4 Baseboard
        • Overview
        • Connections & Ports
        • RPi CM4 Flash Guide
        • Dimension
        • Ethernet Connection
        • PM03D - RPi CM4 Base Wiring Guide
        • Installation of RPi CM4
        • Supported Firmware
      • Baseboard Changelog
      • Download
    • Pixhawk 6C
      • Overview
      • Technical Specification
      • Pixhawk 6C Ports
      • Sample Wiring Diagram
      • Dimensions
      • System Diagram & Pinout
      • PX4 & Ardupilot Guide
      • PWM Signal Voltage MOD
      • Supported Firmware
      • Download
    • Pixhawk 6C Mini
      • Overview
      • Technical Specification
      • Pixhawk 6C Mini Ports
      • Dimensions
      • System Diagram & Pinout
      • PWM Signal Voltage MOD
      • Supported Firmware
      • Pixhawk 6C Mini Difference
      • Download
    • Pix32 v6
      • Overview
      • Technical Specification
      • Pix32 v6 Baseboard Ports
      • Pix32 v6 Mini-Base Ports
      • Dimensions
      • System Diagram & Pinout
      • Supported Firmware
      • Download
    • Durandal
      • Overview & Technical Specification
      • Dimensions
      • Durandal Pinout
      • Supported Firmware
    • Kakute H7 (v1/v2/Mini)
      • Kakute H7 v1
        • Overview
        • Wiring Diagram
        • Pinout
        • Supported Firmware
      • Kakute H7 v2
        • Overview
        • Wiring Diagram
        • Pinout
        • Supported Firmware
          • INAV VTX+ & Bluetooth Setup
      • Kakute H7 Mini
        • Overview
        • Sample Wiring Diagram
        • Pinout
        • Supported Firmware
      • Kakute H7 Version Difference
      • Download
    • Kakute H743-Wing
      • Overview
      • Pinout
      • Sample Wiring Diagram
      • Power Monitor & Scale
      • Camera & ON/OFF Pit Switch
      • Ardupilot Mapping
      • Ardupilot Wiki
      • INAV Mapping
      • Supported Firmware
    • Kakute F405 Wing Mini
      • Overview
      • Pinout
      • Sample Wiring Diagram
      • Power Monitor & Scale
      • Supported Firmware
    • Autopilot Comparison
  • GPS & RTK System
    • H-RTK NEO-F9P Series (RM3100 Compass)
      • Overview
      • Specification
      • NEO-F9P Module Pinout
      • NEO-F9P Rover Pinout
      • Dimensions
      • Downloads
      • Setup & Getting Started
      • Firmware Upgrade
      • GPS Heading/Yaw (aka Moving Baseline)
      • Setup guide for Multiple Aircraft
      • Portable RTK Base Station Setup
      • CAN Termination Resistance Software Toggle
    • H-RTK ZED-F9P Series (RM3100 Compass)
      • Overview
      • Specification
      • Dimension
      • Pinout
      • Download
      • Setup & Getting Started (Ardupilot)
      • Setup & Getting Started (PX4)
      • Using with Cube Autopilot
      • u-blox F9P Firmware Upgrade
      • DroneCAN FW Upgrade
      • GPS Heading/Yaw (aka Moving Baseline)
      • Setup guide for Multiple Aircraft
      • Portable RTK Base Station Setup
      • Galileo OSNMA Support
      • Changelog
      • CAN Termination Resistance Software Toggle
    • H-RTK ZED-F9P Series (IST8310/BMM150 Compass)
      • DroneCAN F9P
        • Overview
        • Specification
        • Pinout
        • Dimension
        • Setup & Getting Started
        • DroneCAN FW Upgrade
        • Download
        • CAN Termination Resistance Software Toggle
      • Standard F9P (UART)
        • Overview
        • F9P Rover Lite
        • F9P Helical
        • F9P Base
        • H-RTK with Cube Autopilot
        • Specification & Comparison
        • Setup & Getting Started
        • Dimension
        • Pinout
        • Download
      • u-blox F9P Firmware Upgrade
      • GPS Heading/Yaw (aka Moving Baseline)
      • Setup guide for Multiple Aircraft
      • Ardupilot IST8310 Compass Orientation
      • Portable RTK Base Station Setup
      • Galileo OSNMA Support
    • H-RTK Unicore UM982
      • Overview
      • Specification
      • Pinout
      • Dimension
      • LED Indicator
      • Setup & Getting Started (Ardupilot)
      • Setup & Getting Started (PX4)
      • Advanced Application (Unicore Uprecise)
      • Factory Setting and COM Port Allocation
      • Firmware Support
      • Download
    • H-RTK mosaic-H
      • Overview & Specification
      • Setup & Getting Started (Ardupilot)
      • Setup & Getting Started (PX4)
      • Pinout
      • Dimension
      • Advanced Application
      • GPS LED Meaning
      • Septentrio PPK application
      • Septentrio receiver control and analysis software
      • Supported Firmware
      • Download
    • M8N/M9N/M10 GPS
      • Standard M10/M9N/M8N GPS
        • Overview
        • Pinout
        • Dimension
        • Download
      • Micro M10/M9N GPS
        • Overview
        • Pinout
        • Dimension
        • Download
      • DroneCAN M9N/M8N
        • Overview
        • Pinout
        • Dimension
        • DroneCAN GPS Setup Guide
        • DroneCAN FW Upgrade
        • CAN Termination Resistance Software Toggle
        • About DroneCAN
        • Downloads
      • Ardupilot IST8310 Compass Orientation
      • Downloads
    • GPS LED & Buzzer
      • GPS LED & Buzzer Meaning
      • Status LED Changes
  • Peripherals
    • DLVR Airspeed (DroneCAN)
      • Overview
      • Quick Start Guide
      • CAN Termination Resistance Software Toggle
      • Download
    • MS4525DO & MS5525DSO I2C Airspeed Sensor
    • RM3100 Compass (DroneCAN)
      • RM3100 Setup Guide
      • CAN Termination Resistance Software Toggle
    • H-Flow (DroneCAN)
      • Overview
      • Setup Guide
      • Firmware
      • Dimensions
      • Pinout
      • CAN Termination Resistance Software Toggle
      • Downloads
  • PMW3901 Optical Flow Sensor
  • CAN Termination Resistance Software Toggle
  • Radio
    • Remote ID
      • Overview & Spec
      • Setup & Configuration
      • Pinout
      • Firmware Support
      • Firmware Update
      • Download
    • SiK Telemetry Radio V3
      • LED and Connection
      • Multiple Point to Point Setup with Sik Radio
        • Downloads
    • Microhard Radio
      • Overview
      • Specification
      • Ports & Buttons
      • Status LED
      • Default Setting
      • Pinout
      • Dimension
      • Enabling RTS / CTS Flow Control
      • Point-to-Multipoint Setup with Microhard Radio
      • Download
    • XBP9X Radio
      • Specification
      • Power
      • Status LEDs
      • Antenna
      • Pinout
      • Dimension
      • Point-to-Multipoint Setup with XBee Radio
      • Download
  • Drone Development Kit
    • X650 Development Kit
      • NeoPixel WS2812 LED Setup Instruction
      • Download
    • PX4 Development Kit - X500v2
      • Getting Started Build Guide
      • Download
    • PX4 Vision Dev Kit v1.5
      • Overview
      • Wiring Diagram
      • v1 & v1.5 Difference
      • Up-Core Carrier Board Pinout
      • PX4 User Guide
      • Downloads
    • S500 Frame Kit
  • Power Module & PDB
    • Power Module
      • DroneCAN Power Module Setup
      • Analog Power Module Setup
      • Digital Power Module (PM) Setup
      • PM07 Quick Start Guide
      • Using Analog PM with Pixhawk 5X/6X
      • Connector & Wire Rating
      • Download
    • Power Module Comparison
  • UBEC
  • ESC
    • ESC Current Sensor Scale
    • AM32 ESC - Reverse Motor Direction Instruction
    • How To Flash AM32 Firmware To HOLYBRO BLHeli ESCs
  • ESC 3D File Downloads
  • Company
    • About Us
    • Holybro Logo
    • Certification (ISO, FCC, CE, RoHS, etc):
    • User Manuals
      • Kakute Flight Controller
      • ESC
      • Kopis
      • Autopilot Flight Controller
      • Drone Dev Kit
      • Other
Powered by GitBook

© 2024 Holybro. All rights reserved.

On this page
  • Flash EMMC
  • Connect PX4 to CM4 via serial
  • Try out MAVSDK-Python

Was this helpful?

Export as PDF
  1. Flight Controller
  2. Pixhawk Baseboards
  3. Pixhawk RPi CM4 Baseboard

RPi CM4 Flash Guide

Steps taken to flash the CM4 board, boot it, and connect it to PX4

Please Note:

  • If you are using PX4, you will need to use PX4 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.

  • Some RPi CM4 might not have a Wifi device and therefore won’t connect automatically unless you plug it into a router or a compatible Wifi dongle into the CM4 Host ports.

This Pixhawk RPi baseboard supports Raspberry Pi CM4 and CM5. The CM5 requires more power, and the USB-C port used for flashing also powers the Pi. If your computer doesn’t provide enough power, use a powered USB hub for reliable flashing operation.

Flash EMMC

First, we need to have the CM4 up and running. We need to prepare the hardware for it first. Considering the fact that you have already mounted your CM4 onto the baseboard do the following to be able to flash any required image on RPi CM4:

  1. Switch the Dip-Switch on Holybro Pixhawk 6X+CM4 base board (located on top of UART&I2C port) to RPi

  2. Connect the baseboard to your desktop computer USB-C CM4 Slave port used power & flash the RPi CM4. There may be a prompt on some systems like macOS to allow the connection. Please allow it! Otherwise, where to connect? 😀

  3. You need to use usbboot:

Linux / Cygwin / WSL

Clone this repository on your Pi or other Linux machine. Make sure that the system date is set correctly, otherwise, Git may produce an error.

This git repository uses symlinks. For Windows builds clone the repository under Cygwin:

sudo apt install libusb-1.0-0-dev
git clone --depth=1 https://github.com/raspberrypi/usbboot,
cd usbboot
make
sudo ./rpiboot

Note: sudo isn't required if you have write permissions for the /dev/bus/usb device.

macOS

From a macOS machine, you can also run usbboot, just follow the same steps:

  1. Clone the usbboot repository

  2. Install libusb (brew install libusb)

  3. Install pkg-config (brew install pkg-config)

  4. (Optional) Export the PKG_CONFIG_PATH so that it includes the directory enclosing libusb-1.0.pc

  5. Build using make

  6. Run the binary

$ git clone --depth=1 https://github.com/raspberrypi/usbboot
$ cd usbboot
$ brew install libusb
$ brew install pkg-config
$ make
$ sudo ./rpiboot

If the build is unable to find the header file libusb.h then most likely the PKG_CONFIG_PATH is not set properly. This should be set via export PKG_CONFIG_PATH="$(brew --prefix libusb)/lib/pkgconfig".

If the build fails on an ARM-based Mac with a linker error such as ld: warning: ignoring file /usr/local/Cellar/libusb/1.0.26/lib/libusb-1.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 then you may need to build and install libusb-1.0 yourself:

$ wget https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2
$ tar -xf libusb-1.0.26.tar.bz2
$ cd libusb-1.0.26
$ ./configure
$ make
$ make check
$ sudo make install

Running “make” again should now succeed!

After running rpiboot the below screen from your terminal should say that you are good to go for flashing a new image onto your CM4 board.

Note: if there are any pop-ups after this stage to eject an unknown disk, simply ignore them.

  • 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 down the CM4 by unplugging the USB-C CM4 Slave.

  2. Switch Dip-Switch back to EMMC.

  3. Power on CM4 by providing power to the 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: TELEM2 - MAV_1_MODE: Onboard - SER_TEL2_BAUD: 921600 8N1

  2. reboot the FMU

  3. On the RPi side, you can connect it to Wifi using a router or a Wifi Dongle.

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

  5. Now MAVLink traffic should be available on /dev/serial0 at a baud rate 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. Change the system_address="udp://:14540" to system_address="serial:///dev/serial0:921600"

  2. Try out the example. Permission for the serial port should already be available through the dialout group.

You can also use your own power supply to power the RPi CM4 baseboard.

PreviousConnections & PortsNextDimension

Last updated 3 months ago

Was this helpful?

Copy an example from the .

MAVSDK-Python examples
RPiboot sanity check