Serial Port Configuration

Most serial (UART) ports on a Pixhawk board can be fully configured via parameters (exceptions are ports that are used for a very specific purpose like RC input, or which are not configurable like SERIAL 5).

The configuration makes it easy to (for example):

  • change the baudrate on a port.
  • run MAVLink on a different port, or change the streamed messages.
  • setup dual GPS.
  • enable sensors that run on a serial port, such as some distance sensors.

Pre-configured Ports

The following functions are typically mapped to the same specific serial ports on all boards, and are hence mapped by default:

  • MAVLink is mapped to the TELEM 1 port with baudrate 57600 (for a telemetry module).
  • GPS 1 (gps driver) is mapped to the GPS 1 port with a baudrate Auto (with this setting a GPS will automatically detect the baudrate - except for the Trimble MB-Two, which requires 115200 baudrate).

All other ports have no assigned functions by default (are disabled).

The ports mappings above can be disabled by setting MAV_0_CONFIG and GPS_1_CONFIG to Disabled, respectively.

How to Configure a Port

All the serial drivers/ports are configured in the same way:

  1. Set the configuration parameter for the service/peripheral to the port it will use.
  2. Reboot the vehicle.
  3. Set the baud rate parameter for the selected port to the desired value.
  4. Configure module-specific parameters (i.e. MAVLink streams and data rate configuration).

Configuration parameter names follow the pattern \*\_CONFIG or \*\_CFG (QGroundControl only displays the parameters for services/drivers that are present in firmware). At time of writing the current set is: GPS_1_CONFIG, GPS_2_CONFIG, ISBD_CONFIG, MAV_0_CONFIG, MAV_1_CONFIG, MAV_2_CONFIG, RTPS_CONFIG, RTPS_MAV_CONFIG, TEL_FRSKY_CONFIG, TEL_HOTT_CONFIG, SENS_LEDDAR1_CFG, SENS_SF0X_CFG, SENS_TFMINI_CFG, SENS_ULAND_CFG.

The following steps provide a practical example of how to configure a port in QGroundControl. It shows how to run a secondary GPS (GPS_2_CONFIG) on the TELEM 2 port.

  1. Go to the Parameters section in vehicle setup.
  2. Select the GPS tab (1), then open the GPS_2_CONFIG parameter (2) and select TELEM 2 from the dropdown list (3). QGC Serial Example
  3. Reboot the vehicle in order for the other parameters to show up.
  4. Select the Serial tab, and open the SER_TEL2_BAUD parameter (TELEM 2 port baud rate): set it to Auto. QGC Serial Baudrate Example

Deconficting Ports

Port conflicts are handled by system startup, which ensures that at most one service is run on a specific port.

At time of writing there is no user feedback about conflicting ports.

Troubleshooting

Configuration Parameter Missing from QGroundControl

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.

PX4 firmware includes most drivers by default on Pixhawk-series 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 uncommenting (or adding) the driver in the default.cmake config file that corresponds to the board you want to build for. For example, to enable the sf0x driver, you would remove the # at the beginning of the line below.

#distance_sensor/sf0x

You will then need to build the firmware for your platform, as described in Building PX4 Software (PX4 Development Guide).

Further Information

© PX4 Dev Team. License: CC BY 4.0            Updated: 2020-10-28 22:06:47

results matching ""

    No results matching ""