Servers by jDrones

Suggested corrections for companion compuer documentation

Hello, I would like to point out one error and one possible addition for the documentation on connecting a Raspberry Pi companion to a pixhawk:

http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html

I am connecting a Pixhawk 2 (Cube by ProfiCNC & Hex) to a Raspberry Pi 3.

Now, in the current documentation, it says:

SERIAL2_BAUD = 921 so the Pixhawk can communicate with the RPi at 921600 baud.

Then, further down to test the connection:

mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter

This is an error. Trying to connect at 57600 when the Pixhawk has been set to 921600 results in garbage characters, e.g.:

MAV> Waiting for heartbeat from /dev/ttyS0
0 0 cXAc?Vx\opz &g[{P@|x_f%O*rND

So, the obvious thing is to change either the top or the bottom to the same baud rate. I am not sure which would be preferable but the current instructions are wrong.

Another small thing to note is the Note in that same section that reads:

On newer versions of Raspberry Pi 3 the uart serial connection may be disable by default. In order to enable serial connection on the Raspberry Pi edit /boot/config.txt and set enable_uart=1. the build-in serial port is /dev/ttyS0.

It should perhaps be be pointed out that the serial port in the mavproxy command is not necessarily /dev/ttyAMA0 but might also be /dev/ttyS0.

So, in my case (again, RPi 3 talking to Pixhawk 2), the command becomes:

mavproxy.py --master=/dev/ttyS0 --baudrate 921600 --aircraft MyCopter

Perhaps my second point is too obvious but the first one is definitely an error and needs to be corrected one way (both 57600) or another (both 921600).

1 Like

Hello,

Please read this :
https://discuss.ardupilot.org/t/mavlink-step-by-step/9629

Thank you very much, this is a great writeup and I just bookmarked it.

However, my point still stands, trying to call mavproxy with 57600 baudrate when the Pixhawk has been set up for 921600 fails. To make it work, the two baudrates have to match.

Thank you very much, this is a great writeup and I just bookmarked it.

However, my point still stands, trying to call mavproxy with 57600 baudrate
when the Pixhawk has been set up for 921600 fails. To make it work, the two
baudrates have to match.

Good find!

There’s an “Edit on GitHub” link in the top-rhs of each of the pages; you
can make corrections yourelf; it will create a Pull Request which someone
will review and then pull in.

Could you make those adjustments for us?

I could try but my problem is that I do not know what the best solution would be. I ended up using 921600 but I have no idea if that is ideal, after all, why is 57600 used everywhere else in the page? Perhaps 57600 is a good compromise to avoid errors (especially since we are only Rx / Tx pins)? Ideally, this should be checked by someone who knows about the tradeoffs of different baud rates.

I could try but my problem is that I do not know what the best solution
would be. I ended up using 921600 but I have no idea if that is ideal, after
all, why is 57600 used everywhere else in the page? Perhaps 57600 is a good
compromise to avoid errors (especially since we are only Rx / Tx pins)?
Ideally, this should be checked by someone who knows about the tradeoffs of
different baud rates.

Yep - that’s part of the review process :slight_smile: Or should be…

You might check the APSync pages for a second opinion; I think you’ll find
they’re pretty consistent about 921,600

Cool, one more question, in Github do I “fork and edit”?

13-Oct-217:
Hello: Just an update. I am able to connect RPI3 B to Pixhawk1. Following are little deviation from wiki. I am using Raspbian and NOT Apsync (offcourse that would be the next…)

1/ MP–>SERIAL2_BAUD=57 (I set it 921 as per wiki, but not working)
2/ RPI3–>/boot/config.txt --> enable_uart=1 (This line was missing so I append it and reboot Pi)
3/ mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter (Any parameter other than this is not working for me. attached logs)logs_settingup_rpi3_mavproxy.txt (54.5 KB)

NOTE: I wish I could have update the wiki but time is only limitation for me. Thanks peter and everyone.

Man thankyou so much!! I was stuck at this same connection problem for a long time, now i can connect to the apsync at raspberry pi 3.

Servers by jDrones