Serial Communications Protocols - Part Three: RS-232
In this series of articles, we’re looking at some of the different types of Serial Communication Protocols available for transferring data between devices. The articles will cover a few of the more popular protocols and standards in use today, and at the end of this series, we will recap and compare the advantages and disadvantages of each. We hope this information will prove valuable next time you need to implement a serial communication bus in your design, helping you select the most appropriate option for your circuit.
In this article, we will be looking at the legacy RS-232 protocol standard.
RS-232, which stands for Recommended Standard 232, is an electronic device protocol standard used for data transmissions between electronic devices created in 1960. At one time, RS-232 was the most commonly used data transmission format and was mainly implemented using a standard 9 pin D-sub (DB-9) connection. This standard is still often used today in various electronic devices, including computers, automation, and medical devices.
Classic DB-9 Cable, Image Source: https://www.digikey.co.uk/product-detail/en/assmann-wsw-components/AK131-2/AE1379-ND/930165
The RS-232 uses a positive voltage for transmission of a low logic level signal (0) and a negative voltage for transmission of a high logic level signal (1).
Example RS-232 signals
Voltage |
Logic Value |
---|---|
-18v to -5v |
1 |
-5v to +5v |
(undefined) |
+5v to +18v |
0 |
The communication principle of RS-232 communications is simple. The sender device stores data in its buffer and then sends the data through the cable (or PCB trace), and the receiver then stores this data in its buffer. Then, the receiver can read the buffered data.
To avoid sending information when there is no receiver connected, the DTR (Data Transmit Ready) and DSR (Data Set Ready) pins are used. When these pins are connected, and the correct voltage is set on these by the receiver, then the sender device will know that the receiver is connected and ready.
If the sender transmits the data too fast, and the receiver cannot read the data from its buffer fast enough, the buffer will overflow, and the data will be lost. Two other pins were added to the sender and one to the receiver to prevent this situation. From the sender side, the pin is labeled RTS (Request to send), and from the receiver side, it is labeled CTS (Clear to send). The receiver informs the sender when its buffer is full by pulling this pin’s voltage down. This tells the sender not to send any more information until the receiver is ready. This is known as hardware flow control.
There are also two more pins available for telephony applications that are now largely redundant. One is the DCD (Data Carrier Detect), which tells a modem that an analog signal is being received, and the other is the RI (Ring Indicator) that indicates that a phone is ringing. These are practically unused today.
The last connection is SG or Signal Ground, which is the ground voltage reference for the communicating devices.
There are two types of RS-232 communication devices: DTE (Data Terminal Equipment) and DCE (Data Communication Equipment). Examples of DTE include a computer, PLC, or other command-sending equipment. Examples of DCE are a modem, camera, printer, and general automation equipment.
Two DTE or two DCE devices cannot transmit information to one another. There must be a DTE present that sends commands to establish communications between devices and a DCE to perform these commands.
RS-232 can also be used to communicate between computers by using modems, as shown below:
Alternatively, Null Modem wiring can be used, which eliminates the need for a modem
However, to eliminate the need for the DSR and RTS wires, data packets from the receiver side must be sent to indicate when the data can be sent and when it cannot. Packets are set to XON to suggest that the data can be sent and XOFF to suggest that the data cannot be sent. This is known as software flow control.
The main disadvantage of using RS-232 is that its communications are relatively slow compared to other serial communication protocols. It can only reliably reach speeds of up to 128 kbps in many applications. The other drawback is that the maximum length of cable it can reliably work over is only 15 meters. Wire resistance and voltage loops become a problem over longer distance cables.
Although RS-232 is now not commonly used in new devices because of the other more modern communication protocols available, older devices are often found. That being said, even the most current and high-tech computer motherboards still typically have a COM port header, which exposes RS-232 if you require it. There is still a considerable amount of equipment in the field over 10 years old, including devices such as printers, industrial automation equipment, etc., requiring programming and maintenance as they are used. For that, RS-232 is essential. Luckily, there are plenty of converters such as RS-232 to USB, which means we can still communicate with these devices easily.
Summary
This article has looked at some legacy RS-232 protocol standard features and discussed some of its advantages and implementation details. In the next article, we will look at some of the alternate serial communication protocols available. Did you miss something? Check out this series's previous articles: Serial Communications Protocols - Introduction and Serial Communications Protocols - Part Two: UART.
Would you like to find out more about how Altium Designer® can help you with your next PCB design? Talk to an expert at Altium.