Quick Answer
Yes, you can run PX4 over Ethernet between a Pixhawk-class flight controller and a Raspberry Pi CM4 companion computer. The core steps are: set static IPs on both sides, confirm two-way ping, configure PX4 netman and MAVLink UDP ports, then connect from QGroundControl or MAVSDK. If you follow the order below, setup is straightforward and reliable.
What this setup is for
A CM4 companion computer gives your aircraft extra compute for tasks like vision, autonomy logic, logging, and custom apps, while PX4 on the flight controller keeps real-time control. Ethernet gives a stable, high-bandwidth link between them compared with many serial setups.
The practical goal is simple: make PX4 and the CM4 visible on the same subnet, then stream MAVLink over UDP. If that part is clean, most higher-level integrations become much easier to debug and maintain.
Step 1: Physical wiring and network plan
Use the correct Ethernet interconnect for your baseboard and confirm link status on both devices before touching software. Plan static addresses first so troubleshooting stays predictable. A common pattern is:
| Device | Example IP | Notes |
|---|---|---|
| Pixhawk/PX4 side | 192.168.0.4 | Configured in /fs/microsd/net.cfg
|
| CM4 side | 192.168.0.3 | Set on eth0
|
| Ground station PC (optional) | 192.168.0.1 | Same subnet if directly testing |
If your link does not come up, fix cabling and interface state first. Do not skip this, software changes cannot repair bad physical link state.
Step 2: Configure PX4 networking with netman
PX4 reads Ethernet settings from /fs/microsd/net.cfg. In QGroundControl, open Analyze Tools → MAVLink Console and inspect current config with netman show. If needed, write a clean config:
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.4
NETMASK=255.255.255.0
ROUTER=192.168.0.254
DNS=192.168.0.254
Apply with netman update -i eth0. PX4 will reboot with the new network settings.
Step 3: Configure CM4 and verify two-way connectivity
On the CM4, ensure eth0 is up and set an address in the same subnet. Then test both directions:
CM4 → PX4: ping 192.168.0.4
PX4 → CM4 (from MAVLink Console): ping 192.168.0.3
Only continue when both directions pass with low packet loss. This is the single most important checkpoint in the whole process.
Step 4: Publish MAVLink over Ethernet
Now configure MAVLink on PX4 for UDP transport. Typical patterns:
| Use case | UDP port | Profile |
|---|---|---|
| Ground station (QGC) | 14550 | GCS message set |
| Companion apps (MAVSDK/MAVROS) | 14540 | Onboard preferred |
For a quick test, you can start a stream to the companion target and confirm packets are arriving. In parameter-based setups, ensure the MAV_2 values align with your intended remote and local ports.
Step 5: Validate in QGroundControl and MAVSDK
QGroundControl often auto-discovers once broadcast and ports are right. If not, add a manual UDP link to the flight controller IP and correct port. On CM4, a small MAVSDK-Python script is an easy smoke test for telemetry and command path.
At this point you have a solid foundation for offboard logic, mission tools, and companion-side autonomy workflows.
Recommended hardware and further reading
If you are selecting parts, start in Autopilots / Flight Controllers. For robust PX4-capable controller options, see CubePilot Cube Orange+ Mini Set and MicoAir743Lite H743 Flight Controller. For cleaner mounting on Pixhawk-class stacks, 3M Pixhawk soft-mount foam is useful.
For deeper background, these guides pair well with this setup: Pixhawk 6 vs 6C vs 6X vs Mini, What is Pixhawk and why builders use it, and How to set up ArduPilot on your flight controller.
FAQ
Q: Do I need DHCP for PX4 and CM4 Ethernet?
A: No. Static addressing is usually easier and more reliable for bench and field integration, especially during early setup.
Q: Should I use port 14550 or 14540?
A: Use 14550 mainly for ground station workflows. Use 14540 for companion-computer consumers such as MAVSDK or MAVROS.
Q: What is the most common setup failure?
A: Mismatched subnet or wrong target port. Verify link state, IP plan, and two-way ping before changing MAVLink parameters again.