Softivation

The cable is connected to the Raspberry Pi, but no MAVLink flows

The Raspberry Pi is connected to the Pixhawk and the Python code runs, but no MAVLink data arrives. Why doesn't telemetry flow when there's a heartbeat, and which two requests should you send?

Furkan IŞIKAY 4 min read

You connected the Raspberry Pi to the Pixhawk's telemetry port, the wires are the right colors, and power is there. You ran the Python code and it says the connection is established. But there's no position on screen, no altitude, and the parameter list is empty.

The only thing arriving is a signal that repeats every few seconds. Everything else is silent. It looks like a cable problem, but it isn't.

Why only a single signal arrives

As soon as the connection is up, the Pixhawk sends only a signal that introduces itself. Telemetry such as position, altitude, and battery, and the parameter list, don't arrive automatically.

To make it send them, you have to ask the autopilot explicitly. This is a rule of the protocol; changing the cable or the port doesn't change the result.

The most common mistake: trying to read position or parameters right after the connection is established. Until a request is sent, the autopilot sends nothing. The code says "connected", but the data never comes.

What's on the line after connecting

Look at the first six seconds on the left of the figure. Before any request is sent, the only things on the line are the heartbeat and the home and position-origin information that arrives once when the home point is set.

What flows from the Pixhawk to the Pi after connecting

After connecting, the Pixhawk sends only periodic HEARTBEAT messages and a position origin once. When the Pi sends the parameter list and telemetry requests, a dense message flow begins.
Where to look: the two red arrows going from bottom to top. The dense blue flow begins only after the Pi sends these requests. In the first six seconds on the left there is nothing except the gray HEARTBEAT arrows and the dark arrow that arrives once when home is set.

The dense flow begins after the Pi requests the parameter list and the telemetry stream. The code that sends these two requests is below.

Send the two requests yourself

After connecting, explicitly send two requests: PARAM_REQUEST_LIST for the parameters, and REQUEST_DATA_STREAM (or the current SET_MESSAGE_INTERVAL) for telemetry. Until both are sent, the screen stays empty.

Python
from pymavlink import mavutil

m = mavutil.mavlink_connection('tcp:127.0.0.1:5760')
m.wait_heartbeat()

# Parameters don't arrive unless requested
m.mav.param_request_list_send(m.target_system, m.target_component)

# Telemetry does not arrive unless requested (old API, still works)
m.mav.request_data_stream_send(
    m.target_system, m.target_component,
    mavutil.mavlink.MAV_DATA_STREAM_EXTRA1, 4, 1)

If you wait without sending a request, for six seconds you see only the heartbeat. Send PARAM_REQUEST_LIST and the parameter list pours in within a few seconds (1369 PARAM_VALUE in 4 seconds on ArduCopter 4.7.0; the count varies by board and version), and after the stream request about 318 telemetry messages flow in 4 seconds.

Example: The code on a Pi doing image processing has to read the drone's current position when it finds the target and report it to the ground station. If the code waits for the position message as soon as the connection is up, it waits forever, and the team loses hours swapping cables, ports, and baud rates. Put these two requests first in the code's startup sequence and read the position after that.

Error Messages and Their Meanings

Message type names exactly as they appear in the source, and symptoms reported on the forums:

Only the heartbeat arrives, no other messages. The connection and protocol are correct, but no request has been sent. The exact same symptom on the forum: "Companion computer receives only heartbeat messages." The companion computer sees only the heartbeat; the other streams don't arrive at all until a request is sent.

recv_match() always returns None. Getting None over and over when you connect with pymavlink and wait for the expected message type has the same root: since no messages are flowing, there's nothing to catch. The forum thread "PyMavlink no Message Output" describes this case.

The parameter request times out. If you use an intermediate layer like mavp2p or mavlink-router, PARAM_REQUEST_LIST sometimes gets lost. The forum thread "Getting Heartbeat but Param requests hang" describes this scenario.

Continue with the course

We cover this topic with source-code evidence and field cases in the Drone Communication Technologies course.

Was this article helpful?

Free resourceArduPilot SITL setup guideTry your code in SITL before heading out to the field: setup and connection, start to finish.