VIM3串口文档
硬件层面
UART Information
UART | PIN | GPIO Name | GPIO Number | DT Overlays Node | Device Node | |
---|---|---|---|---|---|---|
VIM3/3L | UART_C | 15(RX) | GPIOH_6 | 433 | uart3 | /dev/ttyS3 |
16(TX) | GPIOH_7 | 434 |
调试准备
1.编辑/boot/env.txt
文件
$sudo nano /boot/env.txt
注册串口节点.
# Device Tree Overlays
# uart3 -- Enable UART3 (uart_C, GPIO Header PIN15 & PIN16)
# pwm_f -- Enable PWM_F (GPIO Header PIN35)
# i2c3 -- Enable i2c3 (GPIO Header PIN22 & PIN23)
# spi1 -- Enable SPI1 (GPIO Header PIN15 & PIN16 & PIN35 & PIN37), pwm_f need to be removed
# i2s -- Enable I2S (GPIO Header PIN29 & PIN30 & PIN31 & PIN32 & PIN33)
# os08a10 -- Enable OS08A10 Camera
# onewire -- Enable onewire bus (GPIO Header PIN15)
# disable-ts050 -- Disable TS050 LCD
# m2x-eth -- Enable M2X 100M ethernet. Note: 1G ethernet will be disabled.
# otg-device -- Enable USB OTG Device
# watchdog -- Enable watchdog
overlays=uart3 pwm_f i2c3 i2s os08a10 watchdog
#若overlay的参数中没有uart3则添加uart3.
2.保存env.txt
文件。
3.重启VIM3.
查看串口开启情况:
$ls /dev/ttyS3
/dev/ttyS3
硬件连接
将VIM3的p15和p16分别使用杜邦线连接至USB转串口模块上,打开pc的串口调试助手,我使用的是sscom。
安装相应的驱动以及打开串口,调整串口波特率,这里使用115200
串口调试
图形化调试
需要用到minicom以及cutecom图形化调试软件。
1.安装
#安装两个软件包
$sudo apt-get install minicom
$sudo apt-get install cutecom
2.配置
sudo minicom -s
1.配置Serial port setup
2.配置Modem and dialing
3.保存配置
注意:非正常关闭minicom,会在/var/lock下创建几个文件LCK*,这几个文件阻止了minicom的运行,将它们删除后即可恢复
至此,配置基本完毕
下面开始调试
3.调试
打开cutecom
选择串口
注:ttyS3是刚才添加的串口。
确保VIM3已经通过串口模块连接至电脑,且工地,rx tx反接。
打开cutecom,使用sscon即可收发信息。
也可使用
cat /dev/ttyS3
命令查看串口接收到的信息
使用命令
echo message > /dev/ttyS3
通过串口发送字符串message。
[外链图片转存中...(img-82KOaruj-1667454933895)]
命令查看串口接收到的信息
使用命令
```shell
echo message > /dev/ttyS3
通过串口发送字符串message。
参考文章
https://blog.csdn.net/lxiao428/article/details/122439945