1、查看 串口波特率
busybox stty -F /dev/ttyS0
stty - 改变并打印终端行设置
总览
stty [-F device] [--file=device] [SETTING]...
stty [-F device] [--file=device] [-a|--all]
stty [-F device] [--file=device] [-g|--save]
描述
quot; Add any additional description here
打印或改变终端属性.
-a, --all
以可读的格式打印当前的所有设置
-g, --save
以终端可读的格式打印当前的所有设置
-F, --file
打开指定的设备,并用此设备作为输入来代替标准输入
--help
显示帮助并退出
--version
2、设置串口波特率
方法1、stty 命令设置tty波特率:
busybox stty -F /dev/ttyS0 raw speed 115200min 0 time 2
方法2、busybox microcom -t 5000 -s 115200 /dev/ttyS0
mircocom -h
microcom: invalid option – ‘h’
BusyBox v1.22.1 (2015-07-31 13:40:35 CST) multi-call binary.
Usage: microcom [-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY
Copy bytes for stdin to TTY and from TTY to stdout
-d Wait up to DELAY ms for TTY output before sending every next byte to it
-s Set serial line to SPEED
-X Disable special meaning of NUL and Ctrl-X from stdin
串口输出:
echo aaaaaa > /dev/ttyS3
串口读取:
cat /dev/ttyS3
写之后读:
echo 0 > /dev/ttyUSB0 | cat /dev/ttyS3