What's difference between RS232 and UART in context of programming ?

Thread Starter

John99407

Joined Jul 12, 2019
56
Hi,
RS232 and UART both are serial protocol, UART and RS-232 are not the same but I do not understand how RS232 is different then RS232. UART is responsible for sending and receiving a sequence of bits.
What's basic difference between RS232 and UART in context of programming ?
 

cmartinez

Joined Jan 17, 2007
6,905
UART is a communications protocol, whilst RS232 defines the physical signal levels. That is, while UART has everything to do with logic and programming, it has nothing to do with the electronics per se. Whilst RS232 refers to the electronics and hardware needed for serial communications.

Google "rs232 signal levels and pinout".
 
Last edited:

OBW0549

Joined Mar 2, 2015
3,309
UART is a communications protocol,
Ummm... no.

whilst RS232 defines the physical signal levels.
That part is true.

That is, while UART has everything do with logic and programming, it has nothing to do with the electronics per se.
A UART is the physical piece of hardware that handles the sending and receiving of the serial data. It can either be on a chip by itself, such as a 16650 or 8250 or numerous others, or implemented as an on-chip peripheral on a microcontroller chip. But a UART is not a communication protocol; it implements one.

Whilst RS232 refers to the electronics and hardware needed for serial communications.
RS-232 is a physical interface specification that ensures devices can be interconnected and successfully send and receive signals, without letting out any of the Magic Smoke.
 

SamR

Joined Mar 19, 2019
2,047
To simplify, RS232 is the standard, UART is the hardware. There have been several UART chips over the years as baud rates increased.
 

MrChips

Joined Oct 2, 2009
20,912
This is where the confusion arises. No wonder that the newcomer is confused.

RS-232 is the standard. Not only does it define voltage levels and rise and fall times, it goes so far as defining the type of connector and the pins assigned to each signal. Later revisions of the RS-232 standard defined data encoding protocol.

UART is a chip that implements part of the RS-232 standard protocol, not the electrical part. Thus it is common practice to refer to the UART as a protocol even though it is just a piece of hardware.

From a programming perspective, which is what the TS is inquiring, the software interacts with the UART module in order to send and receive serial data confirming to the NRZ (non-return-to-zero) communication coding mechanism. Strictly speaking in order to avoid confusion, RS-232 should be reserved for discussion of the voltage conversion interface that converts the 0-5V (TTL) signals to -5V to +5V (or greater, such as -15V to +15V). There are other voltage standards such as RS-422 and RS-485 which are also in use for serial communications.

https://ipc2u.com/articles/knowledge-base/the-main-differences-between-rs-232-rs-422-and-rs-485/
 

MaxHeadRoom

Joined Jul 18, 2013
20,454
Thus it is common practice to refer to the UART as a protocol even though it is just a piece of hardware.
The old/original software protocol offered many options for the data format, up to 8 bit data, parity/no parity - software handshake (as opposed to hardware) - binary/ASCII and the later MODBUS/CANBUS etc.
It was often said it has so many options that it is hardly a standard! ;)
Max.
 

cmartinez

Joined Jan 17, 2007
6,905
But a UART is not a communication protocol; it implements one.
Thanks for the clarification. I stand corrected.

UART is a chip that implements part of the RS-232 standard protocol, not the electrical part. Thus it is common practice to refer to the UART as a protocol even though it is just a piece of hardware.
My initial comment falls in that category.

A UART is something you program, RS232 is something you physically connect.
Bingo! :)
 

nsaspook

Joined Aug 27, 2009
7,185
I recall using it this way, back then! ;)
Also using the RTS, CTS, DSR for working with tape punch readers etc, i.e. turn them on remotely.
Now, and for a while, Null-Modem with handshake jumpered is used due to high speed peripherals.
Max.
You still see RTS, CTS flow-control at the logic signal level when interfacing things like BLE modules to control data flow when the RF drops out momentarily.
http://www.summitdata.com/blog/uart-flow-control-rtscts-necessary-proper-operation-wireless-modules/
 
Top