Data Communications

Lecture 6 - Real World Stuff: RS232

Well... kinda...

What is RS232?

It is the standard defined for the connection of "Data Terminal Equipment" (DTE) to "Data Communications Equipment" (DCE) where:

  • DTE (Data Terminal Equipment) is a generic term for an item which forms part of the "information processing" portions of a system. Examples are: computer, printer, terminal.
     
  • DCE (Data Communications Equipment) is a device which provides an interface between a DTE and a communications link. Generally used as another word for "modem"...
     

The intended way of connecting these together is:

The RS232 standard defines:

  • Mechanical details (connector size etc.)

  • Electrical details - voltage levels for "1" & "0"

  • Data format, timing.

  • How "control" is performed

RS232/V.24 Interface

This is the "classic" interface for DTE/DCE connections. It is based on a 25-pin plug and socket, of which only 8 pins (often less) are normally used:

Most computers used to have at least one RS232-compatible serial I/O port: in fact, the term RS232 port was widely used as a synonym for serial port. Typically these can operate at all "standard" bit rates from 300 bps to 115 kbps (or 230 kbps on Apple Macintoshes).

These days RS232 has largely been replaced by the Universal Serial Bus (USB) which we'll cover in a later lecture...

A Pin-by-Pin Tour of RS232/V.24

All signals are "ground referenced" to pin 7.

TxD, RxD
Transmit and receive data pins
RTS
Request To Send, from DTE
CTS
Clear To Send, from DCE, together with RTS, originally used to "turn around" half-duplex modems, see later.
DTR
Data Terminal Ready, indicates to the modem that a DTE is connected and enabled.
DSR
Data Set Ready, indicates to the DTE that the modem is present and turned on.
CD
Carrier Detect, indicates that this modem is receiving a signal from the remote modem.

RS232 Specification

The RS232 specification details:

  • Signal levels:
     
    Logic 1 (MARK) < -3V
    Logic 0 (SPACE) > +3V
     
  • Control signals - the same voltage levels are used, except that positive voltage indicates that the signal is enabled.
  • Impedance (capacitance, inductance and resistance) of cable.
  • Rise and fall time of signals (which, together with the impedance specification, affect the maximum allowable data rate and cable length).
  • Type of connector (ITT Cannon Type DB25), although...

RS232 - Why is it so difficult?

RS232 interfaces caused many problems. Some typical reasons:

  • Designed for DTE-DCE connections, but commonly used to connect DTE-DTE - introduces need for a null modem, and all the awfulness that naturally ensues...
  • Non standard use of handshaking signals for flow control, see later
  • Non-standard connectors, eg: 9-pin PC format, 9-pin SGI (AT&T) format, mini-DIN 8 pin (Apple, etc)

Flow Control and "Hardware Handshaking"

RTS/CTS
These signals are often now used to throttle the rate at which data is delivered between a DTE and modem: the DTE "drops" RTS when its buffers are nearly full, and the modem does the same using the CTS signal. This is nowadays referred to as "hardware handshaking".
 
It's worth noting that "modern" high-speed modems almost universally use the RTS/CTS pair for this purpose. In fact, without hardware handshaking, data compression in modems would not be possible.
DTR/DSR and CD
These signals are occasionally used in a similar way to RTS/CTS, particularly between computers and printers. This is very non-standard use of RS232!
Also note
Some systems use "in band" flow control (or XON/XOFF), in which the ASCII characters DC1 (XOFF) and DC3 (XON) are reserved - when one end sends DC3, the other stops transmitting until it receives a DC1 signal. This is considered poor style...

"Asynchronous" Bit Level Synchronisation

Very common in low volume & low bit rate links or where data is isolated characters at random intervals. Virtually all "RS232 ports" use this technique.

Two synchronisation or "framing" bits are added to each byte of data:

Note that there is an indeterminant period of time between transmission of each byte (or character) in this system.

The receiving UART normally samples the incoming signal in the centre of each bit cell, using a x16 local clock to determine bit timing.

Asynchronous Observations

Asynchronous transmission makes inefficient use of a link: for each byte transmitted there is a fixed overhead of 1 start bit and 1 stop bit: using 8 bits of data + 2 bits sync overhead means efficiency is fixed at 80%.

The break signal is a special "out of band" asynchronous condition consisting of a SPACE (logic 0) level of longer duration than a character, thus:

The receiving Universal Asynchronous Receiver/Transmitter (UART) sees the break signal as an ASCII <NUL> character (char 0) received with a framing error.

Balanced vs. Unbalanced Interfaces

RS232 signals are "ground referenced" to pin 7 - this means that all of signal voltages are +ve or -ve with respect to this zero-voltage reference. This is called an "unbalanced" or "single-ended" interface.

A characteristic of this type of interface is susceptability to noise interference:

In a "balanced" or "differential" interface, two wires are used for each signal and the information is carried in the voltage difference between them. A "noise hit" on the line tends to effect both wires roughly equally, so that the signal is relatively immune to interference:

Other Interfaces

There are many, much more modern, alternatives to RS232 for DTE-DCE interconnections:

RS449/422/423
Designed by EIA to replace RS232 and technically far superior, these standards have never enjoyed wide success in the market[1]. RS449 defined the pin functions, RS422 defined balanced mode circuit usage, and RS423 defined an unbalanced mode similar to (and compatible with) RS232. RS449/422 could operate at moderate speed over long distances.
X.21
A CCITT (ITU) specification which was designed for connecting DTE equipment directly to digital public carrier links. Was used by (the then) Telecom Australia Digital Data Service (DDS) and X.25 Austpac services. X.21 used balanced signalling. The X.21bis variation is an unbalanced interface, essentially the same as RS232/V.24 for connecting older equipment
V.35
An ITU variation on RS449 et al.

[1] Except on Apple Macs and some Unix workstations.

References

Stallings: Chapter 6.1 (pp. 182-184)