简体   繁体   中英

LF/CR issue with RS232 in Linux

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?

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

"stty -F /dev/ttyUSB0 -onclr"
"stty -F /deb/ttyUSB0 -icrnl"

/dev/ttyUSB0 can be replaced with whatever file descriptor you are using.

Apparently Linux has these settings set by default. (I don't why)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM