px4でUARTデバイスと通信する(途中)

Pixhawk 1のピン配置

f:id:seinzumtode:20210812225449p:plain

FMU v3のUART定義
PX4-Autopilot/ROMFS/px4fmu_common/init.d/rcS

#
# UART mapping on FMUv2/3/4:
#
# UART1         /dev/ttyS0      IO debug (except v4, there ttyS0 is the wifi)
# USART2        /dev/ttyS1      TELEM1 (flow control)
# USART3        /dev/ttyS2      TELEM2 (flow control)
# UART4
# UART7                         CONSOLE
# UART8                         SERIAL4

SERIAL4はUART8で参照できる。

この人のコメントにヒントが書いてある。

UART8(=SERIAL4)のBaudrateはここで指定できる
PX4-Autopilot/platforms/nuttx/nuttx-configs/px4fmu-v2/nsh/defconfig

#
# UART8 Configuration
#
CONFIG_UART8_RXBUFSIZE=300
CONFIG_UART8_TXBUFSIZE=300
CONFIG_UART8_BAUD=57600
CONFIG_UART8_BITS=8
CONFIG_UART8_PARITY=0
CONFIG_UART8_2STOP=0
# CONFIG_UART8_IFLOWCONTROL is not set
# CONFIG_UART8_OFLOWCONTROL is not set
# CONFIG_UART8_DMA is not set
# CONFIG_PSEUDOTERM is not set
CONFIG_USBDEV=y

nuttxのdefconfigを更新したらmake cleanせよとのこと。