Home        Store        Docs        Blog

Pixhawk Connection to Companion RasPi: other than USB?


#1

Hi,

Is there a means to connect the pixhawk to a companion RasPi other than USB?

I am under severe space constraints in my enclosure and IIRC there is a way to use the RX/TX pins of the serial port of the RasPi directly.

Can one do this without breaking the BlueRobotics copanion image for the RasPi?


(Patrick José Pereira) #2

Hi,

Yes, you can use the raspberry (with the companion image) RX and TX pins to communicate with the pixhawk, it’s just necessary to configure http://192.168.1.195:2770/mavproxy, and change the master line from: --master=/dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00,115200 to something like: --master=/dev/ttyS0,115200.
It’s also necessary to enable the serial driver, to do that, you’ll need to connect via ssh or with the browser terminal (http://192.168.2.2:8088/) and add enable_uart=1 at the end of /boot/config.txt file.


#3

…thank you for your input, have it running now :slight_smile:

Only additional thing I had to do was changing the baud rate of SERIAL2_BAUD to 115200 (was 57600) and activating the serial port of the RasPi with “sudo raspi-config”.

This spares me some room, thanks again…!


#4

The connection works in principle, but it is at some point lagging considerably compared to the USB variant.

I checked the SR1_* and SR2_* parameters of the default BlueROV settings and they are all set to zero, the SR0_* are set to values between 2 and 10.

Does it help to copy these values over to the other serial port I am using?


#5

…ok, disregard that solution, found out the stream rate is negotiated between GS and AP automatically for the port actually used.

Question remains why the communication is lagging. Interestingly the update on the graphical compass and artificial horizon are quite snappy, but e.g. simply arming takes seconds and sometimes times out.

Does anybody know of a good way to log or debug this?


(Rusty) #6

Hi @WaldoPepper, it sounds like the serial baud rate may be a bit too slow to handle everything that is coming through right now. The send rates for the compass and horizon are very fast and even if you miss a few, it will still be snappy. The arm commands are only sent once and if that drops, they will be missed.

What serial rate is the port set to operate at on the Pixhawk?

-Rusty


#7

Hi Rusty,

it’s set to 115200, same as the USB before…


(Jacob) #8

@WaldoPepper To debug, you can open the mavproxy console in the raspberry pi with screen -r mavproxy. Then you can watch messagename to see messages passed back and forth from gcs and autopilot as mavproxy processes them.

Try watch heartbeat and watch manual_control.