RaspberryPi3 and APM2.6 via MAVProxy

Hi everyone,

I’m newbie here.
I am following this guide: Communicating with Raspberry Pi via MAVLink — Dev documentation

i know Rpi3 has changed the uart access,following reply form @fnoop Connecting Raspberry Pi to Pixhawk

Add this to /boot/config.txt:

enable_uart=1
dtoverlay=pi3-disable-bt

then I got result below:

root@pi-desktop:~# 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
Failed to connect to /dev/ttyAMA0 : [Errno 2] could not open port /dev/ttyAMA0: [Errno 2] No such file or directory: ‘/dev/ttyAMA0’

and

root@pi-desktop:~# mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect /dev/ttyS0 source_system=255
Failed to connect to /dev/ttyS0 : Could not configure port: (5, ‘Input/output error’)

On the other hand, I also try this guide

https://frillip.com/raspberry-pi-3-uart-baud-rate-workaround/

In /boot/config.txt, add the line

core_freq=250.

Save and reboot.

I got result:

root@pi-desktop:~# 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/2017-05-10/flight6
Telemetry log: MyCopter/logs/2017-05-10/flight6/flight.tlog
MAV> param show ARMING_CHECK
MAV>

I am not getting any communication between the two.

and

root@pi-desktop:~# mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect /dev/ttyS0 source_system=255
Failed to connect to /dev/ttyS0 : [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: ‘/dev/ttyS0’

They are both totally contrary to the result normally should be !!

The problem confuse me all day. Is there any configuration I might missed?

I use Ubuntu Mate: 16.04 on rpi3

Have you disabled ModemManager?

It looks like you didn’t reboot after adding the overlay lines. Remove the core_freq=250 and try using /dev/ttyAMA0 again after a reboot.

@fnoop
I indeed do two test separably only add

enable_uart=1
dtoverlay=pi3-disable-bt

or

core_freq=250

once a time.I also have reboot after adding the overlay lines.I will check isn’t ModemManager disable again later.

Did the last version of Mavproxy support APM2.6?
And do I need to connect GPS when I’m connect between rpi and APM?
I saw this two problem form other post.But I don’t know isn’t true.

Very thanks for reply.:relaxed:

@fnoop I uninstall ModemManager. Waring is gone,but problem still exist. Same as before.

Do I need to change any things in /boot/cmdline.txt?
like remove

console=serial0,115200

And I also fallow the official guide disable serial by raspi-config does it mater?

@ update : i remove console=serial0,115200 in /boot/cmdline.txt and enable serial by raspy-config.It finally work !! sorry for bothering.:wink:

Great, well done for persevering :slight_smile:

Hi kungfrank,
I’ve been under trouble like what you had experienced.

My configuration is as below

< I’ve tried also The serial login shell is disabled + The serial interface is enabled but the same problem>

But the result is stuck in the below screen

Is there any missed configuration?
Very appreciated if you got me on the track ^^

You absolutely need to disable ‘serial login shell’ and reboot.

Hi fnoop, thanks for your help.

It worked after replacing “ttyama0” with “serial0” ^^

@Kyomo_Jung That’s interesting. What does ‘ls -l /dev/serial0’ say? It should point to ttyAMA0.

I googled on Rpi3 serial port and it said ttyAMA was changed to serial0 ^^

Hello all, I have followed the exact procedure steps that you have done, But am not able to get reply from pixhawk.
I enabled uart connection and disabled bluetooth also. i got this same output as @Kyomo_Jung .


I tried connecting using serial0 also. I got connection to MAV. But am not getting any MAV commands executed.
Can someone help me with this?
Also, Can someone send a picture of your hardware connections?

I had a load of trouble with this as well.

Turns out that the APM2.6 has a AutoMux. which means that UART1 is shared with the USB port. So if you power the APM via USB (which i normally do from the computer) then the Telemetry port 1 does not provide mavlink.

I did all the above with a raspberry Pi Zero W and couldn’t get it to work, until i powered up the APM up using a battery and not the USB port. It then started to work.

I’m now looking at finding out how to enable the second telemetry port or removing this behaviour!

@Kyomo_Jung Hi, i’m try but still not working, this is my configuration:


this is cmdline

and this config.txt

and using ls -l /dev

but when i try connect the apm 2.8 with RPI 3B
’ MAV> Waiting for heartbeat from /dev/ttyAMA0 ’

i try with S0 too, but nothing happens
‘MAV> Waiting for heartbeat from /dev/ttyS0’

The first connection what i did was this

But then i read what i need use a logical level converter and now i’m using one, but still not working, please help me, i’m trying about 5 days and nothing

When you want to use telemetry port 1, you need to unplug the USB and power it from battery.

I’ll post my config on the raspberry-pi zero a bit later

Here’s my config on a raspberry pi zero W.
I use /dev/ttyAMA0 as i have the connection on the first few header pins as shown on:

In the rasp-config, i have serial login shell DISABLED and serial interface ENABLED.

root@drone:/home/pi# cat /boot/config.txt
# For more options and information see
# http://rpf.io/configtxtreadme
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
start_x=1
gpu_mem=128
enable_uart=1
dtoverlay=pi3-disable-bt
root@drone:/home/pi#


root@drone:/home/pi# cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=883d01e1-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

Please note:

  • You must power your APM using a battery. Not the USB!

What OS are you using?
I’m using Ubuntu mate 16.04, but still not working

Rasberian Jessie. The standard debian image they provide.

@cyclops Hi, emmm finally worked but not quite, look:

do you know why? and thanks so much.