串口配置

Many serial (UART) ports on a Pixhawk board can be fully configured via parameters: e.g.: GPS1, TELEM1, TELEM2, TELEM4 (UART+I2C).

通过配置,可以轻松地(例如):

  • 更改端口上的波特率

  • 在其他端口上运行 MAVLink ,或更改流消息

  • 设置双 GPS

  • 启用在串口上运行的传感器,例如某些 距离传感器

端口预配置

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

  • MAVLink 被映射到 Telem 1 端口,端口的波特率为 57600 (对于遥测模块)。

  • 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.

如何配置端口

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 in order to make the additional configuration parameters visible.

  3. 将所选端口的波特率设置为所需值。

  4. 配置特定于模块的参数 (如 MAVLink 流和数据速率配置)。

The GPS/Compass > Secondary GPS 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).

Deconflicting Ports

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.

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

故障处理

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.

You can include the missing driver in firmware by enabling the driver in the default.px4board config file that corresponds to the board you want to build for. For example, to enable the SRF02 driver, you would a the following line to the px4board.

CONFIG_DRIVERS_DISTANCE_SENSOR_SRF02=y

An easier method would be using boardconfig which launches a GUI where you can easily search, disable and enable modules. To launch boardconfig type make <vendor>_<board>_<label> boardconfig

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

更多信息

Last updated