mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 19:03:33 +08:00
New Crowdin translations - zh-CN (#25965)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
co-authored by
Crowdin Bot
parent
7f8d2b5067
commit
faedf252b3
@@ -1,27 +1,27 @@
|
||||
# 串口映射
|
||||
|
||||
This topic shows how to determine the mapping between USART/UART serial port device names (e.g. "ttyS0") and the associated ports on a flight controller, such as `TELEM1`, `TELEM2`, `GPS1`, `RC SBUS`, `Debug console`.
|
||||
本主题说明如何确定USART/UART串行端口(下称串口)设备名称(例如“ttyS0”)与飞行控制器上对应端口(如`TELEM1`、`TELEM2`、`GPS1`、`RC SBUS`、`调试控制台(Debug console)`)之间的映射关系。
|
||||
|
||||
The instructions are used to generate serial port mapping tables in flight controller documentation.
|
||||
For example: [Pixhawk 4 > Serial Port Mapping](../flight_controller/pixhawk4.md#serial-port-mapping).
|
||||
这份说明用于在飞行控制器文档中生成串行端口映射表。
|
||||
例如: [Pixhawk 4 > Serial Port Mapping](../flight_controller/pixhawk4.md#serial-port-mapping)。
|
||||
|
||||
:::info
|
||||
The function assigned to each port does not _have to_ match the name (in most cases), and is set using a [Serial Port Configuration](../peripherals/serial_configuration.md).
|
||||
Usually the port function is configured to match the name, which is why the port labelled `GPS1` will work with a GPS out of the box.
|
||||
每个端口分配的功能不必与名称匹配(大多数情况下),并通过[串行端口配置](../peripherals/serial_configuration.md)。
|
||||
通常情况下端口功能是与名称相匹配的,因此标记为`GPS1`的端口可直接连接GPS设备。
|
||||
:::
|
||||
|
||||
## NuttX on STMxxyyy
|
||||
## NuttX 在 STMxxyyy 上
|
||||
|
||||
<!-- instructions from DavidS here: https://github.com/PX4/PX4-user_guide/pull/672#issuecomment-598198434 -->
|
||||
|
||||
This section shows how to get the mappings for NuttX builds on STMxxyyy architectures by inspecting the board configuration files.
|
||||
The instructions use FMUv5, but can similarly be extended for other FMU versions/NuttX boards.
|
||||
本节将展示如何通过检查板载配置文件,获取在STMxxyyy架构上构建NuttX所需的映射信息。
|
||||
该说明使用FMUv5,但同样可扩展至其他FMU版本/NuttX开发板。
|
||||
|
||||
### default.px4board
|
||||
###
|
||||
|
||||
The **default.px4board** lists a number of serial port mappings (search for the text "SERIAL_PORTS").
|
||||
**default.px4board** 文件列出了若干串行端口映射(搜索文本“SERIAL_PORTS”)。
|
||||
|
||||
From [/boards/px4/fmu-v5/default.px4board](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/default.px4board):
|
||||
来自 [/boards/px4/fmu-v5/default.px4board](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/default.px4board):
|
||||
|
||||
```
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS0"
|
||||
@@ -30,7 +30,7 @@ CONFIG_BOARD_SERIAL_TEL2="/dev/ttyS2"
|
||||
CONFIG_BOARD_SERIAL_TEL4="/dev/ttyS3"
|
||||
```
|
||||
|
||||
Alternatively you can launch boardconfig using `make px4_fmu-v5 boardconfig` and access the serial port menu
|
||||
或者,您可以通过执行 `make px4_fmu-v5 boardconfig` 启动板配置工具,并进入串口菜单。
|
||||
|
||||
```
|
||||
Serial ports --->
|
||||
@@ -48,12 +48,12 @@ Alternatively you can launch boardconfig using `make px4_fmu-v5 boardconfig` and
|
||||
|
||||
### nsh/defconfig
|
||||
|
||||
The _nsh/defconfig_ allows you to determine which ports are defined, whether they are UART or USARTs, and the mapping between USART/UART and device.
|
||||
You can also determine which port is used for the [serial/debug console](../debug/system_console.md).
|
||||
_nsh/defconfig_ 允许您确定哪些端口被定义,它们是 UART 还是 USART,以及 USART/UART 与设备之间的映射关系。
|
||||
您还可以确定用于该功能的端口[serial/debug console](../debug/system_console.md)。
|
||||
|
||||
Open the board's defconfig file, for example: [/boards/px4/fmu-v5/nuttx-config/nsh/defconfig](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/nuttx-config/nsh/defconfig#L215-L221)
|
||||
打开板载的 defconfig 配置文件,例如:[/boards/px4/fmu-v5/nuttx-config/nsh/defconfig](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/nuttx-config/nsh/defconfig#L215-L221)
|
||||
|
||||
Search for the text "ART" until you find a section like with entries formatted like `CONFIG_STM32xx_USARTn=y` (where `xx` is a processor type and `n` is a port number).
|
||||
搜索文本“ART”,直到找到类似以下格式的条目:`CONFIG_STM32xx_USARTn=y`(其中`xx`表示处理器类型,`n`表示端口号)。
|
||||
例如:
|
||||
|
||||
```
|
||||
@@ -66,10 +66,10 @@ CONFIG_STM32F7_USART3=y
|
||||
CONFIG_STM32F7_USART6=y
|
||||
```
|
||||
|
||||
The entries tell you which ports are defined, and whether they are UART or USART.
|
||||
这些条目会告知您哪些端口已被定义,以及它们属于UART还是USART。
|
||||
|
||||
Copy the section above and reorder numerically by "n".
|
||||
Increment the device number _ttyS**n**_ alongside (zero based) to get the device-to-serial-port mapping.
|
||||
复制上方段落,按“n”进行数字排序。
|
||||
同时递增设备编号ttySn(基于零的计数),以获取设备到串行端口的映射关系。
|
||||
|
||||
```
|
||||
ttyS0 CONFIG_STM32F7_USART1=y
|
||||
@@ -81,8 +81,8 @@ ttyS5 CONFIG_STM32F7_UART7=y
|
||||
ttyS6 CONFIG_STM32F7_UART8=y
|
||||
```
|
||||
|
||||
To get the DEBUG console mapping we search the [defconfig file](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/nuttx-config/nsh/defconfig#L212) for `SERIAL_CONSOLE`.
|
||||
Below we see that the console is on UART7:
|
||||
要获取调试控制台映射,我们需在[defconfig file](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/nuttx-config/nsh/defconfig#L212) 搜索 `SERIAL_CONSOLE`.
|
||||
下面我们看到控制台位于UART7:
|
||||
|
||||
```
|
||||
CONFIG_UART7_SERIAL_CONSOLE=y
|
||||
@@ -90,9 +90,9 @@ CONFIG_UART7_SERIAL_CONSOLE=y
|
||||
|
||||
### board_config.h
|
||||
|
||||
For flight controllers that have an IO board, determine the PX4IO connection from **board_config.h** by searching for `PX4IO_SERIAL_DEVICE`.
|
||||
对于配备IO板的飞行控制器,请通过在**board_config.h**文件中搜索`PX4IO_SERIAL_DEVICE`来确定PX4IO连接。
|
||||
|
||||
For example, [/boards/px4/fmu-v5/src/board_config.h](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/src/board_config.h#L59):
|
||||
例如 [/boards/px4/fmu-v5/src/board_config.h](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/src/board_config.h#L59):
|
||||
|
||||
```
|
||||
#define PX4IO_SERIAL_DEVICE "/dev/ttyS6"
|
||||
@@ -101,11 +101,11 @@ For example, [/boards/px4/fmu-v5/src/board_config.h](https://github.com/PX4/PX4-
|
||||
#define PX4IO_SERIAL_BASE STM32_UART8_BASE
|
||||
```
|
||||
|
||||
So the PX4IO is on `ttyS6` (we can also see that this maps to UART8, which we already knew from the preceding section).
|
||||
PX4IO 位于 `ttyS6` 上(我们还可以看到它映射到 UART8,这一点我们从前一节已经知道)。
|
||||
|
||||
### Putting it all together
|
||||
### 整合所有内容
|
||||
|
||||
The final mapping is:
|
||||
最终映射表如下:
|
||||
|
||||
```
|
||||
ttyS0 CONFIG_STM32F7_USART1=y GPS1
|
||||
@@ -117,17 +117,17 @@ ttyS5 CONFIG_STM32F7_UART7=y DEBUG
|
||||
ttyS6 CONFIG_STM32F7_UART8=y PX4IO
|
||||
```
|
||||
|
||||
In the [flight controller docs](../flight_controller/pixhawk4.md#serial-port-mapping) the resulting table is:
|
||||
在 [flight controller docs]../flight_controller/pixhawk4.md#serial-port-mapping最终生成的表格如下:
|
||||
|
||||
| UART | 设备 | Port |
|
||||
| ------ | ---------- | ---------------------------------------- |
|
||||
| UART1 | /dev/ttyS0 | GPS |
|
||||
| USART2 | /dev/ttyS1 | TELEM1 (flow control) |
|
||||
| USART3 | /dev/ttyS2 | TELEM2 (flow control) |
|
||||
| UART4 | /dev/ttyS3 | TELEM4 |
|
||||
| USART6 | /dev/ttyS4 | RC SBUS |
|
||||
| UART7 | /dev/ttyS5 | Debug Console |
|
||||
| UART8 | /dev/ttyS6 | PX4IO |
|
||||
| UART | 设备 | Port |
|
||||
| ------ | ---------- | ------------------------------ |
|
||||
| UART | UART | GPS |
|
||||
| USART2 | /dev/ttyS1 | TELEM1 (流控) |
|
||||
| USART3 | /dev/ttyS2 | TELEM2 (流控) |
|
||||
| UART4 | /dev/ttyS3 | TELEM4 |
|
||||
| USART6 | /dev/ttyS4 | RC SBUS |
|
||||
| UART7 | /dev/ttyS5 | 调试控制台 |
|
||||
| UART8 | /dev/ttyS6 | PX4IO |
|
||||
|
||||
## Other Architectures
|
||||
|
||||
@@ -135,7 +135,7 @@ In the [flight controller docs](../flight_controller/pixhawk4.md#serial-port-map
|
||||
Contributions welcome!
|
||||
:::
|
||||
|
||||
## See Also
|
||||
## 另见
|
||||
|
||||
- [Serial Port Configuration](../peripherals/serial_configuration.md)
|
||||
- [MAVLink Telemetry (OSD/GCS)](../peripherals/mavlink_peripherals.md)
|
||||
|
||||
Reference in New Issue
Block a user