RS-232 ( R ecommended S tandard 232) is a standard for a serial port , which in the early 1960s by the US standardization gremium Electronic Industries Association was developed (EIA) and up frequently in the 2010s when computers were available.
Until the early 1990s, mainframes and text terminals were connected with the aid of modems by point-to-point connections over the telephone line . The transmission of the data in both systems took place sequentially . Due to the original purpose of use, the interface shows some asymmetries in the definition of the control lines, which can lead to interconnection problems in the later common applications in completely different areas.
Fewer and fewer devices with an RS-232 interface are being produced worldwide. Examples are service and configuration connections on devices such as B. routers , switches , storage systems, laboratory equipment and point-of-sale terminals . Alternative serial interfaces offer more reliable and faster connection options. Only a few PCs are still delivered with a COM port, notebook manufacturers almost no longer offer this equipment option. In order to be able to operate and program devices that have an RS-232 interface with computers without this, there are converters from USB to RS232. Plug-in cards with RS232 interfaces for PCs are also available.
Many current devices with RS-232 only use three wires or pins (RX, TX, GND), so they do without handshake and control lines. Because of the low data rate, the comparatively low demands on the cabling and the high, tolerant signal level, the RS-232 is still widely used when it comes to interference immunity and long signal connections. In this respect, however, it is exceeded by twisted-pair network cable connections with transformers (“Ethernet”) and by the RS-485 standard.
Optical adapter plugs are available for electrical isolation and to increase immunity to interference, which draw their operating voltage from the signal levels, i.e. do not require their own power supply.
The current American version is officially called (ANSI EIA /) TIA-232-F and dates from 1997. The common name in the USA and Europe is RS-232 (RS stands for Recommended Standard ). For the question of the correct designation, see the section Labeling standards at EIA - Electronic Industries Alliance .
RS-232 defines the connection between the terminal ( data terminal equipment (DTE), engl. Data Terminal Equipment (DTE)) and the modem ( data transmission device (DÜE), engl. Data Communication Equipment (DCE)), which relates to timing and voltage level. The 25-pin D-Sub connector was recommended (not mandatory). The transmission protocol is not part of the standard. In general, the parameters are explained under serial data transmission .
Further transmission standards such as RS-422 , RS-485 can be found in the article Serial Interface .
- The transmission takes place in words. Depending on the configuration, a word corresponds to five to nine bits in which a single character is then encoded. Mostly the coding is done according to ASCII . (ASCII) control codes are often used to control a terminal such as the VT100 , but these are not defined in the RS-232 standard. It is therefore common to transmit seven or eight data bits. However, processing of the 5-bit telex code is also possible (after adjusting the signal level) .
- An RS-232 connection works (bit) serially with one data line each for both transmission directions . This means that the bits are transmitted one after the other on one line, in contrast to parallel data transmission . The serial-parallel conversion required for this mostly takes place in so-called UARTs (either as an integrated module in a microcontroller or as a single component).
- Although there are countless other types of serial interfaces, the RS-232 is traditionally called "serial interface" because it used to be the only common one, especially in the PC sector.
- The data transfer is asynchronous , so there is no common clock . Each participant can transmit complete data words at any time when the line is free . The synchronization in the transmission is carried out by the receiver as a so-called word synchronization, i.e. at the beginning by the signal edge of the start bit.
The receiver is synchronized with the start of the transmission on the data line, since the stop bit or the idle state on the line has the inverse level to the start bit. The receiver synchronizes itself in the middle of the individual data bits and scans the following bits of the data word at its own bit rate .
In order for this to work, the bit rates of the sender and receiver may only differ by a few percent. Each word transferred must therefore be introduced by a start bit (logical value 0) and ended with at least one stop bit (logical value 1). The stop bit is not a bit in the strict sense of the word, but describes the minimum length of the pause or the idle state. Therefore, there can be any number of stop bits between two words, including non-integer values such as 1.5 stop bits. This means that the minimum duration of the pause corresponds to the duration of 1.5 bit cells. The reason is that some UARTs require a slightly longer pause of more than one bit duration between the reception of two words.
The actual user data (data bits ) are transmitted unchanged ( NRZ-coded ) over the cycle time between the start and stop bit (s) .
- RS-232 is a voltage interface (as opposed to a current interface, for example ). The binary states are realized by different electrical voltage levels.
A negative logic is used for the data lines (TxD and RxD) , with a voltage between −3 V and −15 V (ANSI / EIA / TIA-232-F-1997) being a logic one and a voltage between +3 V and + 15 V represents a logic zero. Signal levels between −3 V and +3 V are considered undefined.
With the control lines (DCD, DTR, DSR, RTS, CTS and RI), the active state is represented by a voltage between +3 V and +15 V, the inactive state by a voltage between −3 V and −15 V. Please note is, however, that the designations given here (and mostly used) for the control lines do not appear in the original standard. There, only certain circuits are described that can be assigned to these designations, but are named differently in the standard.
The voltages given above refer to the receivers (inputs). The voltage of the transmitters (outputs) must be at least +5 V or −5 V on a load of 3 to 7 kΩ in order to guarantee a sufficient signal-to-noise ratio. The use of +12 V and −12 V.
- According to the original standard, 25-pin D-Sub plugs for DTE and sockets for DCE were used as plug connections . Since many of the 25 lines are pure printer or terminal control lines from the electromechanical era, which are not required for most connections with more modern peripheral devices, 9-pin D-Sub plugs and sockets have become established today, which are often DB- 9 or more correctly DE-9 . These were originally introduced in the IBM PC / AT as a purely emergency solution to save space (at that time it was a matter of accommodating the connector on a plug-in card together with a likewise reduced Centronics interface ). The 9-pin connector is therefore not to be found in the RS-232 standard, but in the EIA / TIA-574 standard . For RS-232 data transmission, other connectors are rarely used, such as B. Mini-DIN , Modular 8P8C (incorrectly often referred to as RJ-45, specified in EIA / TIA 561 ) or completely company-specific.
- To avoid data loss, the recipient must be able to stop the data transmission when no further data can be processed. This so-called handshake can be implemented in two ways, either on the software side via certain control codes or via special lines (hardware handshake).
- With the software handshake , the receiver sends special characters to the sender to control the data flow. Accordingly, only three lines (RxD, TxD and Gnd) are required for data transmission. This type of handshake is only possible if the two control codes do not appear in the user data. With the most commonly used Xon / Xoff protocol, the receiver sends special characters to the sender to control the data flow (Xon = 11h and Xoff = 13h).
- With the hardware handshake , the two devices signal their respective status via additional control and message lines. A minimal interface with hardware handshake, for example, consists of five lines (TxD, RxD, GND, RTS and CTS).
- In principle, a full duplex connection is possible, as separate data lines are available for transmission and reception.
- The original standard recommended the use of 25-pin connectors that enabled two independent data channels (each with transmit and receive lines). With the introduction of PCs, the variant most commonly used today with 9-pin connectors became widespread.
- Special bit rates or parity procedures are not specified in the standard.
The standard does not specify bit rates, although it is mentioned that it is intended for transmission rates up to 20 kbit / s. Common UARTs that are used in conjunction with the RS-232 support transmission rates of 115.2 kbit / s and more. In order to achieve a defined transmission behavior, the standard prescribes a maximum edge steepness at the transmitter and a minimum edge steepness (depending on the bit rate) in the transition range of −3 V ... + 3 V at the receiver.
Some computers (like the Amiga) also accept +5 V for low and 0 V for high as input, so a simple inverter is sufficient.
Line length and transmission rate
(k Bd )
Since the signal quality decreases with increasing cable length, the cable length is limited.
The runtime of the signal is a limiting factor. Since an RS-232 interface at the end of the line cannot be terminated with its characteristic impedance (power loss is too great), line reflections will inevitably occur. With increasing transmission rate and cable length, the reflections interfere more and more with the data transmission. The standard requires that the edge steepness at the transmitter must not exceed 30 V / µs, which limits the effects of the reflections. On the receiver side, a Schmitt trigger is used to produce a square-wave signal with a very steep edge.
Another aspect is that the signal transmission is not differential , but asymmetrical ( single-ended or unbalanced ). The signal to be transmitted contains a DC voltage component and is therefore relatively sensitive to common-mode interference . Such disturbances can e.g. B. arise through inductive coupling in the loop RxD-Gnd. Because all signals refer to the same Gnd signal, a current on the TxD line can generate a voltage drop on the Gnd line, which leads to a potential shift between the two communication partners and is seen, for example, on the RxD line and causes interference .
According to the original standard, a cable capacity of max. 2500 pF permissible, which for standard cables with a cable length of max. Equivalent to 15 m (50 feet ). With cables that have a particularly low capacity (for example UTP CAT-5 cable with 55 pF / m), 45 m can be achieved in accordance with the definition. The table on the right shows the empirical values from Texas Instruments .
The problems of mutual influence via Gnd, missing terminating resistor etc. can be eliminated by differential transmission as with RS-485 , LVDS etc.
Wiring and connector
In order to connect two devices via the serial interface, the "hearing" lines of one device must be connected to the "speaking" lines on the other side. With terminals or computers (DTE - data terminal equipment) , “speaking” lines are TxD, RTS and DTR, “hearing” lines are RxD, CTS, DSR, DCD and RI. With modems (DCE - data circuit-terminating equipment) it is exactly the opposite; it forwards the signals “spoken” by the terminal to the opposite end and therefore has to “listen” to them, the other way round the signals “heard” by the opposite end are “passed on” to the terminal.
- If the connection is from a terminal or computer (DTE) (mostly with a plug) to a modem (DCE) (mostly with a socket), a 1: 1 cable is required.
- If, on the other hand, two devices of the same type are connected (e.g. two PCs), the lines must be crossed. Such a cable is called a null modem cable because no modem (i.e. '0 modems') is used. However, due to the asymmetrically defined set of control signals and their sometimes very liberal use, there is no such thing as THE crossover cable that always fits. However, a standard has prevailed that is commonly referred to as a null modem cable and that usually works. In extreme cases, however, z. For example, a cable end that is designed for connection to a DTE device may cause a short circuit on a DCE device (which, according to the V.28 specification, should not cause any hardware damage, but in practice has already occurred).
- The serial transmission signal of a device is routed directly to the receiving part of the same device through a loopback plug or socket. Such a loopback device is used , for example , in the development of communication programs or for testing hardware. If the control lines are also "looped", it should be noted here that, depending on the type of device (DTE or DCE), the control signals DCD and RI are both either input or output and do not have a clearly defined "opposite". They must therefore be suitably connected so that there are no short circuits between outputs or undefined input levels.
The practical identification of DTE and DCE devices is possible by measuring the quiescent level (voltage between GND and TxD or RxD, note the different assignment of 9- and 25-pin cables). Some modern devices recognize unconnected connections and switch off the output drivers in order to save energy. In this case, a suitable resistor between the signal connection and GND must be used to fool the presumed outputs into a connected counterpart.
|GND and TxD||−3 ... −15 V||approx. 0 V|
|GND and RxD||approx. 0 V||−3 ... −15 V|
The names and descriptions of the most important signal lines are based on the original use of the interface. “Remote station” in this table does not mean the other side (in the case of classic use, the one at the other end of the telephone line), but rather the local partner of the DTE (in the classic case a DCE (modem)). The line designations are the same for both DTE (PC) and DCE (modem) and are formulated from the DTE's point of view, but the properties of the connection (input or output) are different.
|Direction with the DTE (e.g. PC)||Direction with the DCE (e.g. modem)|
|Common Ground||Common shielding ground (not data ground)||1||-||-||-||-|
|TxD, TX, TD||Transmit data||Line for outgoing data (sent by DTE) ( negative logic ).||2||3||6th||output||entrance|
|RxD, RX, RD||Receive data||Line for incoming data (to be received by DTE) (negative logic).||3||2||5||entrance||output|
|RTS||Request to Send||"Send Request"; a high level at this output signals that DTE wants to send data||4th||7th||8th||output||entrance|
|RTR||Ready to Receive||"Reception Status"; a high level at this output signals to the remote station that DTE is ready to receive data||4th||7th||8th||output||entrance|
|CTS||Clear to Send||"Permission to Send"; A high level at this input is a signal from the remote station that it can receive data from the DTE||5||8th||7th||entrance||output|
|DSR||Data set ready||A high level at this input is a signal from the remote station that it is basically ready for use (but not necessarily ready to receive, see CTS)||6th||6th||1||entrance||output|
|GND||Ground||Signal ground. The signal voltages are measured against this line.||7th||5||4th||-||-|
|DCD, CD, RLSD||(Data) Carrier Detect||With a high level at this input, the remote station signals that it recognizes incoming data on the line (according to its name, this is the modulation carrier recognition) and would like to pass it on to DTE||8th||1||2||entrance||output|
|DTR||Data Terminal Ready||With a high level at this output, DTE signals its operational readiness to the remote station. So that the remote station, z. B. a modem, can be activated or reset. The remote station usually responds to DSR with a high level||20th||4th||3||output||entrance|
|RI||Ring indicator||A high level at this input signals to the DTE device that a call is arriving, i.e. This means that someone wants to set up a data connection ("ring" is for "ringing"; especially with telephones and, figuratively, also with modems). See also ring voltage .||22nd||9||-||entrance||output|
RTS, CTS and RTR
RTS / CTS was originally developed for half-duplex modems (like the Bell 202 ). Such modems switch off their transmitter when it is not needed; they have to send a synchronization signal when the transmitter is switched on again. If the computer (DTE) wants to send data, this is signaled via RTS. If the modem (DCE) has synchronized with the remote modem, this is signaled via CTS. Such modems are no longer used. Since synchronization is only allowed in one direction, the procedure is asymmetrical.
A symmetrical method that allows flow control in both directions was developed in the late 1980s. The meaning of the RTS signal has been redefined so that it indicates whether the DTE is ready to receive data from the DCE. Similarly, the CTS signals whether the DCE is ready to receive data from the DTE. This new definition is also known under the name "RTR (Ready To Receive)" (see CCITT V.24 circuit 133 and TIA-232-E). When speaking of RTS / CTS flow control, RTR / CTS flow control is often meant.
- V.24 : The ITU standard (1964) defines over 50 interface lines. The RS-232 interface uses 22 of them.
- V.28 : The ITU standard (1972) describes the electrical properties of an interface that is very often used together with the V.24 .
- DIN 66020-1 : V.24 largely adopted by the German Institute for Standardization.
- ISO 2110: Definition of the mechanics of a connector.
- Burkhard Kainka: measuring, controlling, regulating via the RS 232 interface, m. CD-ROM . 7th edition. Franzis Verlag, 1997, ISBN 978-3-7723-6058-9 .
- Joe Campbell: V24 / RS-232 communication. (6313 736) . 4th edition. Sybex-Verlag GmbH, 1984, ISBN 978-3-88745-075-5 .
- Gerhard Schnell and Bernhard Wiedemann: Bus systems in automation and process technology . 7th edition. Vieweg + Teubner Verlag GmbH, 2008, ISBN 978-3-8348-0425-9 .
- Various RS232 connector assignments and cables
- UART programming RS-232 / V.24 (PDF, 148 kB)
- Introduction to RS-232
- The serial interface - basics
- RS232 interface - background information
- ↑ Yamaha Receiver RX-V Driver 1.0 "This driver is for the Yamaha RX-V Series of receivers connected to the XP processor via RS-232", RTI Home Automation Systems
- ↑ Document at TIA ( page no longer available , search in web archives )
- ↑ Picture of a similar plug-in card from Compaq with printer connection and serial port on the slot bracket