6

I'm trying to determine the difference when I open serial port with hardware handshake and none handshake.

It seems that in both cases I have to control RTS/CTS signals (just tested it with one COM device). So what the difference between opening serial port with hardware handshake and without handshaking?

From my previous understanding, when we work without handshaking, we don't care about RTS/CTS and DTR/DSR signals. Just send and receive data whenever we want. Was I wrong?

One more question. Can we work without handshaking in full duplex mode only?

Charles
  • 50,943
  • 13
  • 104
  • 142
Alex Klaus
  • 8,168
  • 8
  • 71
  • 87

2 Answers2

7

As you probably know, the issue is "flow control". Like the Clash song "Should I stay or should I go?".

RTS/CTS is hardware control. XON/XOFF is software control. Otherwise, "just keep going".

This link might explain further:

http://www.lammertbies.nl/comm/info/RS-232_flow_control.html

I suspect that when you were asking about "handshaking" with respect to "duplex", perhaps you meant this:

http://en.wikipedia.org/wiki/RS-232

In older versions of the specification, RS-232's use of the RTS and CTS lines is asymmetric: The DTE asserts RTS to indicate a desire to transmit to the DCE, and the DCE asserts CTS in response to grant permission. This allows for half-duplex modems that disable their transmitters when not required, and must transmit a synchronization preamble to the receiver when they are re-enabled.

'Hope that helps!

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • 3
    Thanks @paulsm4. But I'm trying to find the difference in terms of operating by `RTS/CTS` signals: - Should I set/check `RTS/CTS` signals if I open serial port without `flow control`? Should I do these things manually if I open serial port with `hardware flow control`? - Can I set `RTS to High` after opening the port and don't touch it after that? Is it good practice? - In half duplex mode how can I change `CTS` signal to prevent data receiving? It seems I can set `RTS` and `DTR` signals and just check `CTS` and `DSR` signals. – Alex Klaus Sep 28 '11 at 22:29
  • @paulsm4 It's been 10 years but this link is really useful. Thanks! I'm currently implementing this dinosaur technology – Sin Han Jinn Nov 02 '21 at 08:19
1

The difference is more about whether the kernel will pay attention to the CTS/RTS lines when deciding whether to send more data or not. With hardware handshaking turned on, it will. With it set to none, it won't, even though the CTS/RTS lines may stay asserted, so that the peer will know it can send data.

LeoNerd
  • 8,344
  • 1
  • 29
  • 36