USB调制解调器回显错误的字符 [英] USB Modem is echoing back wrong characters

查看:115
本文介绍了USB调制解调器回显错误的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在端口ttyACM0上连接了USB调制解调器.当我打开像Minicom这样的应用程序并尝试向其发送一些命令时,回声并不总是我键入的内容.例如,如果我输入"A",则会得到"@".如果我输入"T",我会得到"T".似乎串行端口正在剥夺我传输的最低有效位.例如:

I have a USB modem connected on port ttyACM0. When I open an application like Minicom and try to send it some commands, the echo back is not always what I type. For example, if I type in "A", I get "@". If I type in "T", I do get "T". It seems that the serial port is stripping the least significant bit off of my transmission. For example:

A = @

B = B

C = B

D = D

E = D

F = F

...等等.我以为我的串行端口配置有问题,但是我尝试了每种组合似乎都没有运气的情况.我可能错过了一些简单的事情,但是没有明显的迹象显示给我.任何想法可能有什么问题吗?我的串行端口配置如下所示:

... and so on. I assume there is something wrong with my serial port configuration, but I've tried what seems like every combination and no luck. I'm probably missing something easy, but nothing obvious is sticking out to me. Any idea what may be wrong? My serial port configuration is listed below:

# stty -F /dev/ttyACM0 -a
speed 9600 baud;stty: /dev/ttyACM0
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^H; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt =     ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 100; time = 2;
-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

推荐答案

查看您的串行端口设置,最可能的罪魁祸首是-istrip.根据手册页-istrip将剥离字节的高位回来.

Looking at your serial port settings, the most likely culprit here is -istrip. According to the man page, -istrip will strip off the upper bit of the bytes that come back.

鉴于您还有许多其他的串行端口设置,那么驱动程序也可能会出现怪异的问题.我不知道minicom使用什么设置以及如何精确地设置它们(我通常使用GTKTerm),但是我的经验是GTKTerm使用的设置将始终有效并且避免输入/输出中出现任何奇怪的字符.

Given that you have a lot of other serial port settings, you may be having weird issues with the driver as well. I don't know what settings minicom uses and how exactly to set them up(I generally use GTKTerm), but my experience has been the settings that GTKTerm uses will always work and avoid any odd characters in the input/output.

GTKTerm使用的设置与以下样式栏相同:

The settings that GTKTerm uses are the same as the following stty line:

stty -F /dev/ttyS0 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

至于在发送命令时不返回任何数据,您是否尝试过确保在命令末尾发送\r\n?也有可能您正在使用的串行端口设置之一正在转换CR/NL组合.如果正确设置了所有端口设置,则调制解调器应在执行以下操作时回复:

As for not returning any data when you send the command, have you tried making sure that you are sending \r\n at the end of your command? There's also the possibility that one of the serial port settings that you are using is translating a CR/NL combination. If all the port settings are set correctly, the modem should respond back when you do something like the following:

cat /dev/ttyACM0 &
/bin/echo -n -e "AT\r\n" > /dev/ttyACM0

(调制解调器应响应OK\r\n)

这篇关于USB调制解调器回显错误的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆