Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

Most of the time RS232 and UART come together in serial communication theories. Are they both the same? From my readings I concluded UART is a hardware form of RS232 protocol. Am I correct?

share|improve this question

3 Answers 3

up vote 24 down vote accepted

No, UART and RS-232 are not the same.

UART is responsible for sending and receiving a sequence of bits. At the output of a UART these bits are usually represented by logic level voltages. These bits can become RS-232, RS-422, RS-485, or perhaps some proprietary spec.

RS-232 specifies voltage levels. Notice that some of these voltage levels are negative, and they can also reach ±15V. Larger voltage swing makes RS-232 more resistant to interference (albeit only to some extent).

A microcontroller UART can not generate such voltages levels by itself. This is done with help of an additional component: RS-232 line driver. A classic example of an RS-232 line driver is MAX232. If you go through the datasheet, you'll notice that this IC has a charge pump, which generates ±10V from +5V.

enter image description here (source)

share|improve this answer
4  
The RS-232 definition I have read does not talk about a sequence of bits or timing at all. I fact I have never found an official standard that describes the asynchronous NRZ start-stop protocol. –  Wouter van Ooijen May 15 at 6:28
    
RS-232 does not specify sequence of bits. –  slebetman May 15 at 15:03
    
Apparently, the development of UART character format was so dominated by the Bell telephone company that no variants sprang up. As a result, the start/data/parity/stop bit format was never the subject of an independent standard. Industry-wide usage was so uniform that no "official" definition was required. This was not true of the physical links, and so RS-232 was developed. –  WhatRoughBeast May 15 at 20:29

UART (or USART) - Universal (Synchronous) Asynchronous Receiver/Transmitter

This is, essentially, a serial communications interface. The "universal" part means that it can be configured to support many different specific serial protocols. The term is generic, and does not represent a specific standard. At minimum it means that it has a TX and an RX line, which sends a serial data stream and receives a serial data stream.

RS-232 - A standard defining the signals between two devices, defining the signal names, their purpose, voltage levels, connectors and pinouts.

This is a specific interface standard that allows for equipment interoperability. While two pieces of hardware may have UARTs, you don't know that they'll connect without damage, or communicate properly unless you know they have the same pinout and voltage standards, or include a converter or specially wired cable specific to the interconnection of these two specificl devices. To avoid the need for special converters or cables, the manufacturers may choose to follow the RS-232 standard. You know, then, that a standard RS-232 cable will connect the two.

However, neither the UART, nor the RS-232 standard define what is sent on the TX and RX lines. Generally, when people use RS-232, they use a simple 8 bit NRZ encoding with one start bit and one stop bit. Most equipment today manufactured uses this encoding, but there's no requirement to do so. You can find older equipment that includes parity bits, or uses 7 or 9 bits. The UART can be configured to support these various protocols on its TX and RX lines.

UARTs do not typically interface directly with RS-232. You will need to convert the output of the UART to the +/-12V standard that RS-232 requires. A complete RS-232 interface will typically involve both a UART and an RS-232 level converter. Further, the RS-232 standard includes the definition of several other signalling pins besides TX and RX, which you may need to use depending on the equipment you need to connect to. These will also need to be level converted, and your UART may, or may not, support these signals. If it does not you will have to control them with your software/firmware directly.

So while a UART may help you implement an RS-232 interface, it is not an RS-232 interface itself.

share|improve this answer
    
Standard RS-232 cable? There is not any such thing. In my equipment bag I carry about a dozen adapters for RS-232. RS-232 specifies a DB-25 connector, but I have seen DD-9, RJ45, din8 and other connectors, and other than hooking a modem to a pc I have never been able to use a COTS cable for any rs232 project. Fortunately 90% of the time a couple adapters will do or a custom cable, they are easy to make. –  hildred May 15 at 18:40
    
Just for the record: I think the 'S' in USART stands for "Synchronous", not "Serial". See here‌​. USARTs are "estensions" over the older UARTs chips which allow also synchronous communication modes. –  Lorenzo Donati Jul 3 at 22:01
    
You're right, thanks, updated. –  Adam Davis Jul 4 at 5:07

You are correct. UART is a hardware port, and RS232 is a communication protocol that can be implemented on it.

You might be interested to know that most "RS232" devices you run into deviate slightly from the standard. TIA-232-F is the current controlling document, but some features of the communication aren't explicit in the standard. I have frequently found industrial devices that use the standard "RS232" serial port, but they do not adhere to the standard - meaning that the USB to serial dongle won't work with their software, because it needed a hardware port that it could directly manipulate.

share|improve this answer
1  
Definitely not. Look on the other answer, which describes what's the way. –  glglgl May 15 at 8:18
3  
RS-232 is not a software protocol. –  John U May 15 at 8:31
    
The USB-RS232 problem is actually the other way around. Many adapters only implement the core parts of RS232 correctly and have buggy/missing implementations of parts that are less commonly used in consumer devices. –  Dan Neely May 15 at 15:23
    
@JohnU, thank you. That was careless of me. I meant communication protocol, really. –  Sean Boddy May 15 at 17:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.