Servers by jDrones

RPI3 to Pixhawk...baudrate issue?

This is the gist of what I have done so far:

MISSION PLANNER SETUP
SERIAL2_PROTOCOL = 1 (enables MAVLink on the serial port)
SERIAL2_BAUD = 921 can communicate with RPI at 921600 baud
LOG_BACKEND_TYPE = 3 (if you are using APSync to stream the dataflash log files to the RPi)

PI SETUP
Install Raspbian Jesse
Change username and password
Setup network
Activate SSH and VNC
Activate camera
Disable OS control of serial port either through GUI or command line
sudo raspi-config
"Advanced Options - > Serial" Disable OS use of the serial connection, reboot Pi.

sudo apt-get update
sudo apt-get install screen python-wxgtk2.8 python-matplotlib python-opencv python-pip python-numpy python-dev libxml2-dev libxslt-dev
sudo pip install pymavlink
sudo pip install mavproxy

Edit “sudo nano /boot/config.txt” to change “set enable_uart=0” to “set enable_uart=1” (locks core freq which keeps the baud rate the same)
Also add dtoverlay=pi3-disable-bt
Reboot “sudo reboot”

sudo -s
mavproxy.py --master=/dev/serial0 --baudrate 57600 --aircraft MyBoat

I based it off of the guide:
http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html
As well as watching this youtube video:
https://www.youtube.com/watch?v=DGAB34fJQFc

I have wired the GND, TX, RX from the Pi to the Telem2 port on the Pixhawk. USB power fed to the Pi.

Now when I run the last line of code:

sudo -s
mavproxy.py --master=/dev/serial0 --baudrate 57600 --aircraft MyBoat

I get a connection, but just a mess of text, symbols and numbers when waiting for a heartbeat. So my inclination is the baudrate? However the tutorial states that SERIAL2_BAUD = 921 (communicate with the RPi at 921600 baud) and the code in pi is calling up a baudrate of 57600? I have changed the SERIAL2_BAUD to 57600 but still no change in output. Any idea?

Yes the baud rates have match. I think you might have to reboot your pixhawk to activate the new baud rate.

Yup, turn it back off and back on again did the trick. lol.

Thanks for the quick reply! :smiley:

Edit: is it preferable to run at the 57600 rate or the 921600 rate? Or would there be any noticeable difference?

Set BRD_SER2_RTSCTS to false as your link to the raspberry doesn’t have hardware flow control. Yes the baud can help depending on what you’re doing - at that very high rate you might get problems. You could try slightly lower like 500. I think a lot of people use 115. Good luck!

Set to “0” then correct? Sorry I’m new to all of this, this is a project I actually got started about 3 weeks ago and plan on having a functioning boat for the spring. :smiley:

Servers by jDrones