我希望有一个人可以帮助我.我正在尝试在ARM中进行串行端口通信(我正在使用Linux).问题是我在Windows中使用称为终端的程序,我用它来查看输出.
我有两条电缆从我的ARM连接到我的电脑的USB.我所做的是打开两个终端程序窗口,然后我连接相应的串口,直到这里一切正常.
现在,在窗口中的一个我有ARM控制台(这是ttymxc1串行端口),其中余写例如"回波你好>的/ dev/ttymxc2"(该ttymxc2是在其他窗口的其他端口).当我执行它时,somenthing出现,somenthing如下:"<0> <0> <0> <0> <0> <0> <0>".我阅读,我发现它通常是波特率的问题,所以我改变"ttymxc2"的波特率为115200像"ttymxc1"都以相同的速度.一旦我这样做,我试图再次发送相同的回声,出现这个:<0>©::*ë<0>所以,somenthig正在改变.
我得到了两个串口的所有参数,它是输出:
stty -a -F /dev/ttymxc1
speed 115200 baud;stty: /dev/ttymxc1
line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ^J;
eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd 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
stty -F /dev/ttymxc2 115200
stty -a -F /dev/ttymxc2
speed 115200 baud;stty: /dev/ttymxc2
line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd 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
我不知道哪个参数可以更改,我在终端程序中使用115200 8n1两个窗口中没有握手配置.
当我执行这个时
setserial /dev/ttymxc2 -v autoconfig
/dev/ttymxc2, UART: undefined, Port: 0x0000, IRQ: 60
和
setserial /dev/ttymxc0 -v autoconfig
/dev/ttymxc0, UART: undefined, Port: 0x0000, IRQ: 58
所以我被调查了,而且我是红色的,我必须像这样设置somenthing:
setserial /dev/ttymxc2 uart 16550A
这是输出:
setserial: can't set serial info: Invalid argument
但我不确定这是不是问题,因为ttymxc1端口也是未定义的,我可以看到ARM输出非常好,所以我很失落,我希望有人可以帮助我.
我希望解释清楚
非常感谢你
输出dmesg | grep tty:
Kernel command line: noinitrd loglevel=7 no_console_suspend console=ttymxc1,115200
fec_mac=00:05:51:07:B3:B5 mtdparts=gpmi- nand:512k(NBoot)ro,2m(UBoot)ro,256k(UBootEnv),256k
(UserDef),6m(Kernel)ro,-(TargetFS) gpmi_debug_init enable_wait_mode=off ubi.mtd=TargetFS root=ubi0:rootfs rootfstype=ubifs rootwait rw
bootconsole [ttymxc1] enabled
imx-uart.0: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX
imx-uart.1: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX
console [ttymxc1] enabled, bootconsole disabled
imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX
输出/ proc/tty/driver
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
rfcomm /dev/rfcomm 216 0-255 serial
IMX-uart /dev/ttymxc 207 16-23 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
pty_slave /dev/ttyp 3 0-255 pty:slave
pty_master /dev/pty 2 0-255 pty:master
unknown /dev/tty 4 1-63 console
我点击这个cat/proc/tty/driver/IMX-uart adn这是输出:
0: uart:IMX mmio:0x02020000 irq:58 tx:0 rx:0 DSR|CD
1: uart:IMX mmio:0x021E8000 irq:59 tx:12075 rx:358 RTS|DTR|DSR|CD
2: uart:IMX mmio:0x021EC000 irq:60 tx:0 rx:0 DSR|CD