'Spurious transmission when reading from serial port under linux (ttyUSB..)

I have a USB to RS485 converter connected to my linux box:

ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

and it is currently st up using

stty -F /dev/ttyUSB0 raw 57600

So when I write some characters to the device (using echo or the similar on the console) I can monitor the TX LED flash and I can clearly identify the characters on an oscilloscope.

However, when I try to read characters from it something weird happens:

  • I connected a simple teletyper to the RS485 output.
  • When I type a couple of characters on it I can watch the oscilloscope and I notice the flashing of the RX LED in the converter.
  • Then I start reading from the device, e.g. using cat /dev/ttyUSB0.
  • Now whenever I type a character on the teletyper both the RX and TX LEDs flash, and as expected, I can see garbled signals on the oscilloscope as RS485 is only half-duplex. So basically the teletyper is using the lines at the same time as the linux box seems to send something, causing a clash.
  • When I kill the cat process this stops and everything is fine again.

I have never witnessed this before. What am I missing?



Solution 1:[1]

As you were.

It's the line discipline: The linux box has had its echo enabled, so it actually echoed back every incoming character.

The solution is to disable this:

stty -F /dev/ttyUSB0 -echo

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamajii