Communicating with Raspberry Pi via MAVLink using MavProxy

I’m currently trying to establish MAVLink communication between a Raspberry Pi 4B (running Raspberry Pi OS) and a Pixhawk 2.4.8 using MAVProxy, but I’ve run into issues. Here’s a detailed breakdown of my setup and problems:

Setup:

  1. Raspberry Pi 4 running Raspberry Pi OS.
  2. Installed MAVProxy in a Python virtual environment
python3 -m venv ~/mavproxy_env1
source ~/mavproxy_env1/bin/activate
pip install mavproxy
  1. Connected the Pixhawk to the Raspberry Pi UART(TELEM2) (serial port /dev/serial0) and disabled the login shell via raspi-config.
  2. Configured the Pixhawk using Mission Planner:
  • SERIAL2_PROTOCOL = 2
  • SERIAL2_BAUD = 921
  • Confirmed that /dev/serial0 is present on the Raspberry Pi and connected correctly to the Pixhawk.

ISSUE Link 1 Down" in MAVProxy:

When I successfully start MAVProxy (without sudo), I see the following output:

(mavproxy_env1) aryan@raspberrypi:~/mavproxy_env1 $ mavproxy.py --master=/dev/serial0 --baudrate 921600
Connect /dev/serial0 source_system=255
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from /dev/serial0
MAV> link 1 down

It keeps repeating link 1 down, indicating that no heartbeat is being received from the Pixhawk. ### What could be causing the “link 1 down” issue, and how can I debug it further?

MAVProxy isn’t receiving any data from the Pixhawk. You will want to check the cabling is correct - maybe the RX/TX lines are reversed?

RX and TX of Rpi is connected to TX and RX of telem2 respectively

So I am also trying to get this working with PI4 and arducopter 4.4.x

I have confirmed that the ttyS0 works on a loopback connection.

If I use the UDP connection it works fine

I cannot run
" mavproxy.py --master=/dev/ttyS0 --baudrate=921600"
It says cannot open /ttyS0

If I add sudo (as I do when i start minicom)
then I get “command not found”
If I add the full path I get a python module error.

So i was able to resolve the permission issues with my os to allow for non sudo operation of /ttyS0 for mavproxy.

But I still get the “Link 1 down” Error

I am very close to getting out the scope and testing for actual data output.

Is any one using this method of communication? Can you confirm it works with Mavlink2?

so i can see data with the scope but still no link.

I even tried the use the APsync image for rpannion. Same results.

Voltage level is 15V at telem2 is this normal?

I’m hoping you meant 1.5V?

Ras Pi and most flight controllers uses 3.3V signalling. So 1.5V is not right.

EDIT:
/dev/ttyS0 usually doesn’t correspond to the GPIO UART on the Pi4. Usually it’s /dev/serial0 or /dev/ttyACMx, depending on the configuration in your /boot/config.txt

Yes sorry scope was set to the wrong prob setting, only 1.5v.

So no /dev/serial0 on this device. When I use minicom for a loop back test /dev/ttyS0 is what works to receive characters on the gpio pins.
/dev/tty/AMA0 exists but it gives the same link down error

When I connect the USB cable I get /dev/ttyACM0 and that works.

Tristan

/dev/ttyS0 is not a typically-used port on the Ras Pi, so I’m not sure what configuration you’re running.

  • What OS are you running?
  • Can you post your /boot/config.txt file? That should show how you’ve configured your UARTs
  • Which physical pins are you connecting the flight controller telemetry to on the Pi? Normally people use GPIO14and GPIO15.