views:

428

answers:

2

What are the implications of using a half-duplex serial connection versus a full-duplex one? What happens if both sides try sending data at the same time? Do you end up with corrupt data arriving on both ends? Does flow-control help you with this?

A: 

My God, where did you find a half-duplex line in this day and age?

Anyway, the answer is that if both ends drive the line, it gets all confused. For this reason, there are specified ASCII characters lie Clear to Send and Data Terminal Ready (CTS and DTR) that are used to make a handshake. See this tutorial for more.

Augh, I should have gone to bed. Tutorial right, me stoopid.

Charlie Martin
Well, I stand corrected.
Chris
And I have never, ever seen a serial port without dedicated send/receive pins.
Chris
Oh dear, this is wrong on so many levels. CTS and DTR are control lines, not ASCII characters. For flow control (not handshaking!) RTS and CTS are used, DTR is more like a global "On"-switch. And for half duplex this usually won't do anyway ...
starblue
Starblue, you seem to be familiar with RS-232. Can you please take a crack at answering the question?
Gili
+3  A: 

On the line the data will be garbled, which may or may not lead to devices receiving the garbled data. Sometimes this will be used to detect that the transmission failed due to a collision.

Normally you wouldn't use half-duplex in the same way as full-duplex to send single characters in asynchronous mode. Rather you'd use some packet protocol which determines who has the right to send at which times, and which includes some checksum (usually a CRC) to detect corruption.

Flow control doesn't help much for this. It's purpose is to ensure that the receiver is not overrun by to much data. There is software flow control which uses the ASCII characters XON and XOFF to start and stop transmission, and hardware flow control which uses the RTS (Request To Send) and CTS (Clear To Send) control lines. XON/XOFF-style software flow control won't work with half duplex.

These days you don't see half duplex with ordinary RS-232 and modems (I used it with acoustic couplers in the eighties, it was rare even then). But it is common for RS-485, which is used in industrial control with various protocols. There are also many other data transmission standards which operate in a half-duplex way, mostly when there are more than two devices attached to the same line (ancient 10base2 Ethernet, CAN, LIN, FlexRay, I2C, ...).

starblue
On the one hand you write that "software flow control won't work with half duplex". On the other hand you write "you'd use some packet protocol which determines who has the right to send at which times".Why would the latter work if the former fails?Aren't they both software-based controls that might fail in the context of half-duplex?Isn't there a way to use RTS/CTS to control who has the right to send when?
Gili