I’ve been trying to set up a connection between my Pixhawk 4 (configured with the latest PX4 version, 1.16.0) and RPi 4 (running Ubuntu 22.04 and ROS2 Humble) using UART. I’ve done the wiring as explained in the official documentation (Raspberry Pi Companion with Pixhawk | PX4 Guide (main)), but I cannot seem to establish a connection between the two.
I’ve tried MAVLink communication over UART (sudo mavproxy.py --master=/dev/serial0 --baudrate 57600), to verify the connection, with the following settings:
MAV_1_CONFIG = TELEM2
UXRCE_DDS_CFG = 0 (Disabled)
SER_TEL2_BAUD = 57600
This yields the following output:
sudo mavproxy.py --master=/dev/serial0 --baudrate 57600 Connect /dev/serial0 source_system=255 Log Directory: Telemetry log: mav.tlog Waiting for heartbeat from /dev/serial0 MAV> link 1 down
I have also tried connecting with uXRCE-DDS (installed on my RPi), which is my ultimate goal, with the settings as follows:
MAV_1_CONFIG = 0 (Disabled)
UXRCE_DDS_CFG = 102 (TELEM2)
SER_TEL2_BAUD = 921600
On the pixhawk’s side (MAVLink console in QGC) the client says it’s running but disconnected. Running the agent (sudo MicroXRCEAgent serial --dev /dev/serial0 -b 921600 -v6) leads to the following output, and does not establish a working connection:
sudo MicroXRCEAgent serial --dev /dev/serial0 -b 921600
[1761061750.978626] info | TermiosAgentLinux.cpp | init | running… | fd: 3
[1761061750.996316] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
I tried connecting with a USB-to-serial adapter (CH340), plugging it into my RPi’s USB port and (after verifying the device name & correct port) running:
sudo mavproxy.py --master=/dev/ttyUSB0 --baudrate 57600
This still does not establish a MAVLink connection. I have previously also tried to do this with uXRCE-DDS, also with no success. In fact, I can’t even see any sign of data coming through with “sudo screen /dev/ttyUSB0 57600”.
Regarding my FCU, I have a Pixhawk 4 running PX4 v1.15.0 (downloaded from the official github - px4_fmu-v5_default). I have also tried flashing the most recent version through QGC (1.16.0), which also did not work.
To configure my UART connection, I’ve followed the official guide (Raspberry Pi Companion with Pixhawk | PX4 Guide (main)). The Pixhawk is powered via USB by my laptop and has its TX, RX and GND pins connected to the corresponding pins on the RPi.
Any help would be greatly appreciated!