#Mavlink over USB

1 messages · Page 1 of 1 (latest)

dry hound
#

Hi community!

Does anybody understand the verdict on https://github.com/betaflight/betaflight/issues/13485? I'm currently trying to get mavlink messages out of my Betafpv F4 2-3S 20A AIO FC V1. I tried both with the factory flashed betaflight firmware as well as with 2025.12.1 which I built with USE_TELEMETRY and USE_TELEMETRY_MAVLINK (https://build.betaflight.com/api/builds/7275b70b3e57458e8614750b11227d4b/log is the cloud log of the build). However, I am not receiving any messages. Connected via USB to my macbook, where I am running a simple rust binary using mavlink-rs, code below. I see it connects successfully, but then I never see any messages. I have enabled Telemetry on the USB VCP, see screenshot. Am I missing something obvious? I do not have any transmitter connected to the FC.

fn main() -> anyhow::Result<()> {
let mut conn = mavlink::connect::mavlink::common::MavMessage(
"serial:/dev/cu.usbmodem0x80000001:115200",
)?;
conn.set_protocol_version(mavlink::MavlinkVersion::V1);

tracing::info!("Connected to MAVLink device");

loop {
    match conn.try_recv() {
        Ok((_header, msg)) => info!("Received MAVLink message: {:?}", msg),
        Err(_) => {}
    }
    tracing::info!("Waiting for next message...");
    std:🧵:sleep(std::time::Duration::from_millis(500));
}

}

GitHub

Describe the bug When I configure a port for mavlink telemetry output nothing comes out. I also tried to enable the telemetry mode, that did not work either. To Reproduce put an oscilloscope on the...

keen pilot
#

About simple MAVLink telemetry using. I think, it will work if you set USE_TELEMETRY, USE_TELEMETRY_MAVLINK build option and tune some free uart tx for mavlink telemetry. The telemetry will transmit through uart, I think.

#

Probably, by using serial passthrough, will possible to read telemetry over usb

dry hound
#

Thanks for chiming in! Right now I want to stick to the simplest setup possible, so hoping to just get Mavlink via USB/Serial to my Macbook, no transmitter involded. Are you saying that should work? Can you suggest me some configuration options that should do it? I'm not quite understanding the various port options quite right I guess.

#

I have built the firmware using the two build options you suggest already. Looking at the cloud log confirms to me they are applied.

keen pilot
#

Flash firmware with build options above. Set output as MAVLink telemetry for free uart at the Configurators Ports tab, set ports baud rate what you need.
I use mavlink for ELRS and it should work for simple uart too.

#

I do not know about USB reading. But if you set serial passthrough mode for mavlinks uart, the Configurators output window will show mavlink data stream.

dry hound
#

Something like this?

keen pilot
#

Yes, it can work for free uart. But I am not sure about MSP enabled mode..

dry hound
#

Sorry what is the configurators output window?

keen pilot
#

Above cli command string.

#

Enter and send command serialpassthrough 2 57600 (where '2' is the UART ID; remember, UART 3 is actually ID 2, UART 2 would be 1, and UART 1 would be 0), then press ENTER.

dry hound
#
# 
# Building AutoComplete Cache ... Done!
# 
# serialpassthrough 2 57600
Invalid port1 2

For "2" should I enable Uart 3 in the ports? I did so, but still same "invalid port1 2".

#

I think the port name must be "UART3", not some ID?

Entering CLI 
# Building AutoComplete Cache ... Done!
# 
# serialpassthrough UART3 57600
Port1: UART3
Port2: VCP
Port1 is already open, new baud = 57600.
Forwarding, power cycle to exit.
#

As long as the betaflight configurator app is connected, I cannot connect to the usb with my terminal binary, so not sure if that serialpassthrough does anything, since disconnecting the app power cycles the FC?

keen pilot
keen pilot
dry hound
#

Would betaflight only send telemetry once armed or something like that?

keen pilot
#

The arming does not need to send telemetry.

keen pilot
keen pilot
#

But I've never used simple mavlink telemetry without ELRS. If it does not work, then I will check it.

dry hound
#

If you can point me in some direction of where to look/debug, I can also try and get to the bottom of this. Not that familiar with the codebase yet and how to debug there, but seems doable 🙂

keen pilot
keen pilot
#

What receiver do you use? Has it a telemetry? If it is CRSF, then rude test maybe: temporary to disable receiver in port and receiver tab.

keen pilot
#

Which are your last ports settings?

dry hound
#

I do not own a receiver or transmitter at this point in time. Still undecided on those 🙂

#

I kind of tried all possible combinations of UART1, UART3 with differing baude rates, configuration on and off ... nothing seemed to make a differnece. We could take #1459195499432116307 message as a reference.

keen pilot
dry hound
#
serialpassthrough UART1 115200
#

But nothing still :/

dry hound
#

For what it's worth, I was able to successfully connect from raspi to the FC and receive mavlink with my program. Via UART that is, connected to RX1/TX1 on the FC. So really the forwarding/passthrough doesn't work.

#

Let me know if I should create a github issue for that (or if I'm simply trying the impossible haha).

keen pilot
#

Do I understand correctly, that MAVLink telemetry works on the selected port, but it does not work through USB by using serialpassthrough command?

#

I use serialpassthrough to setup GPS by using u-center program. It works.

dry hound
#

Yes that is correct, MAVLink telemetry works with this setting, but only when connected via UART1 serial, not via USB passthrough for me.

keen pilot
#

@loud sentinel please could you help us.
The MAVLInk telemetry goes to serial port, but it is unvisible on USB port by using serialpassthrough.

keen pilot
#

I suspect, it can not work. Because, the real device (like gps) gets data: USB port -> FC -> serial out -> gps. It sends data back to: serial input -> FC -> USB port.
But in our case, the telemetry goes to empty serial port output and can not go to ports input back.. Also, the serialpass logic cuts mavlink stream from port, and changes it to USB input, I think.
Yes, sorry, I had a mistake about using serialpassthrlugh..