Linux 中 RS232 的 LF/CR 问题
我一直遇到这个问题,每当我在 Linux 操作系统中通过 RS-232 发送 0xA 时,接收器都会将其解释为 2 个字节,0xD 和 0xA。此外,每当我收到 0xD 时,串行端口都会将其解释为 0xA。我一直在阅读有关此的已知问题,有人能够找到解决方案吗?
I've been having this problem where anytime I send a 0xA through an RS-232 in a Linux OS the receiver interprets that as 2 bytes, 0xD and 0xA. Also whenever I receive 0xD the serial port interprets that as 0xA. I've been reading that there are known issues regarding this, has anybody been able to find a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人遇到这个问题,我找到了解决方法。
只需在终端中输入这些命令,问题就消失了
/dev/ttyUSB0 可以替换为您正在使用的任何文件描述符。
显然 Linux 默认设置了这些设置。 (我不知道为什么)
If anybody is having this issue I found a work around.
Simply type these commands in the terminal, and the issue went away for me
/dev/ttyUSB0 can be replaced with whatever file descriptor you are using.
Apparently Linux has these settings set by default. (I don't why)