While interfaces such as Ethernet, FireWire, and USB also send data as a serial stream, the term serial port usually denotes hardware compliant with RS-232 or a related standard, such as RS-485 or RS-422.
Modern consumer personal computers (PCs) have largely replaced serial ports with higher-speed standards, primarily USB. However, serial ports are still frequently used in applications demanding simple, low-speed interfaces, such as industrial automation systems, scientific instruments, point of sale systems and some industrial and consumer products.
Server computers may use a serial port as a control console for diagnostics, while networking hardware (such as routers and switches) commonly use serial console ports for configuration, diagnostics, and emergency maintenance access. To interface with these and other devices, USB-to-serial converters can quickly and easily add a serial port to a modern PC.
Modern devices use an integrated circuit called a UART to implement a serial port. This IC converts characters to and from asynchronous serial form, implementing the timing and framing of data specified by the serial protocol in hardware. The IBM PC implements its serial ports, when present, with one or more UARTs.
Very low-cost systems, such as some early home computers, would instead use the CPU to send the data through an output pin, using the bit banging technique. These early home computers often had proprietary serial ports with pinouts and voltage levels incompatible with RS-232.
Before large-scale integration (LSI) made UARTs common, serial ports were commonly used in mainframes and minicomputers, which would have multiple small-scale integrated circuits to implement shift registers, logic gates, counters, and all the other logic needed. As PCs evolved serial ports were included in the Super I/O chip and then in the chipset.
An IBM PC serial card with a 25-pin connector (obsolete 8-bit ISA card)
A four-port serial (RS-232) PCI Express×1 expansion card with an octopus cable that breaks the card's DC-37 connector into four standard DE-9 connectors
A converter from USB to an RS-232 compatible serial port—more than a physical transition, it requires a driver in the host system software and a built-in processor to emulate the functions of the IBM XT compatible serial port hardware.
UART to USB adapter
DTE and DCE
The individual signals on a serial port are unidirectional and when connecting two devices, the outputs of one device must be connected to the inputs of the other. Devices are divided into two categories: data terminal equipment (DTE) and data circuit-terminating equipment (DCE). A line that is an output on a DTE device is an input on a DCE device and vice versa, so a DCE device can be connected to a DTE device with a straight wired cable, in which each pin on one end goes to the same numbered pin on the other end.
Conventionally, computers and terminals are DTE, while peripherals such as modems are DCE. If it is necessary to connect two DTE (or DCE) devices together, a cable with reversed TX and RX lines, known as a cross-over, roll-over or null modem cable must be used.
Gender
Generally, serial port connectors are gendered, only allowing connectors to mate with a connector of the opposite gender. With D-subminiature connectors, the male connectors have protruding pins, and female connectors have corresponding round sockets.[2] Either type of connector can be mounted on equipment or a panel; or terminate a cable.
Connectors mounted on DTE are likely to be male, and those mounted on DCE are likely to be female (with the cable connectors being the opposite). However, this is far from universal; for instance, most serial printers have a female DB25 connector, but they are DTEs.[3] In this circumstance, the appropriately gendered connectors on the cable or a gender changer can be used to correct the mismatch.
Connectors
The only connector specified in the original RS-232 standard was the 25-pin D-subminiature, however, many other connectors have been used to save money or save on physical space, among other reasons. In particular, since many devices do not use all of the 20 signals that are defined by the standard, connectors with fewer pins are often used. While specific examples follow, countless other connectors have been used for RS-232 connections.
The 9-pin DE-9 connector has been used by most IBM-compatible PCs since the Serial/Parallel Adapter option for the PC-AT, where the 9-pin connector allowed a serial and parallel port to fit on the same card.[4] This connector has been standardized for RS-232 as TIA-574.
Some miniaturized electronics, particularly graphing calculators[5] and hand-held amateur and two-way radio equipment,[6] have serial ports using a phone connector, usually the smaller 2.5 or 3.5mm connectors and the most basic 3-wire interface—transmit, receive and ground.
8P8C connectors are also used in many devices. The EIA/TIA-561 standard defines a pinout using this connector, while the rollover cable (or Yost standard) is commonly used on Unix computers and network devices, such as equipment from Cisco Systems.[7]
Many models of Macintosh favor the related RS-422 standard, mostly using circular mini-DIN connectors. The Macintosh included a standard set of two ports for connection to a printer and a modem, but some PowerBook laptops had only one combined port to save space.[8]
10P10C connectors can be found on some devices.[9]
Another common connector is a 10 × 2pin header common on motherboards and add-in cards which is usually converted via a ribbon cable to the more standard 9-pin DE-9 connector (and frequently mounted on a free slot plate or other part of the housing).[10]
Pinouts
The following table lists commonly used RS-232 signals and pin assignments:[11]
Signal Ground is a common return for the other connections; it appears on two pins in the Yost standard but is the same signal. The DB-25 connector includes a second Protective Ground on pin 1, which is intended to be connected by each device to its own frame ground or similar. Connecting Protective Ground to Signal Ground is a common practice but not recommended.
Note that EIA/TIA 561 combines DSR and RI,[13][14] and the Yost standard combines DSR and DCD.
Hardware abstraction
Operating systems usually create symbolic names for the serial ports of a computer, rather than requiring programs to refer to them by hardware address.
Unix-like operating systems usually label the serial port devices /dev/tty*. TTY is a common trademark-free abbreviation for teletype, a device commonly attached to early computers' serial ports, and * represents a string identifying the specific port; the syntax of that string depends on the operating system and the device. On Linux, 8250/16550 UART hardware serial ports are named /dev/ttyS*, USB adapters appear as /dev/ttyUSB* and various types of virtual serial ports do not necessarily have names starting with tty.
The DOS and Windows environments refer to serial ports as COM ports: COM1, COM2,..etc.[15]
Common applications for serial ports
This list includes some of the more common devices that are connected to the serial port on a PC. Some of these such as modems and serial mice are falling into disuse while others are readily available. Serial ports are very common on most types of microcontroller, where they can be used to communicate with a PC or other serial devices.
Since the control signals for a serial port can be driven by any digital signal, some applications used the control lines of a serial port to monitor external devices, without exchanging serial data. A common commercial application of this principle was for some models of uninterruptible power supply which used the control lines to signal loss of power, low battery, and other status information. At least some Morse code training software used a code key connected to the serial port to simulate actual code use; the status bits of the serial port could be sampled very rapidly and at predictable times, making it possible for the software to decipher Morse code.
Serial computer mice may draw their operating power from the received data or control signals.[16][17]
Serial standards provide for many different operating speeds as well as adjustments to the protocol to account for different operating conditions. The most well-known options are speed, number of data bits per character, parity, and number of stop bits per character.
In modern serial ports using a UART integrated circuit, all these settings can be software-controlled. Hardware from the 1980s and earlier may require setting switches or jumpers on a circuit board.
The configuration for serial ports designed to be connected to a PC has become a de facto standard, usually stated as 9600/8-N-1.
Speed
Serial ports use two-level (binary) signaling, so the data rate in bits per second is equal to the symbol rate in baud. The total speed includes bits for framing (stop bits, parity, etc.) and so the effective data rate is lower than the bit transmission rate. For example, with 8-N-1 character framing, only 80% of the bits are available for data; for every eight bits of data, two more framing bits are sent.
A standard series of rates is based on multiples of the rates for electromechanical teleprinters; some serial ports allow many arbitrary rates to be selected, but the speeds on both sides of the connection must match for data to be received correctly. Bit rates commonly supported include 75, 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200bit/s.[19] Many of these standard modem baud rates are multiples of either 1.2kbps (e.g., 19200, 38400, 76800) or 0.9kbps (e.g., 57600, 115200).[23]Crystal oscillators with a frequency of 1.843200MHz are sold specifically for this purpose. This is 16 times the fastest bit rate, and the serial port circuit can easily divide this down to lower frequencies as required.
The capability to set a bit rate does not imply that a working connection will result. Not all bit rates are possible with all serial ports. Some special-purpose protocols such as MIDI for musical instrument control, use serial data rates other than the teleprinter standards. Some serial port implementations can automatically choose a bit rate by observing what a connected device is sending and synchronizing to it.
Data bits
The number of data bits in each character can be 5 (for Baudot code), 6 (rarely used), 7 (for true ASCII), 8 (for most kinds of data, as this size matches the size of a byte), or 9 (rarely used). 8 data bits are almost universally used in newer applications. 5 or 7 bits generally only make sense with older equipment such as teleprinters.
Most serial communications designs send the data bits within each byte least significant bit first. Also possible, but rarely used, is most significant bit first; this was used, for example, by the IBM 2741 printing terminal. The order of bits is not usually configurable within the serial port interface but is defined by the host system. To communicate with systems that require a different bit ordering than the local default, local software can re-order the bits within each byte just before sending and just after receiving.
Parity is a method of detecting errors in transmission. When parity is used with a serial port, an extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. Correct parity does not necessarily indicate absence of corruption as a corrupted transmission with an even number of errors will pass the parity check. A single parity bit does not allow implementation of error correction on each character, and communication protocols working over serial data links will typically have higher-level mechanisms to ensure data validity and request retransmission of data that has been incorrectly received.
The parity bit in each character can be set to one of the following:
None (N) means that no parity bit is sent and the transmission is shortened.
Odd (O) means that the parity bit is set so that the number of 1 bits is odd.
Even (E) means that the parity bit is set so that the number of 1 bits is even.
Mark (M) parity means that the parity bit is always set to the mark signal condition (1 bit value).
Space (S) parity always sends the parity bit in the space signal condition (0 bit value).
Aside from uncommon applications that use the last bit (usually the 9th) for some form of addressing or special signaling, mark or space parity is uncommon, as it adds no error detection information.
Odd parity is more useful than even parity since it ensures that at least one state transition occurs in each character, which makes it more reliable at detecting errors like those that could be caused by serial port speed mismatches. The most common parity setting, however, is none, with error detection handled by a communication protocol.
To allow detection of messages damaged by line noise, electromechanical teleprinters were arranged to print a special character when received data contained a parity error.
Stop bits
Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronize with the character stream. Electronic devices usually use one stop bit. If slow electromechanical teleprinters are used, one-and-one half or two stop bits may be required.
Conventional notation
The data/parity/stop (D/P/S) conventional notation specifies the framing of a serial connection. The most common configuration for the personal computing devices is 8-N-1 (also spelled as 8N1, 8-None-1[24]), in which there is one start bit, eight ("8") data bits, no ("N") parity bit, and one ("1") stop bit.[25] In this notation, the parity bit is not included into the count of the data bits. For example, 7/E/1 (7E1) means that an even parity bit is added to the 7 data bits for a total of 8 bits between the start and stop bits.
The abbreviation is usually given together with the line speed in bits per second, as in "9600–8-N-1". The speed (or baud rate) includes bits for framing (stop bits, parity, etc.), thus the effective data rate is lower than the baud rate. For 8-N-1 encoding, only 80% of the bits are available for data (for every eight bits of data, ten bits are sent over the serial link— one start bit, the eight data bits, and the one stop bit).[24]
Flow control
Flow control is used in circumstances where a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a handshaking method. There are hardware and software handshaking methods.
Hardware handshaking is done with extra signals, often the RS-232 RTS/CTS or DTR/DSR signal circuits. RTS and CTS are used to control data flow, signaling, for instance, when a buffer is almost full. Per the RS-232 standard and its successors, DTR and DSR are used to signal that equipment is present and powered up so are usually asserted at all times. However, non-standard implementations exist, for example, printers that use DTR as flow control.
Software handshaking is done for example with ASCII control characters XON/XOFF to control the flow of data. The XON and XOFF characters are sent by the receiver to the sender to control when the sender will send data, that is, these characters go in the opposite direction to the data being sent. The system starts in the sending allowed state. When the receiver's buffers approach capacity, the receiver sends the XOFF character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an XON character to tell the sender to resume transmission. It is an example of in-band signaling, where control information is sent over the same channel as its data.
The advantage of hardware handshaking is that it can be extremely fast, it works independently of imposed meaning such as ASCII on the transferred data and it is stateless. Its disadvantage is that it requires more hardware and cabling, and both ends of the connection must support the hardware handshaking protocol used.
The advantage of software handshaking is that it can be done with absent or incompatible hardware handshaking circuits and cabling. The disadvantage, common to all in-band control signaling, is that it introduces complexities in ensuring that control messages get through even when data messages are blocked, and data can never be mistaken for control signals. The former is normally dealt with by the operating system or device driver; the latter normally by ensuring that control codes are escaped (such as in the Kermit protocol) or omitted by design (such as in ANSI terminal control).
If no handshaking is employed, an overrun receiver might simply fail to receive data from the transmitter. Approaches for preventing this include reducing the speed of the connection so that the receiver can always keep up, increasing the size of buffers so it can keep up averaged over a longer time, using delays after time-consuming operations (e.g. in termcap) or employing a mechanism to resend data which has not been received correctly (e.g. TCP).
In telecommunications, RS-232 or Recommended Standard 232 is a standard originally introduced in 1960 for serial communication transmission of data. It formally defines signals connecting between a DTE such as a computer terminal or PC, and a DCE, such as a modem. The standard defines the electrical characteristics and timing of signals, the meaning of signals, and the physical size and pinout of connectors. The current version of the standard is TIA-232-F Interface Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary Data Interchange, issued in 1997.
A data circuit-terminating equipment (DCE) is a device that sits between the data terminal equipment (DTE) and a data transmission circuit. It is also called data communication(s) equipment and data carrier equipment. Usually, the DTE device is the terminal, and the DCE is a modem.
Data terminal equipment (DTE) is an end instrument that converts user information into signals or reconverts received signals. It is also called data processing terminal equipment or tail circuit. A DTE device communicates with the data circuit-terminating equipment (DCE), such as a modem. The DTE/DCE classification was introduced by IBM.
A universal asynchronous receiver-transmitter is a peripheral device for asynchronous serial communication in which the data format and transmission speeds are configurable. It sends data bits one by one, from the least significant to the most significant, framed by start and stop bits so that precise timing is handled by the communication channel. The electric signaling levels are handled by a driver circuit external to the UART. Common signal levels are RS-232, RS-485, and raw TTL for short debugging links. Early teletypewriters used current loops.
COM is the original, yet still common, name of the serial port interface on PC-compatible computers. It can refer not only to physical ports, but also to emulated ports, such as ports created by Bluetooth or USB adapters.
In computing, a parallel port is a type of interface found on early computers for connecting peripherals. The name refers to the way the data is sent; parallel ports send multiple bits of data at once, as opposed to serial communication, in which bits are sent one at a time. To do this, parallel ports require multiple data lines in their cables and port connectors and tend to be larger than contemporary serial ports, which only require one data line.
In telecommunication and data transmission, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels.
GeoPort is a serial data system used on some models of the Apple Macintosh that could be externally clocked to run at a 2 megabit per second data rate. GeoPort slightly modified the existing Mac serial port pins to allow the computer's internal DSP hardware or software to send data that, when passed to a digital-to-analog converter, emulated various devices such as modems and fax machines. GeoPort could be found on late-model 68K-based machines as well as many pre-USB Power Macintosh models and PiPPiN. Some later Macintosh models also included an internal GeoPort via an internal connector on the Communications Slot. Apple GeoPort technology is now obsolete, and modem support is typically offered through USB.
Asynchronous serial communication is a form of serial communication in which the communicating endpoints' interfaces are not continuously synchronized by a common clock signal. Instead of a common synchronization signal, the data stream contains synchronization information in form of start and stop signals, before and after each unit of transmission, respectively. The start signal prepares the receiver for arrival of data and the stop signal resets its state to enable triggering of a new sequence.
RS-422, also known as TIA/EIA-422, is a technical standard originated by the Electronic Industries Alliance, first issued in 1975, that specifies electrical characteristics of a digital signaling circuit. It was meant to be the foundation of a suite of standards that would replace the older RS-232C standard with standards that offered much higher speed, better immunity from noise, and longer cable lengths. RS-422 systems can transmit data at rates as high as 10 Mbit/s, or may be sent on cables as long as 1,200 meters (3,900 ft) at lower rates. It is closely related to RS-423, which uses the same signaling systems but on a different wiring arrangement.
Null modem is a communication method to directly connect two DTEs using an RS-232 serial cable. The name stems from the historical use of RS-232 cables to connect two teleprinter devices or two modems in order to communicate with one another; null modem communication refers to using a crossed-over RS-232 cable to connect the teleprinters directly to one another without the modems. It is also used to serially connect a computer to a printer, since both are DTE, and is known as a Printer Cable.
In data communications, flow control is the process of managing the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver. Flow control should be distinguished from congestion control, which is used for controlling the flow of data when congestion has actually occurred. Flow control mechanisms can be classified by whether or not the receiving node sends feedback to the sending node.
A serial cable or RS-232 cable is a cable used to transfer information between two devices using a serial communication protocol. The form of connectors depends on the particular serial port used. A cable wired for connecting two DTEs directly is known as a null modem cable.
The PS/2 port is a 6-pin mini-DIN connector used for connecting keyboards and mice to a PC compatible computer system. Its name comes from the IBM Personal System/2 series of personal computers, with which it was introduced in 1987. The PS/2 mouse connector generally replaced the older DE-9 RS-232 "serial mouse" connector, while the PS/2 keyboard connector replaced the larger 5-pin/180° DIN connector used in the IBM PC/AT design. The PS/2 keyboard port is electrically and logically identical to the IBM AT keyboard port, differing only in the type of electrical connector used. The PS/2 platform introduced a second port with the same design as the keyboard port for use to connect a mouse; thus the PS/2-style keyboard and mouse interfaces are electrically similar and employ the same communication protocol. However, unlike the otherwise similar Apple Desktop Bus connector used by Apple, a given system's keyboard and mouse port may not be interchangeable since the two devices use different sets of commands and the device drivers generally are hard-coded to communicate with each device at the address of the port that is conventionally assigned to that device.
A computer port is a hardware piece on a computer where an electrical connector can be plugged to link the device to external devices, such as another computer, a peripheral device or network equipment.This is a non-standard term.
The Modified Modular Jack (MMJ) is a small form-factor serial port connector developed by Digital Equipment Corporation (DEC). It uses a modified version of the 6P6C modular connector with the latch displaced off-center so standard modular connectors found on Ethernet cables or phone jacks cannot accidentally be plugged in. MMJ connections are used on Digital minicomputers, such as the PDP-11, VAX and Alpha systems, and to connect terminals, printers, and serial console servers.
A voice modem is an analog telephone data modem with a built-in capability of transmitting and receiving voice recordings over the phone line. Voice modems are used for telephony and answering machine applications. Similar to the Hayes command set used for data modems, in which the host PC commands the modem via a series of commands known as AT commands, there exists a well-defined set of common voice AT commands that are somewhat consistent throughout the industry.
RS-423, also known as TIA/EIA-423, is a technical standard originated by the Electronic Industries Alliance that specifies electrical characteristics of a digital signaling circuit. Although it was originally intended as a successor to RS-232C offering greater cable lengths, it is not widely used.
Data Carrier Detect (DCD) or Carrier Detect (CD) is a control signal present inside an RS-232 serial communications cable that goes between a computer and another device, such as a modem. This signal is a simple "high/low" status bit that is sent from a data communications equipment (DCE) to a data terminal equipment (DTE), i.e., from the modem or other peripheral to a computer in a typical scenario. It is present on virtually all PC serial ports - pin 1 of a nine-pin (DE9) serial port, or pin eight over a 25-pin (DB25) port. Its purpose varies depending on the device connected, but the most specific meaning is to indicate when a modem is connected to another remote modem via telephone lines.
Data Terminal Ready (DTR) is a control signal in RS-232 serial communications, transmitted from data terminal equipment (DTE), such as a computer, to data communications equipment (DCE), for example a modem, to indicate that the terminal is ready for communications and the modem may initiate a communications channel.
Serial Port Complete: COM Ports, USB Virtual COM Ports, and Ports for Embedded Systems; 2nd Edition; Jan Axelson; Lakeview Research; 380 pages; 2007; ISBN978-1-931-44806-2.
This page is based on this Wikipedia article Text is available under the CC BY-SA 4.0 license; additional terms may apply. Images, videos and audio are available under their respective licenses.