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

查看:25
本文介绍了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

推荐答案

查看你的串口设置,最有可能的罪魁祸首是 -itrip.根据 手册页-itrip 将剥离返回的字节的高位.

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 使用的设置与以下 stty 行相同:

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

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

As for not returning any data when you send the command, have you tried making sure that you are sending 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
" > /dev/ttyACM0

(调制解调器应该响应OK )

(the modem should respond OK )

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

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