Mavlink + Pixhawk 4 mini + Raspberry pi zero w

I am trying to stablish a mavlink connection between a Raspberry pi zero w and a Pixhawk 4 mini wuth ardupilot (copter 4.0.3).

I want to do that through the telem port or the uart from the pixhawk. And the raspberry would be connected through the gpio ports (pin 8 and pin 10).

I have configured both Serial 1 and Serial 2 to mavlink 2 and 57600 baudrate with missionplanner. I have also tried with 921600 and different baurates.

I followed this steps:
https://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html
And this one for installing mavproxy:
https://ardupilot.org/mavproxy/docs/getting_started/download_and_installation.html#mavproxy-downloadinstalllinux

I have tried with python 2 as well as python 3.
Also i have tried with different raspbian firmwares (with apsync, ubuntu, headless, with desktop…)

I have activated uart in "/boot/confiig.txt ", deactivated bluetooth with “dtoverlay=pi3-disable-bt”.

I have done multiple things but i still get “link 1 down” when trying to execute “mavproxy.py --master=/dev/serial0 --baurate 57600 --aircraft Develop”

I don’t know what else to do.
Any help would be awesome.

Thank you in advance!

Edited:

/boot/cmdline.txt

console=tty1 root=PARTUUID=9382b0b4-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

I have tested the gpio ports of the raspberry with this python script and they work succesfully (one sends bytes and the other receives them ok)

`
#!/usr/bin/env python

# Serial port testing

import serial

test_string = "Testing 1 2 3 4"

port_list = ["/dev/serial0", "/dev/serial0", "/dev/ttyS0", "/dev/ttyS0",]

for port in port_list:

try:
    serialPort = serial.Serial(port, 115200, timeout = 2)
    print "Opened port", port, "for testing:"
    bytes_sent = serialPort.write(test_string)
    print "Sent", bytes_sent, "bytes"
    loopback = serialPort.read(bytes_sent)
    if loopback == test_string:
        print "Received", len(loopback), "valid bytes, Serial port", port, "working \n"
    else:
        print "Received incorrect data", loopback, "over Serial port", port, "loopback\n"
    serialPort.close()
except IOError:
    print "Failed at", port, "\n"`

So maybe the problem is the pixhawk, but i have already configured serial 2 to mavlink 2 and baudrate to 57600.

Hi,

Have you disabled the serial console in /cmd/cmdline.txt ?
There is probably a line like this: console=serial0,115200

Thank you for your answer.

Yes, i have also erased that, but nothing changed.

Ok,

First I would recommend to connect TX with RX in the raspberry and open screen, with screen /dev/your_serial_device.
If you start to write something, you’ll see what you are sending, since TX → RX, this will work as a echo.
If it does not work, probably you are using the wrong serial device or something is wrong in your configuration.

If does work, try to swap the pixhawk RX / TX with the Raspberry, since sometimes RX can be ‘connect RX here’ or ‘this is RX connect TX’ and the same thing applies to TX.

I would also recommend to test the pixhawk with a serial usb adapter just to make sure.

the screen echo worked perfect. Is the same i did with the python script.
Swaping the TX / RX did not work.

I will have to test the uart for the pixhawk.
This is what i changed in missionplanner

I recommend to use QGC since we don’t provide support for missionplanner.
Remember to do the necessary network configuration in the connection menu, check the comm links menu: Application Settings · QGroundControl User Guide