Garbage/noise characters being generated over direct serial connection

I am running MAVProxy on a companion computer with a -out relay to communicate with some processes on the CC.

I’m using a Cube Black and I’ve tried it with a Pi3 over USB and a TX1 over UART. In both cases, I get garbage characters appearing whenever I send MAVLink commands relayed through MAVProxy. For example, here I am sending a baro calibration request:

TLWD=xi=B\`=|D<1 3bomAM">o!<ZYy!,\xANB`e=po<0}zsIn:;Geh*[
#H8K>:=Z X4t6?.?L=' 2<^[4_JL7="=RAPM: Calibrating barometer
APM: Barometer calibration complete
Got MAVLink msg: COMMAND_ACK {command : 241, result : 0}

The garbage appears less often at lower baudrates. I might expect some noise when connected over radio, but a direct serial or USB connection shouldn’t do this. In fact, some of the garbage chunks contain legible pieces such as garbled parameter names, so it’s not just random noise. I’m guessing that mavlink messages are somehow colliding, but I’m not sure what I did wrong. Any hints?

I had similar issue, i found this:

Frequently Asked Questions and Issues

I have random “noise” displaying on the console, showing as corrupted text. How do I remove it?

MAVProxy will, by default, show corrupted packets. To disable showing them, use set shownoise false in the MAVProxy console.

Yeah, I found that also, but turning off the displaying of noise doesn’t solve the issue. Usually, the noise is from corrupt radio telemetry packets, but in my case, I’m using a direct serial or USB connection which shouldn’t have so much corruption.

I ran MAVProxy with the --show-errors option. I got a lot of these errors:

MAV error: BAD_DATA {invalid MAVLink CRC in msgID 22 0x6c88 should be 0x42a8, data:['fe', '19', '33', '1', '1', '16', '33', '33', 'ab', '41', '15', '3', 'ff', 'fe', '1e', '34', '1', '1', '18', '80', '20', '33', '93', '2', '0', '0', '0', '41', '7d', '5c', '16', '88', '6c']}
MAV error: BAD_DATA {Bad prefix, data:['41']}
MAV error: BAD_DATA {Bad prefix, data:['b7']}

What could cause crc errors? These errors appear regularly and it’s over a very short wired connection, so link noise and corruption are unlikely. Am I sending the wrong Mavlink version messages?

Have you tried with different computers/laptops? Just to rule out a hardware issue.

Most likely not, but you can use the --mav10 or --mav20 arguments in MAVProxy startup to force the version of Mavlink to use.

Yeah, I tried a Pi 3 and a TX1. On both, I tried a serial UART and USB connection. Same results.

Tried this also, no combination of --mav options and SERIAL_PROTOCOL setting seemed to change anything.

One thing to note is that baudrate strongly affects how many errors I get. At 57600 baud, I get no errors at all until I do something with a high communication load like start a log download, at which point the errors trickle in. At 1500k baud I get a constant flood of errors, even when idle.

Also found that it seems to have nothing to do with my companion computer process. Just running MAVProxy by itself without a relay results in the same problem. And the invalic CRC isn’t the only error, I variously get

  • unknown MAVLink message ID
  • invalid MAVLink CRC
  • incompat_flags

But they’re probably all probably coming from the same problem of not parsing mavlink messages correctly… or something.

It looks more like you are missing flow control in your connection.
Maybe one side is using XonXoff and the other RTS/CTS??

I don’t have flow control connected. I did have BRD_SER2_RTSCTS = 2, so I set it to 0 in case it was not detecting correctly but I still get errors. Also I originally encountered this issue when connecting over USB, although I haven’t tried that again in a while.

I found that I get LOT of errors on Copter 3.5.7, but much fewer errors on Copter 3.6.10.
In all cases, I’m using MAVProxy 1.8.8 and pymavlink 2.3.4

You could try upgrading your pymavlink. I think 2.3.8 is the latest.

Also, which flight controller hardware are you using?

Cube Black.

Updated to MAVProxy 1.8.12 and pymavlink 2.3.8. No errors yet, testing continues…

The errors are mostly gone with latest Ardupilot and Mavproxy/pymavlink, but they do appear on at random intervals. I’ll go for a long time with no errors, but then start getting them regularly for a while until they stop again. It’s usable, but I’m still a bit surprised to find this happening at all.

I had this same problem connecting a Kakute F7 AIO to a RPi4B. I updated the libraries, but it didn’t solve the problem. So, I reduced the baudrate from 921600 to 115200 and the problem is gone for now.

Hi, having the exact same issue here, did you manage to resolve it?

Updating Ardupilot and Mavproxy/pymavlink fixed it for the most part.
If you’re seeing a lot of garbage even with latest software, double-check that you are not running multiple instances of Mavproxy or anything else using the same serial connection.