Raspberry Pi not sending information to Pixhawk

Hi,

I have a Pixhawk connected to a Raspberry Pi 3 as per this article: http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html via the Telem2 port.

Everything has been set up, upon executing the mavproxy.py script, I am able to receive information from the Pixhawk but not send information to it.

According to this video: https://www.youtube.com/watch?v=DGAB34fJQFc. I followed all the steps however I’m not able to send commands via MAVLink from the Raspberry Pi to the Pixhawk. I am able to receive the commands in the Terminal when I manually arm/disarm the motors using my controller.

However, when I try executing any command, nothing changes. It just shows STABILIZE> even when I type “mode RTL” and hit Enter, nothing happens and “STABILIZE>” appears again. No message, nothing.

The baud rate has been set correctly, but does anyone have any idea of what the problem may be?

Also: I don’t quite understand why we have to disable the serial port then enable it by setting enable_uart = 1. It’s basically turning it off and back on with nothing happening in between, according to the first linked article. Could anyone explain the rationale behind this?

Any help is appreciated.

Hi,
could you check that your wiring is good : tx , rx and GND, on both side !
About disabling stuff, it is because the OS use the serial port as output, if let is at it (don’t have rpi3 but it like that on all other cards) you will see linux kernel message on the serial. So it need to be shutdown.

Hi, yes the wiring is correct. I even flipped the Tx and Rx around for extra measure but it just said no link in the Terminal, which is understandable.

When you disable it, you are actually telling the kernel and operating system not to send messages on the serial connection. Source.

The enable_uart=1 in /boot/config.txt is required in RPi3 to actually activate the serial port, see here for further information.

To your actual problem I can’t help you that much. I just went through the setup yesterday and it works fine. Have you connected the RPi through the vcc provided by the Pixhawk or through the micro USB port? (Don’t use both, the UB port is recommended)

Thanks for the explanation about the serial ports.

I’m powering the RPi through the micro USB port. I leave the Pixhawk’s VCC hanging free, unconnected.

Everything has been set up, upon executing the mavproxy.py script, I am able
to receive information from the Pixhawk but not send information to it.

Try appending “–mav10” to your MAVProxy command-line.

Peter

Thanks a lot Peter :slight_smile: that worked!
Can u explain why is --mav10 required though?

1 Like

http://ardupilot.github.io/MAVProxy/html/getting_started/starting.html#mav10

Hello Peter,

Thank you for sharing your solution.

However, in 2023 I’m using APM and I’m getting the following error

mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter --mav10
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect /dev/ttyAMA0 source_system=255
waypoint module not available; use old compat modules
Traceback (most recent call last):

  • File “/usr/local/bin/mavproxy.py”, line 1449, in *
  • mpstate.load_module(m, quiet=True)*
  • File “/usr/local/bin/mavproxy.py”, line 374, in load_module*
  • module = m.init(mpstate, *kwargs)
  • File “/usr/local/lib/python3.9/dist-packages/MAVProxy/modules/mavproxy_wp.py”, line 579, in init*
  • return WPModule(mpstate)*
  • File “/usr/local/lib/python3.9/dist-packages/MAVProxy/modules/mavproxy_wp.py”, line 19, in init*
  • super(WPModule, self).init(mpstate, “wp”, “waypoint handling”, public=True)*
  • File “/usr/local/lib/python3.9/dist-packages/MAVProxy/modules/lib/mission_item_protocol.py”, line 35, in init*
  • self.completions())*
  • File “/usr/local/lib/python3.9/dist-packages/MAVProxy/modules/lib/mission_item_protocol.py”, line 103, in completions*
  • cs = self.commands()*
  • File “/usr/local/lib/python3.9/dist-packages/MAVProxy/modules/mavproxy_wp.py”, line 162, in commands*
  • ret.update({*
    AttributeError: ‘NoneType’ object has no attribute ‘update’

I have heartbeat with the APM when connected with R pi zero 2W with the following command:

mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect /dev/ttyAMA0 source_system=255
no script MyCopter/mavinit.scr
Log Directory: MyCopter/logs/2023-09-12/flight15
Telemetry log: MyCopter/logs/2023-09-12/flight15/flight.tlog
Waiting for heartbeat from /dev/ttyAMA0
MAV> Detected vehicle 1:1 on link 0
online system 1
STABILIZE> Mode STABILIZE

I have followed this video to setup the mavproxy in my pi zero : https://www.youtube.com/watch?v=kB9YyG2V-nA&t=657s

and, I faced the same issue, where APM is unable to receive the Mavproxy command. However, Mavproxy is able to read the APM data.

I suspect I’m running some incompatible versions… but not sure what is wrong.

Please help me with this,
Thank you :slight_smile:

Like it says, you need to uninstall ModemManager:

sudo apt remove modemmanager

Be aware there might be other things you did not do to properly prepare the RPi, but see how it goes.

Were you able to solve this issue, i am having the same issue and although i removed modemmanager it persists. when i enter --mav20 program runs but again ignores commands