DTE-DCE Connection

Typical Interface between DTE and RS-232C Line

RS-232C like data transfers are usually asynchronous with a start bit (SPACE) and one or two stop bits (MARK). Microprocessor controllers  called UART serialize the information. They work between 0 or +5 V; interface circuits which inverts the electrical levels create the RS-232C +12V and -12 V voltages as shown in Figure 7. MC1488 is used to convert TTL signal to RS-232 signal and MC1489 is used to convert RS-232 signal to TTL signal.

The two data transfer lines are called TXD (transmit data) and RXD (receive data).  There is an inconsistency associated with the mnemonic names of these two lines; since the data bit values on the lines are inverted (logical 0 is +12V), these mnemonics should be inverted and an inverting circle shown on the side of the line.  Due to the fact that the stop bit is a "one" level, and the start bit is a low state, the line looks like an active high line with a steady state at "zero".

The start bit is usually considered as an active signal and nothing in the notation shows that the data bits are inverted on the line.  We will be more precise in our documentation and write TXD, RXD to show that the data signals on the line are considered as non-inverted signals, but transfer inverted data information. On the serial interface chip, the data is called, as all manufacturer's do, TXD and RXD. The control signals RTS and CTS generally use correct naming conventions; they are inverted on the UART pins (active low), and usually shown as such.

Protocol

Two types of protocols should be considered in data communication environment: terminal protocols and data link protocols.

Terminal protocol

A protocol, an agreed set of rules, is required between a DTE and a DCE in order to transmit digital data synchronously or asynchronously. The protocol between a DTE and a DCE is known as terminal protocol. Handshake signals or control signals are required to maintain terminal protocol. Some commonly used handshake signals are as follows:

DTR          

data terminal ready After the terminal is turned on and terminal runs any self checks, this signal is asserted to tall the modem it is ready.
DSR data set ready is asserted when the modem is ready to transmit or receive data
RTS request to send Asserted by the terminal when it is ready to send a character.
DCD data carrier detected Asserted by modem to indicate that it has established contact with computer
CTS clear to send indicated of the DCE to the DTE that DCE is ready (clear) to send data to DTE
RI ring indicator indication of the DCE (modem) to the DTE (terminal) that a ring indicator signal is received

Data Link Protocol

DTE-DCE Connection Using RS-232C Terminal Protocol

RS-232C control signals help the establishment of communications over telephone lines through a modem (figure 8). Two lines (DTR and DSR) check readiness of DTE-DCE connection. Two lines from the modem (R1 and DCD) are related to the establishment of the communication and the presence of the modulation. Two lines (RTS and CTS) control the transfer of the information.

Figure 8: Control Signals of a DTE/DCE Interface

 

RS232 PROTOCOL

DTR After the terminal is turned on and terminal runs any self checks, this signal is asserted to tell the modem it is ready. 
DSR Is asserted when the modem is ready to transmit or receive data.
RTS Asserted by the terminal when it is ready to send a character.
CD Asserted by Modem to indicate that it has established contact with computer.
CTS Asserted when modem is fully ready to transmit data.
Terminal then sends serial data to modem
RTS Deasserted to indicate all characters have been sent.
CTS Modem deasserts and stops transmission.

DTE-DTE Connection

SEQUENCE

  1. Terminal power on - DTR
  2. Modem power on - DSR
  3. Modem dials up remote computer
  4. If computer is available, it will send back a specified tone - Link established  
  5. Terminals wants to send a character - RTS
  6. Modem Asserts CD.
  7. When modem is ready to transmit - CTS.
  8. Terminal sends character serially and Modem transmits.
  9. Transmission over - Terminal makes RTS high.
  10. Modem makes CTS high and Stops transmission.

Here is a sequence of signals that might occur between a DTE and a DCE when a user at a DTE wants to send some data to other DTE via modems and telephone line. After the terminal power is turned on and the terminal runs the self checks, it asserts the data terminal ready (DTR) signal to tell the modem that it is ready. When it is powered up and ready to transmit or receive data, the modem will assert the data set ready (DSR) signal to the terminal. Under manual control or terminal control the modem then dials up the computer.

If the computer is available, it will send back a specified tone. Now, when the terminal has a character actually ready to send, it will assert the request to send (RTS) signal to the modem. The modem will then assert its data carrier detected (DCD) signal to the terminal to indicate that it has established contact with the computer. When the modem is fully ready to transmit data, it asserts the clear to send (CTS) signal back to the terminal. The terminal then sends serial data characters to the modem. When the terminal has sent all the characters it needs to, it makes RTS signal high. This causes the modem to unassert its CTS signal and stop transmitting. A similar handshakes occurs between the modem and the computer at the other end of data link.

 

DTE-DTE Connection Through Modem

Figure 9 shows how to connect a DTE to another distant DTE through modems and telephone line.

Figure 9: Digital Data Transmission Using Modems and Standard Telephone Lines

At his point, we need to know how the communication takes place between two DTEs as shown in Fig.9. A typical communication between two DTEs is established according to Figure 10. The case of a full duplex transmission, when RTS and CTS are both active is shown figure 10.a. For half duplex communication, data is sent alternately in one direction and then in the other. Data link protocol decides the direction and the unit which is able to transmit, activates RTS and waits for CTS active before carrying out the transfer (figure 10.b.) Detailed description of the figures are left as an exercise for the readers. The knowledge of data link protocol is required in order to explain Figure 10. It may be noted that when the data to be transferred on the RS-232 is not structured, there is a risk of overflow of the input buffer. The receiver sends XOFF character to tell the transmitter to stop the data stream. An XON character restarts the sender.  The reaction cannot be instantaneous and communication buffer must be large enough to accommodate, in the worst case, which can easily  reach 20 characters with well known systems.

Data link protocols (BSC, HDLC etc.) guarantee the integrity of the data transfer even in the case of data errors. RS-232-like transfers are not concerned about this level, and even the XON/XOFF protocol is not documented in the RS-232 standard.

Now, we know how to connect two DTEs and how the communication takes place in between them. Soon we will see that if we want to connect two DTEs directly then some problems arise.

Direct DTE-DTE Connection

Problems

A major point we need to make right now is that you can seldom just connect two pieces of equipment (say two DTEs), described by their manufacturers as RS-232C compatible, and expect them to work the first time. There are several reasons for this. Suppose that you want to connect the terminal (DTE) directly to a computer (DTE) rather than through modem-modem link. If you do so following problems will occur.

Male-female mismatch

According to RS-232C standard a DTE will have a male connector and RS-232C cable will have both male and female connectors.  A male connector should always be connected to a female connector. But from Fig.11, we can see that at the right end the cable-male-connector is connected to the terminal-male-connector which is an invalid connection. If we reverse the male-female direction of the cable then the mismatch occurs at the left end.  Therefore, there is no way to get rid of this male-female mismatch if we hook up two DTEs directly with a RS-232C cable.

 

 

Figure 11- Mismatched Connection

Improper Signal Flow direction

After connecting the two DTEs with a RS-232C cable it looks like as follows (figure:12)

 

Figure 12: Improper Signal Flow between Two DTEs

 

As can be seen from figure 12, both the terminal and the computer are trying to output the data from their number 2 pins (TXD) to the same line. Likewise, they are both trying to input data (RXD) from the same line to their number 3 pins. The same problem exists with the handshake signals.

RS-232C drivers are designed so that connecting the lines together in this way will not destroy anything, but connecting outputs together is not a productive relationship.

Solution

A Solution to these probelsm is to make an adapter with two connectors so that the signals crossover as shownin figure 13. This crossover connection is often called a null modem.

We have put arrowheads on the signals in Fig.13 to help you keep track of the direction for each. As you can see the figure, the TXD from the terminal now sends data to the RXD input of the computer. Likewise, the TXD fromthe computer now sends data to the RXD input of the computer as desired. The handshake signals also are crossed over so that each handshake output signal is connected to the corresponding input signal.

 

Figure 13 : Null Modem for Connecting Two RS-232 DTE Devices

Null Modem and Null DTE

When the modems are suppressed in order to establish a direct DTE to DTE connection a null modem must be inserted on both the sides; this null modem should look like perfect modem pair ready to transmit instantaneously. A three line null-modem correspond to this (figure 14).

Figure 14: Null Modem

Usually, one tries to have some sort of handshake performed between the two DTEs. For this hardware handshake, not part of RS-232 specification, one should have DTE/DSR and not RTS/CTS reserved for half-duplex control. The null-modem of figure 15 is preferred for this. Digital Equipment recommends the null-modem of figure 16.

Figure 15 : Null Modem

Figure 16 : Null Modem

Null DTE

The null DTE (figure 17) is very seldom used but is required if two modems of the same speed are to be connected together. The null DTE simulates a pair of terminal that are always ready. For further reference on null-modem and null-DTE.