SPS Home   >  Dgreath   >   Ethernet & Serial Communications

ETHERNET and SERIAL COMMUNICATIONS

Cable Nomenclature:

The cable used for Ethernet is the same used in basic telecom and follows the same terminology. It consists of four color coded pairs numbered one through four. Each pair has a body color and a stripe, for example pair one has a blue wire with a white stripe and a white wire with a blue stripe. The wires with a white body color are referred to as the "tip" and the wires with non-white colored bodies are known as "ring."  In the early days of telephony, manual switchboards used patch cables manipulated by telephone operators to route calls.  The patch cables featured three conductor "phone" plugs similar to those used for stereo headphones today. The three parts of the phone plug are designated tip, ring, and sleeve.  The wires connected to those parts were, in turn, connected via outside cables to the subscriber's phone instrument and were distinguished by those designations.  The sleeve portion was use internally for control purposes and did not leave the switchboard. The following table sets out the scheme:

Table I

Body Color / Stripe Color

Designation

White / Blue Pair 1 tip (T1)
Blue / White (or plain blue) Pair 1 ring (R1)
White / Orange Pair 2 tip (T2)
Orange / White (or plain orange) Pair 2 ring (R2)
White / Green Pair 3 tip (T3)
Green / White (or plain green) Pair 3 ring (R3)
White / Brown Pair 4 tip (T4)
Brown / White (or plain brown) Pair 4 ring (R4)
Table I

When cables are terminated on punch-down blocks or other types of terminal strips, this is the normal order of termination from top to bottom or left to right. This type of cable is rated by category: Cat. 1 for basic telco connections, Cat. 3 for 10 mips, Cat. 5 for 100 mips, Cat.6 for 400 mips, and Cat.7 for 600 mips.

Ethernet Pinout on USOC RJ-45 modular connectors:

The Ethernet specification for RJ-45 modular connectors provides for a polarized transmit pair and a polarized receive pair utilizing pairs two and three only connected to pins 1,2,3, & 6 according to the following scheme:

Table II
Pin Number Designation
1 Transmit Data Positive (TD+)
2 Transmit Data Negative (TD-)
3 Receive Data Positive (RD+)
6 Receive Data Negative (RD-)

Pin numbers are shown from left to right with the flat face up (clip side down) with the cable end coming toward the observer. This is the orientation used when assembling connectors onto the cable and is what is seen  looking into the exposed side of a receptacle. Pair one is always terminated on pins 4 & 5 and may be used as a telco pair for voice or data service. Pair four is always terminated on pins 7 & 8 and may be used as a telco pair as well. In all cases, white body conductors are terminated on odd pins, colored on even pins. Our practice limits pair one for use only as a telco send and pair four as a telco return (for use with devices such as fax machines or modems). This way, any wall plate can be used for either purpose with no modification in the wiring other than simple patching at the closet. This approach minimizes crosstalk between telco pairs. There are several ways the pairs may be arranged according to the EIA 568 standard as follows:

Table III
Specification Usage
568A to 568A Normal patch cables
568B to 568B All installed wiring
568A to 568B Crossover patch cables

"All installed wiring" refers to cabling running from wall plates (or direct termination) to patch bays and is typically fished through walls, ceilings, conduit, or tray. The majority of commercially available wall outlets and patchbays are set up to provide a 568B pattern using straight pair ordering as in Table I. Check the specs to be sure. Normal patch cables connect from outlet plates to PC NICs or hub or switch ports. Crossover patch cables are used for uplink connections between hubs and switches or when a direct connection between two PCs is needed.

Table IV

EIA 568A Termination

 

USOC RJ-45

Pin No. 1 2 3 4 5 6 7 8
Function TD+ TD- RD+ Telco Pr. 1 RD- Telco Pr.2
Wire
Color
WHT GRN WHT BLU WHT ORN WHT BRN
Stripe
Color
GRN WHT ORN WHT BLU WHT BRN WHT
Pair No. Pair 3 Pr. 2 Pair 1 Pr. 2 Pair 4

Table V

EIA 568B Termination

 

USOC RJ-45

Pin No. 1 2 3 4 5 6 7 8
Function TD+ TD- RD+ Telco Pr. 1 RD- Telco Pr.2
Wire
Color
WHT ORN WHT BLU WHT GRN WHT BRN
Stripe
Color
ORN WHT GRN WHT BLU WHT BRN WHT
Pair No. Pair 2 Pr. 3 Pair 1 Pr. 3 Pair 4

Note that the sole difference between 568A and 568B is that pairs two and three are swapped--thus connecting TX and RX bi-directionally in the crossover mode. In the normal mode, the connections are straight through for both. Even though a flat modular cable is electrically the same, it lacks the twisted pairs necessary for high bandwidth. In addition, the RD pair would be split over pairs one and three which is never advisable.

Assembly of these cables requires little more than a decent pair of wire cutters (Dalco P/N 43185) and a RJ-45 Crimp tool such as the Palladin (Dalco P/N 64079). Completed cables can be tested with a two piece Ethernet tester such as the Dalco P/N 70484. For installed wiring Cat. 5E solid cable (Dalco P/N 37400) is a suitable choice; however, Cat. 5E stranded cable (Dalco P/N 37398) is ideal for patch cables. Cables that are routed through open plenum spaces must use Cat. 5E plenum cable (Dalco P/N 37415). The best price on wire is attainable in 1000 foot rolls. RJ-45 eight pin modular connectors are available put up in various quantities (Dalco P/N 57020) or (Dalco P/N 57025). Patch panels are available from 12 to 48 points. Wall plates are available with one to six openings. Snap in jacks are available in a variety of colors. Dalco Electronics is available on the web at www.dalco.com or by phone at (800) 489-0075 or fax at (800) 452-5704.

Serial Communications:

While Ethernet is the common method of connection PCs together in networks, serial data connections using the RS-232 or EIA-232 specification are also used--especially for connections between PCs and modems or printers. They are also used to connect PCs to network devices (e.g. routers, switches, concentrators) for configuration purposes. The  RS-232 spec was developed in the early 1960s to standardize these types of connections.  The original specification was designed for synchronous communications, that is, where the data is clocked from one device to another bit by bit with extensive handshaking to control data flow.  This required a 25 conductor cable to provide and manage the necessary signals.  Cable length was limited and the whole scheme somewhat slow and subject to data corruption problems. Asynchronous communication  proved to be a better solution and is the dominant method used now. The asynchronous method replaces the complicated scheme of clocking and handshaking with a simplified method using a pair of storage buffers at each device--one for holding data to be transmitted and one for receiving data. Now, instead of moving the data bit by bit, it flows in fast continuous streams and only stops when a receiving buffer is full. In addition it is more tolerant of longer distances and less susceptible to data corruption. Finally, only four pairs of connections are necessary.

Under the specification, all devices are either Data Terminal Equipment (DTE) such as computers and terminals or are Data Communications Equipment (DCE) including modems, printers, and plotters. The following two tables outline the asynchronous signals and pin assignments for both DB- 25  and DB-9 subminiature connectors:

Table VI
DB-9 Pinout 1 2 3 4 5 6 7 8
DB-25 Pinout 8 3 2 20 7 6 4 20
Signal Name DCD RXD TXD DTR SC DSR RTS CTS
Signal Direction IN IN OUT OUT BI IN OUT IN
  DTE Devices (Computers and Terminals)

Table VII
DB-9 Pinout 1 2 3 4 5 6 7 8
DB-25 Pinout 8 3 2 20 7 6 4 5
Signal Name DCD RXD TXD DTR SC DSR RTS CTS
Signal Direction OUT OUT IN IN BI OUT IN OUT
  DCE Devices (Modems, Printers, and Plotters)

Normally, DTE devices feature male connectors while the DCE devices feature female connectors so cables can be extended by plugging them end to end. Note, however, that this may not always be true. 

Serial Signals:

Signal Ground (SG): This pin is the ground reference for all RS-232/EIA-232 signals and is always at zero volts DC. Since this specification is for unbalanced electrical signals, it is the return path for everything. RS-232 signaling is by bipolar (polarity) detection rather than voltage level detection so logical one (or low state) is asserted as a negative voltage in the range from -3 to -15 volts DC and logical zero (or high state) is asserted as a positive voltage in the range of +3 to +15 volts DC.  Signals ranging from -3 to +3 volts DC are undefined and treated as a fault condition. This is how devices detect that the remote device is either disconnected or turned off.

Transmit Data (TXD): This signal is the data stream flowing from the the DTE transmit buffer to the DCE receive buffer. Digital data is binary coded into logical zeros and ones.  A logical zero value is referred to as a space and a logical one value as a mark.  

Receive Data (RXD): This signal is the data stream flowing from the DCE transmit buffer to the DTE receive buffer. Digital data is binary coded into logical zeros and ones. A logical zero value is referred to as a space and a logical one value as a mark.

Data Terminal Ready (DTR): This signal informs the DCE device that the DTE device is running and ready to transmit and receive data. The high state signals that the DTE is ready  while low indicates not ready.

Data Set Ready (DSR): This signal is a response to the DTE device from the DCE device that it is running and ready to transmit and receive data. The high state signals that the DCE is ready while low indicates not ready. DSR is a response to the DTR signal and is slightly delayed to allow time for the DCE device to synch to the DTE device. If the DTE device must have this signal to operate and it is not available from the DCE device, it can be simulated from the DTE DTR signal with a jumper connection. 

Request to Send (RTS): This signal informs the DCE device that the DTE device is ready to send any data in its transmit buffer via TXD and accept into its receive buffer any data coming in via the RXD (i.e. its  receive buffer is not full). The high state signals that the DTE is ready to send while low indicates it is not ready.

Clear to Send (CTS): This signal is a response to the DTE device from the DCE device that it is ready to send any data in its transmit buffer via RXD and accept into its receive buffer any data arriving via TXD (i.e. its receive buffer is not full). The high state signals that the DCE is ready to send while low indicates it is not ready.

Data Carrier Detect (DCD): This signal informs the DTE device that the DCE device has established a connection with a remote DCE device. Printers also use this signal to indicate the printer is on or off line. The high state signals that the DCE has established a connection while low indicates the connection has dropped.

There are a number of other signals available for use when synchronous transmission methods are used but none of them are needed for asynchronous mode and are not discussed here. The important handshake pairs are RTS-CTS and DTR-DCD (DSR is rarely needed). 

Normally serial cabling is unshielded, however if the cable is shielded, it should be connected at the DTE end only to prevent ground looping. This is only possible when using the DB-25 connector and is accomplished by connecting it to pin one. 

Operation Sequence:

Suppose a remote DCE device connects with the local DCE device, necessary negotiation occurs, and the two devices establish reliable communication, the the DCD signal will switch from low state to high. The DTE device, upon detecting the signal change will initiate its internal housekeeping and prepare for communication with the DCE device.  When the DTE is ready to go, the DTR signal will switch from low to high state. When the DCE device detects that signal change, it performs all of its internal housekeeping and when ready switches the DSR signal from low to high state. Both devices are now ready to communicate and will do so until either DCD or DTR switches from high to low state effective shutting down both devices.

If the origination is by the local DTE device instead, it will switch DTR from low to high state.  This will cause the DCE device to conduct its necessary housekeeping to seize the telco line. When successful, the DCE device will switch the DCD signal from low to high. With both DTR and DCD high, communication is enabled from the DTE to DCE devices.

The DTE device will next ensure its transmit buffer is ready to send and its receive buffer is not full, if so, it will switch RTS from low state to high as long as both conditions remain true. When DCE detects the signal change, it tests its transmit and receive buffers for the same criteria and if all is well, switches CTS from low to high in similar fashion. These two signals perform the primary hardware flow control function.

During the time RTS and CTS are both at high state, data deposited into the DTE transmit buffer by the host will exit the DTE TXD output and flow into the DCE TXD input where it will enter into the DCE receive buffer until it is transmitted to the remote DCE device. In a similar fashion, data received from the remote DCE device will be placed into the DCE transmit buffer where it will flow out the DCE RXD output and into the DTE RXD input and then into the DTE receive buffer until removed by the DTE host. Data will flow at the baud rate selected by the DTE device.

Most modern DCE modem devices are controlled and monitored by Hayes AT (attention) commands sent by the DTE device with status messages returned by the DCE device. 

Cable configuration:

There are three possible classes of cable configurations with possible variations within each class for connector type (such as DB-9 or DB-25) or gender (male or female). These variations are device dependent and are selected according to mechanical fit requirements. The following table summarizes the cable classes:

Table VIII
"A" End "B" End Purpose Usage
DTE DCE Modem
(straight thru)
Connect computers or terminals to modems or printers
DTE DTE Null Modem
(crossover)
Connect computers or terminals to other computers or terminals
DCE DCE  Tail Circuit
(crossover)
Connect modems to other modems*

* Tail circuit connections are rarely used. If it were necessary to connect a DTE device at location A to a DTE device at location C via location B, the cabling required would be something like this:

Table IX
Location A Telco
Line
Location B Telco
Line
Location C
Terminal Modem
Cable
Modem Modem Tail
Circuit
Cable
Modem Modem Modem
Cable
Computer
DTE
Device
  DCE
Device
DCE
Device
  DCE
Device
DCE
Device
  DTE
Device

Special modems designed for asynchronous tail circuit service would be needed to make it work correctly.

Serial Adaptors

The low cost and ready availability of Ethernet cabling lends itself to another use--as a replacement for traditional serial cables built of DB-9 and DB-25 hooded connectors. What makes this possible is the availability of inexpensive serial adaptors such as the DB9M (Dalco P/N 41020), DB9F (Dalco P/N 41025), DB25M (Dalco P/N 38200) or DB25F (Dalco P/N 38205).  Each adaptor comes unwired, but it only takes a moment to poke the furnished leads into the correct holes and snap the cover together.  Simply purchase whichever version fits the serial ports and wire them up according to the following tables:

Table VI

9 Pin Data Terminal Equipment (DTE) - Computers or Terminals

 

USOC RJ-45

Pin No. 1 2 3 4 5 6 7 8
Function                
Wire
Color
WHT ORN WHT BLU WHT GRN WHT BRN
Pin No.                
  DB9 Termination (Either M or F)

The Yost Universal Serial Interface--An Alternative Approach:

Another method of resolving the various problems involved in interfacing the many situations typically encountered was advanced by David Yost around 1997. Yost deduced that with a crossover cable and several inexpensive adapters it is possible to create a system where any serial device can be conveniently connected to any other serial device regardless of the type. This scheme consists of an adapter for DTE devices which is wired straight through, a standard cable wired as a crossover, and an adapter for DCE devices which is wired as a crossover as well. Thus, when a DTE device is connected to another DTE device, the cable provides the necessary conductor crossover, but when connected to a DCE device which is also a crossover device, the combination of two crossovers equals the same result as a straight cable needed for this type of connection.  In addition, where a DCE device is connected to another DCE device, the crossover in one adapter cancels out the crossover of the other adapter leaving only the single crossover of the cable, thus creating a perfect tail circuit cable. Specific benefits are that all connection points are standardized with the same signals appearing at the same place and a common male RJ-45 connector. Second, no distinction remains between DTE and DCE devices. Taken together, any device can be simply connected to any other. The following table describes the configuration of the common cable used for all connections: 

Table X

Standard Yost Universal Serial Cable

"A" End

USOC RJ-45 Plug

Pin No. 1 2 3 4 5 6 7 8
Function CTS DCD RXD SG SG TXD DTR RTS
Wire
Color
WHT BLU WHT ORN WHT GRN WHT BRN
Stripe
Color
BLU WHT ORN WHT GRN WHT BRN WHT
Pair No. Pair 1 Pair 2 Pair 3 Pair 4
Pin No. 8 7 6 5 4 3 2 1
"B" End USOC RJ-45 Plug

Configuration and application of the four serial adaptors are shown in the following four tables:
Table XI

9 Pin Data Terminal Equipment (DTE) - Computers or Terminals

"B" End

USOC RJ-45 Receptacle

Pin No. 1 2 3 4 5 6 7 8
Function CTS DCD RXD SG SG TXD DTR RTS
Wire
Color
BLU ORN BLK RED GRN YEL BRN WHT
Pin No. 8 1 2 5 5 3 4 7
"A" End DB9 Connector (Either M or F)

Table XII

25 Pin Data Terminal Equipment (DTE) - Computers or Terminals

"B" End

USOC RJ-45 Receptacle

Pin No. 1 2 3 4 5 6 7 8
Function CTS DCD RXD SG SG TXD DTR RTS
Wire
Color
BLU ORN BLK RED GRN YEL BRN WHT
Pin No. 5 8 3 7 7 2 20 4
"A" End DB25 Connector (Either M or F)

Table XIII

9 Pin Data Communications Equipment (DCE) - Modems or Printers

"B" End

USOC RJ-45 Receptacle

Pin No. 8 7 6 5 4 3 2 1
Function CTS DCD RXD SG SG TXD DTR RTS
Wire
Color
WHT BRN YEL GRN RED BLK ORN BLU
Pin No. 8 1 2 5 5 3 4 7
"A" End DB9 Connector (Either M or F)

Table XIX

25 Pin Data Communications Equipment (DCE) - Modems or Printers

"B" End

USOC RJ-45 Receptacle

Pin No. 8 7 6 5 4 3 2 1
Function CTS DCD RXD SG SG TXD DTR RTS
Wire
Color
WHT BRN YEL GRN RED BLK ORN BLU
Pin No. 5 8 3 7 7 2 20 4
"A" End DB25 Connector (Either M or F)

Simply crimp two RJ-45s on a piece of cable of the appropriate length; select, assemble, and install a serial adapter for each device, and plug one end of the cable in each adaptor. That's all there is to it..

Serial Mice:

Common PC serial mice are basically a DCE device with some special twists.

Voltage levels:

Mouse takes standard RS-232C output signals (+-12V) as its input signals. Those outputs are in +12V when mouse is operated. Mouse takes some current from each of the RS-232C port output lines it is connected (about 10mA). Mouse send data to computer in levels that RS-232C receiver chip in the computer can understand as RS-232C input levels. Mouse outputs are normally something like +-5V, 0..5V or sometimes +-12V. Mouse electronics normally use +5V voltage.

Hardware implementation

PC serial mouse uses typically DTR and RTS lines for generating +5V power for micro controller circuit in the mouse. Because the typical opto-mechanical mouse also needs power for four LEDs in the opto-coupler movement detectors, there is not much power to loose. A typical approach is to use diodes to take current from  DTR and RTS lines and then feed it through resistor to all of the (infrared) leds in the movement detectors. All four (infrared) leds are connected in series, which gives about +5V voltage drop over all leds (typical to leds used in moused). This +5V is adequate power for low power mouse microcontroller. The serial data transimitting circuit consists of simple discrete transistor circuir to make it consume as little power as possible. The positive power supply usually taken from RTS and DRT lines (just after the diodes and before the resistor going to leds). The negative supply for transmitter is taken from TD pin. Typical PC serial port mouse takes 10 mA total current and operates at voltage range of 6-15V. The data itself in sent using standard asuncronous RS-232C serial format:

              Start D0  D1  D2  D3  D4  D5  D6  D7  Stop
   Logic 0      ___ ___ ___ ___ ___ ___ ___ ___ ___
  +3..+15V     |   |   |   |   |   |   |   |   |   |
               |   |   |   |   |   |   |   |   |   |
               |   |   |   |   |   |   |   |   |   |
   Logic 1     |   |   |   |   |   |   |   |   |   |
  -3..-15V  ___|   |___|___|___|___|___|___|___|___|____

 

Microsoft serial mouse

Microsoft serial mouse is the most popular 2 button serial mouse type. Typically that cheap tho button mouse which comes with the computer is Microsoft mouse system. Microsoft mouse is supported in all major operating systems.

 

Mouse resolution and tracking rate

Maximum tracking rate for Microsoft mouse is 40 reports/second * 127 counts per report = 5080 counts per second. The most common range for typical mouses is 100 to 400 CPI (count per inch) but can be up to 1000 CPI (cheap ones typically are 100 CPI or 200 CPI models). This means that you can move 100 CPI mouse up to speed of 50.8 inches per second and 400 CPI mouse maximally at 12.7 inches per second. The actual accuracy of movement the software sees is detemined by the settings of the mouse driver (many mouse drivers have option to adjust mouse sensitivity).

 

Pinout

9 pin    25 pin     Wire Name            Comments
shell     1         Protective Ground
3         2         TD                  Serial data from host to mouse (only for power)
2         3         RD                  Serial data from mouse to host
7         4         RTS                 Positive voltage to mouse
8         5         CTS
6         6         DSR
5         7         Signal Ground
4         20        DTR                 Positive voltage to mouse and reset/detection

RTS = Request to Send   CTS = Clear to Send
DSR = Data Set Ready    DTR = Data Terminal Ready
To function correctly, both the RTS and DTR lines must be positive. The lines DTR-DSR and RTS-CTS must NOT be shorted. Implement the RTS toggle function by setting the RTS line negative and positive again. The negative pulse width is at least 100ms. After a cold boot, the RTS line is usually set to a negative level. In this case, setting the RTS line to a positive level is also considered an RTS toggle.

 

Serial data parameters:

1200bps, 7 databits, 1 stop-bit

Data packet format:

Data packet is 3 byte packet. It is send to the computer every time mouse state changes (mouse moves or keys are pressed/released).
        D7      D6      D5      D4      D3      D2      D1      D0

1.      X       1       LB      RB      Y7      Y6      X7      X6
2.      X       0       X5      X4      X3      X2      X1      X0
3.      X       0       Y5      Y4      Y3      Y2      Y1      Y0
Note: The bit marked with X is 0 if the mouse received with 7 databits and 2 stop bits format. It is also possible to use 8 databits and 1 stop bit format for receiving. In this case X gets value 1. The safest thing to get everything working is to use 7 databits and 1 stopbit when receiving mouse information (and if you are making mouse then send out 7 databits and 2 stop bits).

The byte marked with 1. is send first, then the others. The bit D6 in the first byte is used for syncronizing the software to mouse packets if it goes out of sync.

LB is the state of the left button (1 means pressed down)
RB is the state of the right button (1 means pressed down)
X7-X0 movement in X direction since last packet (signed byte)
Y7-Y0 movement in Y direction since last packet (signed byte)

Graphical description how the data is contained in the packet

              1st byte        2nd byte         3rd byte
          ================  ===============  ================
           - 1 ? ? Y Y X X  - 0 X X X X X X  - 0 Y Y Y Y Y Y
          ================  ===============  ================
               | | \ / \ /      \---------/      \---------/
               | |  |   |            |                |
               | |  |   \----\       |                |
               | |  \--------|-------|--------\       |
               | |          / \ /---------\  / \ /---------\
               | |         ================ =================
               | |          0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0
 Left Button --/ |         ================ =================
Right Button ----/            X increment      Y increment

Mouse identification

When DTR line is toggled, mouse should send one data byte containing letter 'M' (ascii 77).

 

Logitech extension to protocol

Logitech uses this same protocol in their mice (for example Logitech Pilot mouse and others). The original protocol supports only two buttons, but logitech as added third button to some of their mouse models. To make this possible logitech has made one extension to the protocol.

 Apparently, the information of the third button state is sent using one extra byte which is send after the normal packet when needed. Value 32 (dec) is sent every time when the center button is pressed down. It is also sent every time with the data packet when center button is kept down and the mouse data packet is sent for other reasons. When center button is released, the mouse sends the normal data packet followed by data bythe which has value 0 (dec). The extra data byte is sent only when the center button is operated.

Mouse systems mouse

Serial data parameters:

1200bps, 8 databits, 1 stop-bit

The data is sent in 5 byte packets in following format:

        D7      D6      D5      D4      D3      D2      D1      D0

1.      1       0       0       0       0       LB      CB      RB
2.      X7      X6      X5      X4      X3      X2      X1      X0
3.      Y7      Y6      Y5      Y4      Y3      Y4      Y1      Y0
4.      X7'     X6'     X5'     X4'     X3'     X2'     X1'     X0'
5.      Y7'     Y6'     Y5'     Y4'     Y3'     Y4'     Y1'     Y0'

LB is left button state (0=pressed, 1=released)
CB is center button state (0=pressed, 1=released)
RB is right button state (0=pressed, 1=released)
X7-X0 movement in X direction since last packet in signed byte
      format (-128..+127), positive direction right
Y7-Y0 movement in Y direction since last packet in signed byte
      format (-128..+127), positive direction up
X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte
      format (-128..+127), positive direction right
Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte
      format (-128..+127), positive direction up
The last two bytes in the packet (bytes 4 and 5) contains information about movement data changes which have occured after data butes 2 and 3 have been sent.