Connecting Raspi and Pixhawk

I have been trying to connect with the pixhawk using MAVproxy in order to control quadrotor through CLI.
But I am facing problems in connecting to the pixhawk 2.4.8 using MAVproxy.
As son as I try to connect, the pixhawk doesnt revert any details (appears as if its not even connected to autopilot). As expected, all my commands entered through mavproxy return nothing.

pluto@pluto-macbook:~$ mavproxy.py --master=/dev/ttyUSB0 --baudrate 576000 --aircraft MyCopter
MyCopter/logs/2014-08-14/flight5
Logging to MyCopter/logs/2014-08-14/flight5/flight.tlog
no script MyCopter/mavinit.scr
MAV> param show
MAV>

Could you help me how the solution of it? Thank you so much :slight_smile:

pluto@pluto-macbook:~$ mavproxy.py --master=/dev/ttyUSB0 --baudrate 576000
–aircraft MyCopter

Your baud rate is incorrect. Make sure it is the same on both ends.

MyCopter/logs/2014-08-14/flight5
Logging to MyCopter/logs/2014-08-14/flight5/flight.tlog
no script MyCopter/mavinit.scr
MAV> param show
MAV>

This prompt indicates you’re not talking with the autopilot at all. Don’t
expect any commands to work until you are. When you do connect you’ll
know it (and the prompt will change to indicate the current flight mode).

now i use baudrate 57600

could you teach me how to talking with the ardupilot at all?

it just appear nothing process :pensive:

MyCopter/logs/2014-08-14/flight5
Logging to MyCopter/logs/2014-08-14/flight5/flight.tlog
no script MyCopter/mavinit.scr
MAV> param show ARMING_CHECKING
MAV>
MAV>
MAV>

Are you sure you are connected with the correct port?

port? what is port? port GPIO?

pi@raspberrypi:~ $ sudo -s
root@raspberrypi:/home/pi# mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter
Connect /dev/ttyS0 source_system=255
no script MyCopter/mavinit.scr
Log Directory: MyCopter/logs/2017-10-02/flight4
Telemetry log: MyCopter/logs/2017-10-02/flight4/flight.tlog
MAV> Waiting for heartbeat from /dev/ttyS0
Exception in thread main_loop:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/local/bin/mavproxy.py”, line 751, in main_loop
master.wait_heartbeat()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 386, in wait_heartbeat
return self.recv_match(type=‘HEARTBEAT’, blocking=blocking)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 347, in recv_match
m = self.recv_msg()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 310, in recv_msg
s = self.recv(n)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 832, in recv
ret = self.port.read(n)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 501, in read
’device reports readiness to read but returned no data '
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

How to fixed the problem

I think you’re using the wrong port.

On the raspberry pi, where do you have the connection? Make a photo so we can see the setup clearly!

Thanks. Now please tell us how you’ve configured the raspberry PI itself?

It’s improtant to know if you’ve setup your serial port on the raspberry pi.

dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=4d68df1c-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

this is my cmdline

For more options and information see

http://rpf.io/configtxt

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
politeknik

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 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

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

#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=pi3-disable-bt

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

pi@raspberrypi:~ $ sudo -s
root@raspberrypi:/home/pi# mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter
Connect /dev/ttyS0 source_system=255
no script MyCopter/mavinit.scr
Log Directory: MyCopter/logs/2017-10-04/flight3
Telemetry log: MyCopter/logs/2017-10-04/flight3/flight.tlog
MAV> Waiting for heartbeat from /dev/ttyS0
Exception in thread main_loop:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/local/bin/mavproxy.py”, line 751, in main_loop
master.wait_heartbeat()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 386, in wait_heartbeat
return self.recv_match(type=‘HEARTBEAT’, blocking=blocking)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 347, in recv_match
m = self.recv_msg()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 310, in recv_msg
s = self.recv(n)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 832, in recv
ret = self.port.read(n)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 501, in read
’device reports readiness to read but returned no data '
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Thank you for respon :relaxed:

It all looks ok.
My config is posted here: RaspberryPi3 and APM2.6 via MAVProxy

I do see some differences, so please check that.

What it looks like to me, on your end, is that ttyS0 is not there. which means there must be something on the raspberry not correct.

I use ttyS0 because ttyAMA0 is not responding.

It not processed.
that just direct me to
MAV>
MAV>
MAV>

not in mode STABILIZE>

Hi, pi3 has changed the uart access a bit because of the onboard bluetooth. In short, you need to disable the onboard bluetooth and reassign the exposed uart gpio back to the PL011 which has better timing at different clockspeeds. It’s then accessed as before on /dev/ttyAMA0.

Add this to /boot/config.txt:

enable_uart=1
dtoverlay=pi3-disable-bt

Then you should see the AMA0 in the tty devices using command ls /dev/tty*
Launch the Mavproxy using AMA0
sudo mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter

How to use command ls /dev/tty?

I don’t how to use it, could you teach me?

Ok.
Thank you for respon :slight_smile: