39

I am learning about old computers, and I have found the following image from this article:

UART diagram

They use the terms "UART" instead of "serial port" and "UART driver" instead of "serial port driver", I have also read the same thing on other articles.

Why do they do that?

user3840170
  • 23,072
  • 4
  • 91
  • 150
user7127
  • 391
  • 1
  • 3
  • 3
  • 7
    all serial communication is not through UART – user17915 Nov 14 '17 at 10:26
  • 9
    USB = Universal Serial Bus. The S of SATA is also Serial. – Loren Pechtel Nov 14 '17 at 23:55
  • 19
    Because they're talking about UARTs and not serial ports, usually. – hobbs Nov 15 '17 at 02:04
  • 16
    Long story short: UART, USART, RS232 and "Serial port" are terms that are often conflated but in fact each refer to something different – Toby Nov 15 '17 at 11:57
  • "UART" is easier to say than most of the options. – Hot Licks Nov 15 '17 at 23:38
  • 5
    And, for an old computer, saying "UART" characterizes well the hardware and software interfaces. The UART was one of the first task-specific ICs that achieved common use (ca 1973), and the various vendors' versions were pretty much alike. – Hot Licks Nov 15 '17 at 23:42
  • 1
    USB is completely out of context. – ingconti Nov 16 '17 at 07:37
  • 1
    Side note: this diagram is still 100% accurate for Linux and PC hardware in 2017. Nothing 'retro' or 'old' about it! – Ian Howson Nov 16 '17 at 10:36
  • I've noticed that Linux kernel people refer to the serial console as "UART" now. I'm used to referring to RS232-style connections as "serial", and couldn't figure out why the kernel engineers needed to specify that a UART was involved, since that seemed like an implementation detail. It makes sense when you note that most peripheral connectivity is serial now, and you need some way to indicate what's happening on the wires coming out of the dev board. – fadden Jun 24 '18 at 17:03

8 Answers8

59

A UART (Universal Asynchronous Receiver-Transmitter) is a particular kind of hardware device that uses digital sampling to convert serial data that uses embedded start and stop bits for synchronization into and from parallel data. Not all forms of serial communication use start and stop bits, and not all devices that use this form of serial communication uses some sort of UART hardware. A serial port could be something completely different.

In traditional asynchronous serial communication, data has transmitted a series of "mark" and "space" values. How these values are represented depends on the communication medium, for example RS-232C defines mark as being a voltage in the range of -3V to -15V, while space is defined when voltage is in the range of +3V to +15V. In order to know where each byte (or character) starts and ends, each byte is prefixed with a space value (start bit) that indicates the start of the byte, and suffixed with one or more mark values (stop bits) that indicate the end of a byte. In between the start and stop bits each byte is transmitted as a series of mark (1) and space (0) values.

The start and stop bits help in providing the necessary synchronization for this form of serial communication to work by just transmitting mark and space values without needing precisely synchronized clocks or by also transmitting a clock separately. The start bit lets the receiver know that a fixed number of bits will follow at a given rate. The transmitter and receiver must be configured beforehand to use the same parameters, the same number of bits in a byte, the same number of stop bits, and the same baud rate. Once the receiver has received the start bit it samples the communication line at the specified baud rate to obtain each bit of the transmitted byte in sequence.

The receiver ignores the stop bit, but it performs two functions. First, it gives time for the receiver to prepare for the next byte, and this was crucial on old mechanical devices like teletypes. Secondly, it guarantees that the start bit, a space value, is preceded by a mark value, meaning each transmitted byte is preceded by a transition from mark to space. This allows the receiver to resynchronize with the serial data byte steam if starts receiving in the middle of a byte being transmitted or noise or other problem causes it to lose synchronization.

Since the start bit in fact causes the receiver to resynchronize with the transmitter every time a byte is transmitted, this means the receiver doesn't need to be sampling each bit at precisely the same rate as the transmitter is sending them. Since normally only 10 or fewer bits, including start, data, and stop bits, are transmitted before this resynchronization occurs even a relatively large 5% difference in transmitting and receiving baud rates won't cause errors.

A UART does everything necessary to implement asynchronous serial communication in hardware and does so digitally (other earlier asynchronous hardware implementations used analog timing circuits that needed manual calibration.) However, it's also possible to implement an asynchronous serial device in software using a technique called bit banging. This was done on old computers like the Commodore 64 in order to save money and is still done from time to time in modern embedded applications for the same reason.

Finally, there are other ways of transmitting data serially, like synchronous serial communication methods where a separate clock signal is transmitted alongside the serial data. In fact, many modern computer interfaces, like USB, Serial ATA, and PCI Express are actually serial devices. So while a "serial port" normally refers to an asynchronous serial device usually implemented with some sort of UART, strictly speaking, it could potentially mean a wide range of devices. By calling the hardware device used a "UART", and the software driver for it a "UART driver" the diagram you've shown in your question is actually more precise about what it's describing.

  • 8
    Good answer (especially the part about USB, PCIe, SATA, SAS, etc. also being serial.) It might also be worth noting that the term "serial port" is also used commonly to refer to things like SPI and I2C, not just UART. All of those remain common in embedded systems even today. – reirab Nov 14 '17 at 23:46
  • I thought RS232 was only +/- 5v - I seem to recall it was RS422 that was +/- 12v. – OldCurmudgeon Nov 15 '17 at 13:46
  • @reirab Even (wired) ethernet and PCI-e are in essence serial. (With possibly several serial lines used in a parallel). – Tonny Nov 15 '17 at 14:05
  • 3
    @OldCurmudgeon TTL RS232 uses 0-5V. RS422 can go upto +/- 48V if memory serves. The 5V and 12V are just very common because those voltages are readily available from the power-supplies of many devices so don't require additional circuitry to generate the voltages. – Tonny Nov 15 '17 at 14:08
  • 6
    RS232C is way, way old. I'm Pretty sure that version of the standard required the voltage levels to swing between something like +12V and -12V. Since then we've had RS232-D, -E, and -F. One of the later standards allowed voltage to swiing between +5 and -5 (but still required to accept +12 & -12), and then a still later one allowed it to go as low as +/- 3V. – Solomon Slow Nov 15 '17 at 17:36
  • @jameslarge: Good standards for signalling generally impose tougher requirements on transmitters, cables, and receivers. A conforming transmitter must produce sufficient voltage that even after going through the worst conforming cable, the levels will satisfy the needs of the pickiest conforming receiver. If a transmitter is only intended for use with cables that don't attenuate the voltage nearly as much as the standard would allow, it need not output nearly as strong a signal as the Standard would otherwise require. – supercat Nov 15 '17 at 19:53
  • One thing I cannot understand from the description above is how the receiver can differentiate a space mark mark sequence to be 011 as opposed to, say, be the start bit followed by two bit set to 1. Does this mean that at rest (no data transmitted), the data signal is grounded? – user180940 Aug 28 '19 at 11:05
  • @user180940 The receiver only interprets a space as a start bit if it's not expecting a data bit or a stop bit. The receiver expects a data bit if it's one of the X bits following a start bit, where X is the number of data bits its been configured to expect (usually 8). –  Aug 28 '19 at 14:02
  • @reirab - not only embedded systems; modern PCs also tend to have SPI or I2C buses for functions like reading temperature sensors, controlling fans and setting options on motherboard LED ports. They may not be exposed to the end user, but they exist within the motherboard and the OS needs to know how to use them. – occipita Mar 12 '21 at 03:36
22

Simply, a UART is a serial port, but a serial port is not necessarily a UART.

Serial port is a general term for anything serial, without further specification, while a UART defines a transceiver for a specific asynchronous format. That Ports using asynchronous protocols like RS232 or TTY are colloquially simplified as serial port shouldn't promote technical documentation to be as unspecific.

On a more technical side, a SPI is also a serial port, but I doubt that any UART driver will be able to handle its specifications.

john_e
  • 7,263
  • 20
  • 44
Raffzahn
  • 222,541
  • 22
  • 631
  • 918
  • Although you are not wrong, I would clarify that a lot of people consider the RS-232 port on the back of their computer a "serial port" and in that case a "serial port" uses a UART. – Sam Nov 14 '17 at 14:52
  • 2
    @Sam Except you're forgetting that there are a number of retro computers that have a standard RS-232 serial port that is not driven by a UART chip. The UART chip and terminology is IBM-PC specific. – mnem Nov 14 '17 at 21:43
  • 4
    @mnem Agree to your first sentence, disagree with the second. UART is in no way IBM-PC-specific. The TI TMS 6011 had nothing to do with an IBM-PC, appeared in 1977 and was called an UART, for examle – tofro Nov 15 '17 at 12:53
  • 2
    @mnem, UART chips were available to purchase several years prior to the release of the original IBM-PC. https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter#History – Solomon Slow Nov 15 '17 at 17:39
  • @tofro Fair enough, I stand corrected. I've just never heard of the actual use of a UART in anything home-computer related other than the PC before. – mnem Nov 15 '17 at 17:42
  • @Raffzahn Actually, it's not so uncommon to use UART to communicate using SPI. Usually, the DTR or RTS line is used as clock. Many "serial" programmers for AVR used this "feature". – AndrejaKo Nov 15 '17 at 20:11
  • @AndrejaKo Mind to give an example? I'm doing SPI since quite some time in many variations, but I never came across a way where a standard UART was used to drive SPI. – Raffzahn Nov 15 '17 at 21:45
  • @Raffzahn This seems to be an example: http://www.instructables.com/id/AVR-ISP-programmer/ The programer software is set up so that it provides clock via DTR pin, if I remember correctly. – AndrejaKo Nov 16 '17 at 06:18
  • @AndrejaKo :)) Ahh, the PonyProg (original page here: http://www.lancos.com/prog.html ). I was waiting for that. While it's true that control signals of the PC UART are used, it has nothing to do with the UART. The software is only using these lines as I/O ports for bitbanging. Could be any other 4- bit I/O as well. Abusing the UART doesn't realy make a case. – Raffzahn Nov 16 '17 at 08:27
  • @Raffzahn Well, that depends a lot on the definition of "has nothing to do" :). Yes, it is abuse, but it's being done using UART. – AndrejaKo Nov 16 '17 at 10:40
  • @AndrejaKo yeah, I see. Much the same way as using a Windows PC to drive a nail into a wall and call it a GUI application :) – Raffzahn Nov 16 '17 at 10:52
  • 1
    @mnem You'll find an 8251 UART on the Imsai 8080 SIO (Serial I/O) card (ca. 1976). The later Multi-I/O card had a Western Digital (yes, that Western Digital) TR1602. – Blrfl Nov 22 '17 at 11:02
5

UART is an initialism for "Universal Asynchronous Receiver/Transmitter", the manufacturer's name for the 8250 that was used in the original PC (and elsewhere) to run the serial port. That initialism continued to be used when labelling the 16550 which succeeded the 8250 and the term has attached itself to the serial port ever since.

Tommy
  • 36,843
  • 2
  • 124
  • 171
  • 1
    Serial ports needn't have UART chips (see: Commodore 64; Amiga 500). UARTs have small buffers that reduce the odds of characters getting dropped at higher speeds. So, you could say a UART is always part of a serial port, but a serial port doesn't always have a UART. – Jim MacKenzie Nov 14 '17 at 02:55
  • Right. The Vic-20 used a VIA, the C64 a CIA, it's safe to assume the Spectrum was built intentionally to bit bang, but the IBM PC had always used a chip called a UART, and the name of the PC's chip has attached itself to the port in many cases. Much like how tty is nearly synonymous with 'console', despite almost nobody having seen a teletype in years and a teletype not being required for a console. – Tommy Nov 14 '17 at 04:14
  • 1
    @Tommy: Both the VIC-20 and C64 used software-based bit-bang UARTs. – supercat Nov 14 '17 at 16:58
  • @supercat yes, but unintentionally. The VIA has that analogue race condition with clock phase and the shifter, and as I understand it, a CIA trace is missing on the C64 board. But, regardless, those are the chips which definitely are not UARTs which are electrically responsible for those serial ports. – Tommy Nov 14 '17 at 17:07
  • @Tommy: The VIA and CIA both had synchronous serial ports. I don't think either had the logic necessary to watch for a start bit and generate a bit clock that was delayed half a bit period from the falling edge. The VIA and CIA serial ports were intended to communicate with synchronous serial peripherals; I don't think they were ever intended for use as UARTs. – supercat Nov 14 '17 at 17:25
  • @supercat on the VIA the CB1 input can act to clock the shifter, which samples CB2. An interrupt is generated upon a full byte. That's the process Commodore intended to use for serial receipt and transmission. But there's a bug in the VIA whereby it doesn't shift (or shifts twice, I forget) if the external clock is signalled within a certain close duration of the beginning of clock phase 2. So bit banging was the fallback. – Tommy Nov 14 '17 at 17:42
  • ... and for the record, since it seems to be leading to a lot of debate: my answer doesn't say that serial ports must have UART chips; my first comment expands in response to somebody else making the converse explicit by stating the chips through which serial ports are connected on some other machines, without elaborating on the software that drives them. I feel like I'm having to defend a lot of statements I haven't actually made with this answer, but that's probably my fault for making it so brief. – Tommy Nov 14 '17 at 17:45
  • @Tommy: How much difficulty would there have been synchronizing the CB1 input on the VIC-20 with the rising edge of phi1, thus making the hardware feature usable? – supercat Sep 24 '22 at 21:09
3

Adding to the other answers:

Other than distinguishing pure asynchronous operation from asynchronous/synchronous transmission/receive (opposing the term USART), the term could also have been used for other reasons:

A denomination of UART serial port could distinguish your product from a non-UART serial port as "has some chip that relieves the CPU from the burden of transmitting bits".

The Sinclair ZX Spectrum with its IF1 had, for example, a (asynchronous) serial port that was bit-banged by the CPU, so kept the CPU pretty busy while transmitting/receiving, which also limited the maximum speed at which this port could operate (while keeping hardware cost at a limit).

UARTs instead were known to reach acceptable bandwidth transmissions and known to relieve the CPU from bit transmission and were thus a unique selling point.

tofro
  • 34,832
  • 4
  • 89
  • 170
  • My family having first acquired a PC in the 486 era, having a 16550 rather than an 8250 was something some clone manufacturers still bothered to advertise. I guess that in the not-quite-yet-internet era others were still cheaping out. But I think this adds credibility to your argument, even if I didn't turn up until the sales boast had evolved from "we're asynchronous" to "we're even more asynchronous than those guys". – Tommy Nov 15 '17 at 15:49
2

The UART is one of the functional blocks required to implement what was traditionally called a serial port (aka RS-232 port) - the other one is an RS-232 line driver / receiver. Originally the UART and line driver/receiver were separate chips, but more recently they are just blocks within a chipset.

So the serial port is the entire set of functionality (or the connector, depending on how you view things :)) while the UART is one of the pieces that makes it work.

  • Welcome to Retrocomputing Stack Exchange. Please read the [tour]. This answer is true as of a certain point, but it might be useful to note that all of the lines were controlled "manually" by the program in the days before UARTs were common in hardware. – wizzwizz4 Nov 15 '17 at 19:10
1

Your article is wrong. A UART is a specific device (universal asynchronous receiver/transmitter) dealing with all the timing (and some buffering and framing error detection) of an asynchronous serial line transmission. They are usually employed for serving serial lines since they take load and timing requirements off the main CPU.

However, they do not include the line level drivers: those are conspicuously absent from your diagram. For RS232, eventually Maxim came up with notorious drivers working at 5V and including the respective switching voltage multipliers/inverters at a time switching drivers were kind of unusual (outside of memory chips where they started being a thing with, uh, 4164 dynamic RAM chips and 2716 EPROMs? since the 12V and -5V requirements of earlier RAM and EPROM chips were becoming a nuisance because of pin count and PCB layout).

1

A UART is a Univeral Asynchronous Receiver and Transmitter. It is an electronic circuit which handles communication over an asynchronous serial interface - very often an RS232 interface.

Serial Port or RS232 is a specification for serial communications between a DCE and DTE (For example communication between computer and modem); it defines electrical characteristics, the 25-way 'D' connector and the various functions of the various signal lines.

0

Serial ports include line drivers, whereas UARTs are used to frame asynchronous data streams. UARTs precede line drivers.

"UART driver" is not even hardware -- it is software -- notice that it is part of the kernel in your diagram, so -- they are referring to the operating system there. In IBM PCs that ran DOS -- that was not the case. There were a couple of BIOS service calls in the firmware, but -- the 8250 style UART was not controlled by the "kernel" at all -- it was controlled largely by user written code, or a third party driver until DOS 5.0 / Win3.1 -- Many flavors of BASIC contained routines for serial communications at that time.

Your diagram also refers to TTYs -- teletypes -- which -- are primarily driven by RS-232 as well.

jinzai
  • 111
  • 1