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.