Subject: Re: rs232 cable splitting/sharing
To: None <netbsd-help@NetBSD.org>
From: James K. Lowden <jklowden@schemamania.org>
List: netbsd-help
Date: 05/27/2006 09:32:27
Tomas D wrote:
> what
> would happen if both systems tried to send data over serial connection
> at the same time? 

At best the receiving device would get garbage.  At worst you'd damage one
or more devices.  

RS-232 works by raising and lowering voltages on the signal lines.  The
succession of voltage/no voltage detected on the receiving end is
interpreted as a series of ones and zeros.  

For it to work, the timing in critical.  (You're probably accustomed to
using RS-232 in async mode, but it can be used in synchronous mode to,
where some of those 25 pins are dedicated to carry a time signal.)  Two
machines transmitting over the same wire will not be able to coordinate
their timing.  Consequently the receiver will see not a neat succession of
on/off, but some "syncopated" sequence it won't be able to interpret.  

As for the worst case, remember that the RS-232 spec calls for voltages of
IIRC +/- 12 volts.  If two machines apply 12 volts simultaneously, there'd
be 24 on the line.  Let's only hope all the attached hardware is designed
to tolerate 2x the specificed voltage, because otherwise it's toast.  

Of course, this is just a specific instance of the general case: for two
processes to share a device, either they have to cooperate or they need an
arbitrator.  

HTH.  

--jkl