Understanding RS-232 Protocol and Interface

Table of Contents

1. Interface Types and Signal Definitions
2. Logic Levels
3. Communication Rates
4. Serial Communication Topology
5. Application Circuits

Welcome to click here to join the hardware electronics group of San Pao Er.

Hello everyone, I’m San Pao Er; today’s notes are about the RS-232 protocol/interface.

The RS-232 serial data communication interface standard was established by the Electronic Industries Alliance in the United States. This standard defines the electrical characteristics of signals, timing, logic levels, and the physical dimensions and pin definitions of connectors.

1.Interface Types and Signal Definitions

The RS232 standard physical interface has 25 pins, but the commonly used one is the 9-pin connector, which is now basically a DB9 connector.

1. DB9 Connector Schematic

Understanding RS-232 Protocol and Interface

2. DB9 Connector Physical Image

Understanding RS-232 Protocol and Interface

DB9 female and male physical image – with pinouts

3. DB9 Interface Signal Definitions

Understanding RS-232 Protocol and Interface

In practical applications, usually only the RXD, TXD, and GND signal pins are used to transmit data directly.

RXD: Used to receive data signals sent by DCE, i.e., input;

TXD: Used to send signals from DTE, i.e., output. The RXD and TXD of the male and female connectors should be cross-connected;

GND: Used to balance the ground potential between both devices, i.e., common ground.

4. DB9 Interface Interconnection

Understanding RS-232 Protocol and Interface

Some designs may also use the RJ45DB9 connection cable shown below, with the physical and signal definitions as illustrated.

Understanding RS-232 Protocol and Interface

2.Logic Levels

RS232 uses negative logic levels.

The logic “1” level is -3V to -15V,

and the logic “0” level is +3V to +15V.

The purpose of choosing this electrical standard is to enhance anti-interference capability and increase communication distance.

The above levels are just the ranges specified by the RS232 protocol; the actual level ranges of devices fall within this range.

For example, the actual levels of MAX232 are as follows:

Understanding RS-232 Protocol and Interface

Understanding RS-232 Protocol and Interface

3.Communication Rates

RS232 supports full-duplex communication, allowing bidirectional transmission.
Transmission distance is short, only 15 meters, but practical applications can reach 50 meters.
Typical baud rates for serial transmission include 110bps, 300bps, 1200bps, 2400bps, 4800bps, 9600bps, 19200bps, 38400bps, 57600bps, and 115200bps.
Serial Communication Data Format

Data is transmitted character by character, with each character transmitted bit by bit, and the transmission of a character always starts with a “start bit” and ends with a “stop bit”; there is no fixed time interval requirement between characters.

Each character has a start bit (transitioning from high to low), and the character itself consists of 7 data bits;

After the character is a parity bit (which can be odd parity, even parity, or no parity);

Finally, there is one or one and a half or two stop bits;

After the stop bit is an indefinite length of idle bits, both the stop bit and idle bits are defined as high level.

During actual transmission, the width of each signal bit is related to the baud rate; the higher the baud rate, the smaller the width. Before transmission, both parties must use the same baud rate settings.

Understanding RS-232 Protocol and Interface

4.Serial Communication Topology

Understanding RS-232 Protocol and Interface

TTL Level Standards
Output L: <0.8V ;H: >2.4V
Input L: <1.2V ;H: >2.0V

RS232 Level Standards

The logic level for 1 is -3 to -15V, and for 0 is +3 to +15V; the level definitions are inverted once.

The main reasons for converting serial TTL levels to RS232 levels are as follows:

1. Level Compatibility
TTL (Transistor-Transistor Logic) serial ports use logic levels (usually 0V and 5V), while RS232 serial ports use negative logic levels.
Many serial devices (such as computers, modems, printers) require RS232 levels to work correctly. Therefore, converting to RS232 levels allows TTL serial ports to be compatible with these devices.
2. Signal Transmission Distance
RS232 serial ports have better performance in signal transmission distance, capable of transmitting farther than TTL serial ports.
RS232 levels can better resist interference during long-distance transmission, providing more stable signal transmission.
By converting TTL serial signals to RS232 levels, the transmission distance of the serial port can be extended.

3. Communication Standard Requirements
Some applications or devices may require RS232 levels for communication.
For example, some serial printers, terminal devices, and industrial control devices may only support RS232 level serial interfaces.
In such cases, converting TTL serial signals to RS232 levels is necessary.
In summary, converting serial TTL levels to RS232 levels is to achieve serial communication between different level standards;
it can enhance compatibility, extend transmission distance, and meet specific device or communication standard requirements.
5.Application Circuits

The typical application circuit diagram for RS232 line drivers/receivers is shown below, with the level conversion chip being TI MAX3221ECDB.

Understanding RS-232 Protocol and Interface

At the moment of device initialization, the IO port is in high-impedance input state, and TX without pull-up may cause dirty data to be sent to the other end.

Our company has specifications requiring that RX and TX be pulled up during circuit design, but only the pull-up resistor for TX is soldered; the pull-up resistor for RX is not soldered.

The above application has not implemented protective design.
RS232 Protection Circuit
EMC issues for RS232 interface design may include:Radiation issues, interference issues, lightning surge(outdoor scenarios), etc.
1. Internal interference from the single board may be radiated externally through the RS232 interface, causing radiation emission tests to exceed standards;
2. External interference can cause communication anomalies, such as pulse group interference and radio frequency interference.
To address the above risks, we have designed a commonly used RS232 protection circuit topology as shown below.

Understanding RS-232 Protocol and Interface

1. Protection Circuit Design Analysis

1.D1 and D2 are TVS diodes, which can effectively suppress large energy interference and electrostatic discharge during plugging and unplugging. The parameters used here are SMAJ18CA, and we won’t elaborate on the specific selection methods and precautions;

2.L1 and L2 are ferrite beads that can create high impedance to high-frequency interference. C1 to C4 provide low impedance discharge paths for interference, preventing interference from being transmitted through the RS232 line.

The above points mainly realize the functions of electrostatic protection and suppression of radiation disturbances;

When RS232 is installed outdoors, additional protection against lightning surges and other large energy impacts is required, similar to gas discharge tubes and thermistors in RS485 circuit structures.

2. PCB Layout Recommendations

1.The return path for protective devices is FG (device enclosure), indicating that when the device has a metal enclosure, grounding is managed separately, with FG connected to the board ground through a 1nF capacitor, and FG connected to the chassis nearby; when the device has a non-metal enclosure, FG is directly connected to the board ground, and the device layout is divided into regions;

2.The ferrite beads and TVS components should be close to the board edge or connector end to maximize the filtering of external interference signals at the board interface;

3.No wiring should be done around the interface and its filtering protection circuit.

Signal cables should use shielded cables, and the shielding layer should ensure 360-degree contact with the connector to avoid the “pig tail” effect.

Understanding RS-232 Protocol and Interface

Finally

Click here to read/download the RS-232 communication protocol reference manual directly.

Understanding RS-232 Protocol and Interface

More Notes

Introduction to Common Level Conversion Circuits

Understanding SPI Interface in One Article

Understanding I2C Bus in One Article

Understanding the Similarities and Differences Between Crystal Oscillators and Crystals, Design Selection

Understanding Xilinx Zynq7000 and 7 Series FPGA Power-on Timing in One Article

Understanding BUCK Circuit Bootstrap Capacitors in One Article

What are the Differences Between LDO and DCDC?

Understanding DCDC Basics in One Article

Understanding LDO Basics in One Article

What Research is There on Pull-up and Pull-down Resistors?

Why is it Common to Place Two Capacitors, 1uF and 0.1uF, in Parallel in Circuits?

Understanding RS-232 Protocol and Interface

This is Soft Grinding HardPao’s WeChat Official Account, where the owner San Pao Er shares hardware development learning notes and experiences.

Learningand sharing to assist in capability growth, exchanging experiences to aspire to be first-class.

Leave a Comment