Ubuntu-Jetson TX1串口使用教程

xiaoxiao2021-02-28  166

查看串口

1)ls -l /dev/ttyS* 2)Jetson TX1 下串口查看:ls -l /dev/ttyTHS*

root@tegra-ubuntu:/ssdb/caffe# ls -l /dev/ttyTHS* crw-rw---- 1 root dialout 240, 1 Jul 10 02:56 /dev/ttyTHS1 crw-rw---- 1 root dialout 240, 2 Jul 10 02:56 /dev/ttyTHS2 crw-rw---- 1 root dialout 240, 3 Jul 10 02:56 /dev/ttyTHS3

查看串口驱动

root@tegra-ubuntu:/ssdb/caffe# cat /proc/tty/driver/serial serinfo:1.0 driver revision: 0: uart:Tegra mmio:0x70006000 irq:68 tx:214023 rx:0 RTS|CTS|DTR|RI 1: uart:unknown port:00000000 irq:0 2: uart:unknown port:00000000 irq:0 3: uart:unknown port:00000000 irq:0

3)查看串口设备: dmesg | grep ttyS* Jetson TX1下:dmesg | grep ttyTHS*

root@tegra-ubuntu:/ssdb/caffe# dmesg | grep ttyTHS* [ 2.287956] 70006040.serial: ttyTHS1 at MMIO 0x70006040 (irq = 69) is a SERIAL_TEGRA [ 2.299250] 70006200.serial: ttyTHS2 at MMIO 0x70006200 (irq = 78) is a SERIAL_TEGRA [ 2.317234] 70006300.serial: ttyTHS3 at MMIO 0x70006300 (irq = 122) is a SERIAL_TEGRA

使用串口

查看串口是否可用,可以对串口发送数据比如对com1口,

echo hello > /dev/ttyTHS1

设置波特率(临时):

stty -F /dev/ttyTHS2 115200 stty -F /dev/ttyUSB0 115200 gtkterm -p /dev/ttyTHS2 -s 115200 & gtkterm -p /dev/ttyUSB0 -s 115200 &

查看

stty -a -F /dev/ttyTHS2 speed 115200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

详细串口编程见: Linux下的串口编程(二) 6.7.2 设置串口通信参数 is J17 /dev/ttyTHS1 or /dev/ttyTHS2?

转载请注明原文地址: https://www.6miu.com/read-21112.html

最新回复(0)