MAVLINKHUD

Overview

The SERIAL parameter group configures the physical UART (Universal Asynchronous Receiver-Transmitter) ports on the flight controller.

Effective serial configuration is the backbone of drone integration, allowing the autopilot to talk to GPS units, Telemetry Radios, Companion Computers, ESCs, and OSDs.

Key Concepts

1. Serial Port Indexing

  • SERIAL0: Usually the USB port.
  • SERIAL1: Usually Telemetry 1.
  • SERIAL3: Usually GPS 1.
    (Note: Mapping varies by board. Check your board's Wiki page).

2. Protocol Selection (SERIALx_PROTOCOL)

Tells the autopilot what "Language" to speak on each port.

  • 1: MAVLink 1.
  • 2: MAVLink 2 (Recommended for telemetry).
  • 5: GPS (NMEA/u-Blox).
  • 10: FrSky Passthrough.
  • 16: ESC Telemetry.
  • 33: MSP (Digital OSD).

3. Baud Rate (SERIALx_BAUD)

The communication speed. Both the autopilot and the connected device must match.

  • 57: 57,600 (Standard for SiK Radios).
  • 115: 115,200 (Standard for GPS/OSD).
  • 921: 921,600 (Recommended for Companion Computers/ROS).

4. Options (SERIALx_OPTIONS)

A bitmask for advanced UART features.

  • Bit 0: Invert TX.
  • Bit 1: Invert RX.
  • Bit 2: Swap TX/RX pins (handy if you cross your wires!).
  • Bit 3: Single-wire mode.

Parameter Breakdown

  • SERIALx_PROTOCOL: Function of the port.
  • SERIALx_BAUD: Speed of the port.
  • SERIAL_PASS1 / 2: Used for "Serial Passthrough," allowing you to update GPS or ESC firmware through the autopilot.

Integration Guide

  1. Requirement: Check your device manual for its default baud rate.
  2. Config: Set the protocol and baud rate.
  3. Reboot: Critical. Serial settings almost always require a full reboot to initialize the new drivers.

Developer Notes

  • Library: libraries/AP_SerialManager.
  • DMA: High-speed ports (921k+) often utilize DMA (Direct Memory Access) to reduce CPU load.

SERIAL0_BAUD

Default 115
Range 1 12500000

Console/USB Baud Rate (SERIAL0_BAUD)

Description

SERIAL0_BAUD defines the speed of the primary connection to your computer.

On most flight controllers, SERIAL0 is the USB port. While USB itself doesn't have a "Baud Rate" in the traditional sense (it runs at high speed), the autopilot uses this parameter to determine the speed of the virtual UART bridged over USB.

  • 115 (Default): 115200 baud. standard for most connections.

Tuning & Behavior

  • Usage: For most users, leave at 115.
  • ESP32-S3 / Linux: On boards where the primary console is a physical UART instead of a dedicated USB-Serial bridge, setting this correctly is essential for accessing the bootloader and terminal.

SERIAL0_PROTOCOL

Default 2
Range -1 42

Console/USB Protocol (SERIAL0_PROTOCOL)

Description

SERIAL0_PROTOCOL tells the autopilot what "Language" to speak on the primary USB/Console port.

  • 2 (Default): MAVLink 2. Standard protocol for Ground Control Stations (Mission Planner, QGC).
  • -1: None / Disabled.
  • 1: MAVLink 1.

Tuning & Behavior

  • Recommendation: Leave at 2 for all normal operations.
  • Caution: If you change this to a non-MAVLink protocol, you may lose the ability to connect to the flight controller via USB to change parameters. You would then need to connect via a different telemetry port to fix the setting.

SERIAL1_BAUD

Default 57
Range 1 12500000

Telem1 Baud Rate (SERIAL1_BAUD)

Description

SERIAL1_BAUD sets the speed of the serial connection.

The value is generally in baud / 1000 (e.g., 57 = 57600 baud). However, very high speeds (like 2Mbaud) can be entered directly as integers in some GCS implementations, but the parameter storage is compressed.

  • 57: 57600 (Standard for SiK Telemetry Radios).
  • 115: 115200 (Standard for most GPS units and Wifi bridges).
  • 921: 921600 (High speed, good for fast logging or offboard control).
  • 1500: 1.5 Mbaud.

The Mathematics

$$ \text{Baud Rate} = \text{SERIAL1\_BAUD} \times 1000 $$
(For values < 2000. Values > 2000 are interpreted literally).

The Engineer's View

Used in AP_SerialManager::init().
The port configuration (start bits, stop bits, parity) is usually determined by the Protocol, but Baud is set here.
MAVLink usually requires 8N1 (8 data bits, No parity, 1 stop bit). S.Bus requires 100k baud, 8E2.

Tuning & Behavior

  • Default Value: 57 (57600)
  • Recommendation:
    • SiK Radio: 57
    • GPS: 115 or 230 (Ensure the GPS is configured to match, or use auto-baud).
    • ESP8266/ESP32 Wifi: 921 (for fast Mavlink).
    • RC Receiver (ELRS/Crossfire): Usually auto-negotiated or fixed by protocol (e.g., CRSF runs at ~400k).

SERIAL1_OPTIONS

Default 0
Range 0 8191

Telem1 options (SERIAL1_OPTIONS)

Description

SERIAL1_OPTIONS is a bitmask to configure low-level hardware properties of the UART port.

  • Bit 0 (1): Invert RX. Inverts the logic level of the Receive pin. Used for S.Bus and some telemetry protocols.
  • Bit 1 (2): Invert TX. Inverts the Transmit pin.
  • Bit 2 (4): Half Duplex. Combines RX and TX onto a single wire (usually the TX pin). Used for FPort, S.Port, and some older protocols.
  • Bit 3 (8): Swap TX/RX. Swaps the physical pins (if supported by the STM32 hardware).
  • Bit 4 (16): Pull Down RX. Enables internal pull-down resistor.
  • Bit 5 (32): Pull Up RX. Enables internal pull-up resistor.
  • Bit 6 (64): Pull Down TX.
  • Bit 7 (128): Pull Up TX.

The Mathematics

$$ \text{Options} = \sum 2^i \cdot b\_i $$

Example: For FPort (Inverted + Half Duplex):
Inverted TX (2) + Half Duplex (4) = 6? Or sometimes Inverted RX (1) + Half Duplex (4) = 5?
(Note: Half Duplex usually implies TX pin usage. The inversion requirement depends on whether the receiver sends inverted S.Port or un-inverted FPort).

The Engineer's View

These bits map directly to the HAL UARTDriver::set_options() method.
This provides software control over signal inversion, which historically required hardware inverters on older Flight Controllers (like Pixhawk 1). Modern F7/H7 chips have built-in inverters.

Tuning & Behavior

  • Default Value: 0 (Standard 8N1, Full Duplex)
  • Common Use Cases:
    • S.Bus: Usually requires Invert RX (1) if connected to a UART (not the RCIN pin).
    • S.Port / FPort: Requires Half Duplex (4) and often Invert (2) depending on the receiver firmware.
    • GPS/Telemetry: Usually 0.

SERIAL1_PROTOCOL

Default 2
Range -1 49

Telem1 protocol selection (SERIAL1_PROTOCOL)

Description

SERIAL1_PROTOCOL determines what language ArduPilot speaks on the first telemetry port.

  • 2: MAVLink2 (Default). Modern telemetry protocol. Use this for SiK Radios, Wifi Bridges, and Onboard Computers (Raspberry Pi/Jetson).
  • 5: GPS. Connect an external GPS unit here.
  • 10: FrSky SPort Passthrough. For OpenTX/EdgeTX telemetry on Taranis/Radiomaster radios.
  • 23: RCIN. If you want to connect your ELRS/Crossfire receiver to this UART instead of the dedicated RCIN pin.

The Mathematics

This parameter is an enumeration (integer ID) that selects the driver backend instantiated for this UART.

The Engineer's View

Used in AP_SerialManager::init().
Changing this parameter usually requires a Reboot to initialize the correct driver.
ArduPilot supports concurrent protocols on different ports (e.g., MAVLink on Serial 1, GPS on Serial 3, FrSky on Serial 4).

Tuning & Behavior

  • Default Value: 2 (MAVLink2)
  • Recommendation:
    • Telemetry Radio: 2
    • GPS: 5
    • Crossfire/ELRS: 23 (RCIN) - Note: Crossfire VTX control uses protocol 29.
    • DJI FPV (OSD): 33
    • Disabled: -1 (Use to free up resources or if port is broken).

SERIAL2_BAUD

Default DEFAULT_SERIAL2_BAUD
Range null

Telemetry 2 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL2_OPTIONS

Default DEFAULT_SERIAL2_OPTIONS
Range null

Telem2 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL2_PROTOCOL

Default DEFAULT_SERIAL2_PROTOCOL
Range null

Telemetry 2 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL3_BAUD

Default DEFAULT_SERIAL3_BAUD
Range null

Serial 3 (GPS) Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL3_OPTIONS

Default DEFAULT_SERIAL3_OPTIONS
Range null

Serial3 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL3_PROTOCOL

Default DEFAULT_SERIAL3_PROTOCOL
Range null

Serial 3 (GPS) protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL4_BAUD

Default DEFAULT_SERIAL4_BAUD
Range null

Serial 4 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL4_OPTIONS

Default DEFAULT_SERIAL4_OPTIONS
Range null

Serial4 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL4_PROTOCOL

Default DEFAULT_SERIAL4_PROTOCOL
Range null

Serial4 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL5_BAUD

Default DEFAULT_SERIAL5_BAUD
Range null

Serial 5 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL5_OPTIONS

Default DEFAULT_SERIAL5_OPTIONS
Range null

Serial5 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL5_PROTOCOL

Default DEFAULT_SERIAL5_PROTOCOL
Range null

Serial5 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL6_BAUD

Default DEFAULT_SERIAL6_BAUD
Range null

Serial 6 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL6_OPTIONS

Default DEFAULT_SERIAL6_OPTIONS
Range null

Serial6 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL6_PROTOCOL

Default DEFAULT_SERIAL6_PROTOCOL
Range null

Serial6 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL7_BAUD

Default DEFAULT_SERIAL7_BAUD
Range null

Serial 7 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL7_OPTIONS

Default 0
Range null

Serial7 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL7_PROTOCOL

Default DEFAULT_SERIAL7_PROTOCOL
Range null

Serial7 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL8_BAUD

Default DEFAULT_SERIAL8_BAUD
Range null

Serial 8 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL8_OPTIONS

Default 0
Range null

Serial8 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL8_PROTOCOL

Default DEFAULT_SERIAL8_PROTOCOL
Range null

Serial8 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL9_BAUD

Default DEFAULT_SERIAL9_BAUD
Range null

Serial 9 Baud Rate

Note: This parameter functions identically to SERIAL1_BAUD.

SERIAL9_OPTIONS

Default DEFAULT_SERIAL9_OPTIONS
Range null

Serial9 options

Note: This parameter functions identically to SERIAL1_OPTIONS.

SERIAL9_PROTOCOL

Default DEFAULT_SERIAL9_PROTOCOL
Range null

Serial9 protocol selection

Note: This parameter functions identically to SERIAL1_PROTOCOL.

SERIAL_PASS1

Default -1
Range -1 10

Serial Passthrough Port 1 (SERIAL_PASS1)

Description

SERIAL_PASS1 and SERIAL_PASS2 create a "Virtual Wire" inside the flight controller.

When you set both of these to valid port numbers (e.g., 0 for USB and 3 for GPS), the flight controller stops processing the data on those ports and simply forwards it back and forth. This is used to "talk through" the drone to reach external sensors for configuration (like using the u-blox u-center software to update GPS firmware while it is plugged into the drone).

Tuning & Behavior

  • Default: -1 (Disabled).
  • Usage:
    1. Set SERIAL_PASS1 to 0 (USB).
    2. Set SERIAL_PASS2 to the index of the port you want to reach (e.g. 3 for SERIAL3).
    3. Connect with your external software.
  • Safety: normal flight functionality on these ports is Disabled while passthrough is active. Do not attempt to fly while this is enabled.

SERIAL_PASS2

Default -1
Range -1 10

Serial Passthrough Port 2 (SERIAL_PASS2)

Description

Defines the other end of the serial bridge initiated by SERIAL_PASS1.

SERIAL_PASSTIMO

s
Default 0
Range 0 120

Serial Passthrough Timeout (SERIAL_PASSTIMO)

Description

SERIAL_PASSTIMO is a safety timer for the serial bridge.

If no data is sent or received on the bridged ports for this many seconds, the autopilot will automatically close the bridge and revert the ports to their normal flight functions. This prevents the drone from being left in a "Non-Flight" state if you forget to manually disable the passthrough.

  • 0: Disabled (No automatic timeout).
  • Value: Timeout in seconds.