Serial Port Configuration
Last updated
Last updated
PX4 defines for many flight controller ports, which is why you can plug a GPS module into the port labelled GPS 1
, an RC receiver into RC IN
, or a telemetry module into TELEM 1
, and generally they will just work.
The functions assigned to ports are fully configurable using appropriate parameters (in most cases). You can assign any unused port to any function, or reassign a port to use it for something else.
The configuration makes it easy to (for example):
Run MAVLink on a different port, change the streamed messages, or switch a TELEM port to use ROS 2/XRCE-DDS.
Change the baud rate on a port or set the UDP port
Setup dual GPS.
Enable sensors that run on a serial port, such as some .
:::note
Some ports cannot be configured because they are used for a very specific purpose such as the system console.
The mapping of specific devices to port names on the flight controller is explained in . :::
The serial port configuration parameters allow you to assign a particular function or support for particular hardware to a particular port. These parameters follow the naming pattern *_CONFIG
or *_CFG
:::note QGroundControl only displays the parameters for services/drivers that are present in firmware. :::
At time of writing the current set is:
GPS configuration: ,
:
: , ,
Modal IO ESC:
MSP OSD:
RC Port:
:
HoTT Telemetry:
port: ,
Sensors (optical flow, distance sensors): , , , , , , ,
CRSF RC Input Driver:
Sagetech MXS:
Ultrawideband position sensor:
DShot driver:
All the serial drivers/ports are configured in the same way:
Set the configuration parameter for the service/peripheral to the port it will use.
Reboot the vehicle in order to make the additional configuration parameters visible.
Set the baud rate parameter for the selected port to the desired value.
Configure module-specific parameters (i.e. MAVLink streams and data rate configuration).
Port conflicts are handled by system startup, which ensures that at most one service is run on a specific port. For example, it is not possible to start a MAVLink instance on a specific serial device, and then launch a driver that uses the same serial device.
:::warning At time of writing there is no user feedback about conflicting ports. :::
:::tip These port mappings can be disabled by setting the associated configuration parameter to Disabled. :::
The following ports are commonly mapped to specific functions on all boards:
TELEM 2
is configured by default as a MAVLink serial port suitable for connection to an Onboard/Companion computer via a wired connection.
Ethernet
is mapped as a MAVLink port on Pixhawk devices that have an Ethernet port.
Other ports generally have no assigned functions by default (are disabled).
QGroundControl only displays the parameters for services/drivers that are present in firmware. If a parameter is missing, then you may need to add it in firmware.
An easier method would be using boardconfig which launches a GUI where you can easily search, disable and enable modules. To launch boardconfig type:
Some functions/features may define additional configuration parameters, which will follow a similar naming pattern to the port configuration prefix. For example, MAV_0_CONFIG
enables MAVLink on a particular port, but you may also need to set , , and so on.
The section provides a practical example of how to configure a port in QGroundControl (it shows how to use GPS_2_CONFIG
to run a secondary GPS on the TELEM 2
port).
Similarly explains the setup for Ethernet serial ports, and explains the configuration for MAVLink serial ports.
GPS 1
is configured as a GPS port (using ).
This maps the to the port with a baud rate of Auto (with this setting a GPS will automatically detect the baudrate - except for the Trimble MB-Two, which requires 115200 baud rate).
RC IN
is configured as an RC input (using ).
TELEM 1
is configured as a MAVLink serial port suitable for connection to a GCS via a .
The configuration uses to set the port, to set the baud rate to 57600, and to set the messages streamed to "Normal". For more information see: .
The configuration uses to set the port, to set the baud rate, and to set the messages streamed to "Onboard". For more information see: .
The configuration uses and appropriate settings for the UDP port etc. For more information see and .
:::note PX4 firmware includes most drivers by default on boards. Flash-limited boards may comment out/omit the driver (at time of writing this only affects boards based on FMUv2). :::
You can include the missing driver in firmware by enabling the driver in the default.px4board config file that corresponds to the you want to build for. For example, to enable the SRF02 driver, you would a the following line to the px4board.
You will then need to build the firmware for your platform, as described in .