Serial Interface: RS-232, USB & USART
Open in the Padhaiko app4.4 Serial Interface
In serial data communication, the bits of a binary word are transmitted sequentially one bit at a time across a single data line or physical conductor pair.
While parallel communication requires multiple data conductors (e.g., 8, 16, or 32 parallel wires) alongside a common ground, serial communication reduces the transmission medium to a single transmit line, a single receive line, and a common ground reference.
Why Serial Interfaces are Used
Parallel interfaces are ideal for high-speed, short-distance transfers across internal CPU buses or motherboard traces. However, when connecting over distances exceeding a few meters, parallel interfaces face three major technical barriers:
- Cable Bulk and Cost: Running 8 to 32 shielded conductors over long distances significantly increases cabling weight, physical bulk, and installation costs.
- Clock and Data Skew: Due to minor variations in physical wire length, insulation dielectric constant, and wire resistance, parallel signals do not travel at identical speeds. Over longer distances, bits transmitted simultaneously arrive at different times (skew), corrupting data framing.
- Crosstalk: Closely spaced parallel wires suffer from inductive and capacitive signal coupling (crosstalk), where high-frequency switching on one line induces false voltages on adjacent lines.
Serial transmission avoids these issues by sending bits down a single transmission channel, making it the preferred standard for long-distance telecommunications, local device interconnects (RS-232, RS-485), and modern high-speed peripheral buses (USB, PCIe, SATA).
Directional Communication Modes
| Communication Mode | Data Direction | Physical Channel | Typical Application |
|---|---|---|---|
| Simplex | Unidirectional only (Transmitter to Receiver) | Single conductor or channel | Commercial FM/AM broadcast, GPS receiver |
| Half-Duplex | Bidirectional, but only one direction at a time | Single shared channel (time-shared) | Walkie-talkie radio, RS-485 two-wire bus |
| Full-Duplex | Bidirectional simultaneously in both directions | Separate transmit (TX) and receive (RX) lines | Telephone network, RS-232, modern Ethernet |
Baud Rate versus Bit Rate
- Bit Rate (bps): The actual number of information bits transmitted per second: Bit Rate = Bits / Second
- Baud Rate (symbols/sec): The number of physical signal transitions or symbol state changes occurring on the communication line per second.
In binary signaling schemes where each signal level represents exactly one binary bit (such as standard TTL or RS-232), the baud rate is numerically identical to the bit rate: Bit Rate = Baud Rate x 1 bit/symbol
In advanced modulation schemes (e.g., QPSK, QAM), where each signal transition represents multiple bits (M bits per symbol), the bit rate is given by: Bit Rate = Baud Rate x log2(M)
4.4.1 Synchronous and asynchronous transmission
Serial transmission protocols are categorized into two fundamental classes based on how transmitter and receiver synchronization is maintained:
- Asynchronous Transmission
- Synchronous Transmission
1. Asynchronous Serial Transmission
In asynchronous transmission, characters are transmitted at random, irregular time intervals. The transmitter and receiver operate with independent local clock generators running at the same nominal baud rate.
Because the transmitter may remain idle for arbitrary durations between characters, synchronization is re-established on a character-by-character basis using framing bits:
- Idle State (Marking): When no data is being transmitted, the communication line is maintained continuously at logic 1 (Mark).
- Start Bit: The transmitter signals the start of a new character by driving the line to logic 0 (Space) for exactly one bit period. This falling edge triggers the receiver clock circuit.
- Data Bits: Following the start bit, 5 to 8 data bits are transmitted sequentially, with the Least Significant Bit (LSB) sent first and the Most Significant Bit (MSB) sent last.
- Optional Parity Bit: An optional parity bit (Even or Odd) is appended after the MSB for single-bit error detection.
- Stop Bits: Following the data (or parity) bit, the transmitter holds the line at logic 1 (Mark) for 1, 1.5, or 2 bit periods. The stop bit guarantees that the line returns to the idle state so that the subsequent start bit can be recognized reliably.
+-------+ +-------+-------+
Line | Idle | Start | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 |Parity | Stop | Idle |
Level | (1) | (0) | 8 Data Bits (LSB First) | (P) | (1) | (1) |
+-------+-------+---------------------------------------+-------+-------+-------+Receiver Clock Sampling (16x Baud Clock)
To ensure reliable data recovery despite minor frequency drift between transmitter and receiver local clocks, asynchronous receivers use a clock frequency that is an integer multiple (typically 16x) of the baud rate:
- The receiver detects the 1-to-0 transition marking the beginning of the Start bit.
- The receiver counts 8 clock pulses (half a bit width) to verify that the line is still LOW at the midpoint of the start bit, rejecting high-frequency noise spikes.
- The receiver then samples the line every 16 clock pulses thereafter, ensuring each subsequent data bit is sampled near its exact mathematical midpoint where the signal is cleanest and most stable.
2. Synchronous Serial Transmission
In synchronous transmission, data is transmitted as a continuous block or frame of characters without individual start or stop bits.
- Clock Synchronization: The transmitter and receiver must be strictly synchronized to the same master clock. The clock signal is either transmitted along a separate physical wire or embedded within the data stream using self-clocking line codes (such as Manchester encoding).
- Frame Structure:
- A synchronous frame begins with one or two unique synchronization characters (e.g., ASCII
SYNbyte,16H, or HDLC flag byte01111110B=7EH). - The receiver searches bit-by-bit for the
SYNpattern. Once matched, it locks byte boundaries and receives the data block. - After the sync characters, a contiguous stream of hundreds or thousands of data bytes is transmitted without gaps.
- The frame concludes with an error-checking block, typically a 16-bit or 32-bit Cyclic Redundancy Check (CRC).
- A synchronous frame begins with one or two unique synchronization characters (e.g., ASCII
| Aspect | Asynchronous Transmission | Synchronous Transmission |
|---|---|---|
| Clock Synchronization | Independent local clocks; resynchronized per character by Start bit | Shared common clock or clock recovered from data stream |
| Data Framing | Individual characters framed by 1 start bit and 1–2 stop bits | Large blocks of data preceded by SYN sync characters |
| Timing Between Bytes | Irregular and variable; idle marking line between characters | Continuous, contiguous transmission without inter-character gaps |
| Transmission Efficiency | Lower efficiency: 20% to 30% framing overhead per character | High efficiency: typically > 98% (minimal frame header/trailer) |
| Hardware Complexity | Simple transmitter/receiver UART hardware | Complex USART hardware, clock recovery PLLs, and buffer memory |
| Common Uses | Keyboard interfaces, serial debug consoles, PC COM ports, modems | High-speed LANs, WANs, telecommunications, SPI, I2C, USB |
4.4.2 Serial interface standards: RS232, USB
RS-232C (EIA-232) Serial Standard
The RS-232C standard (formulated by the Electronic Industries Association) specifies electrical characteristics, signal timings, pin functions, and mechanical connectors for serial binary data exchange between Data Terminal Equipment (DTE) (e.g., a computer terminal) and Data Communication Equipment (DCE) (e.g., a modem).
Electrical Characteristics and Voltage Levels
Unlike TTL logic (0V for logic 0, +5V for logic 1), RS-232 uses a bipolar, inverted voltage convention to improve noise immunity:
- Logic 0 (Space / Active ON): Between +3V and +15V (nominally +12V).
- Logic 1 (Mark / Idle OFF): Between -3V and -15V (nominally -12V).
- Dead / Undefined Zone: Between -3V and +3V.
Voltage (V)
+15V +---------------------------------------------+
| | Logic 0 (Space / ON)
+3V +---------------------------------------------+
0V ----------------- Dead Zone ------------------- (Signals in -3V to +3V
-3V +---------------------------------------------+ are invalid)
| | Logic 1 (Mark / OFF)
-15V +---------------------------------------------+Voltage Level Translation with MAX232
Because microprocessors and UARTs operate strictly with TTL/CMOS voltage levels (0V and +5V), an interface IC is required to translate signals to and from RS-232 levels.
The Maxim MAX232 is the standard single-supply level converter:
- It operates from a single +5V DC power supply.
- It uses internal dual charge-pump voltage converters and four external 0.1 uF capacitors to generate onboard +/-10V rails.
- It contains two TTL-to-RS232 drivers (converting 0V/+5V into +10V/-10V) and two RS232-to-TTL receivers (converting +/-12V into +5V/0V) with built-in hysteresis.
DB-9 Pin Configuration
The modern RS-232 standard uses a 9-pin D-subminiature (DB-9) connector:
| Pin | Signal | Signal Name | Direction (DTE) | Functional Description |
|---|---|---|---|---|
| 1 | DCD | Data Carrier Detect | Input | DCE informs DTE that a valid carrier signal is detected |
| 2 | RXD | Receive Data | Input | Serial data received from DCE/peripheral |
| 3 | TXD | Transmit Data | Output | Serial data transmitted from DTE |
| 4 | DTR | Data Terminal Ready | Output | DTE informs DCE that it is powered on and ready |
| 5 | GND | Signal Ground | Common | Common reference ground for all signal lines |
| 6 | DSR | Data Set Ready | Input | DCE informs DTE that modem is powered on and idle |
| 7 | RTS | Request to Send | Output | DTE requests permission from DCE to transmit data |
| 8 | CTS | Clear to Send | Input | DCE acknowledges DTE that it is ready to accept data |
| 9 | RI | Ring Indicator | Input | DCE informs DTE that an incoming telephone ring is detected |
Null Modem Connection
When two DTE devices (e.g., two computers or a microcontroller and a PC) are connected directly without modems, a Null Modem cable is used. Transmit and receive lines, as well as handshake pairs, are cross-connected:
TXD(Pin 3) of DTE 1 is wired toRXD(Pin 2) of DTE 2.RXD(Pin 2) of DTE 1 is wired toTXD(Pin 3) of DTE 2.RTS(Pin 7) is wired toCTS(Pin 8) across devices.DTR(Pin 4) is wired toDSR(Pin 6) andDCD(Pin 1) across devices.GND(Pin 5) connects straight through.
Universal Serial Bus (USB)
The Universal Serial Bus (USB) is a high-speed, hot-pluggable, serial bus standard designed to replace legacy PC ports (RS-232, parallel printer, PS/2).
System Topology and Architecture
- Tiered-Star Topology: USB is organized as a tiered star network with a single Host Controller at the root. Up to 127 physical devices (including multi-port USB hubs) can connect in up to 7 tiers.
- Master-Slave Architecture: All communication is initiated strictly by the host controller. Devices respond only when addressed by the host; there is no peer-to-peer communication on standard USB.
- Hot-Plugging and Dynamic Enumeration: When a device is attached, the host detects the voltage change, assigns a unique 7-bit bus address, reads the device descriptors, and loads the appropriate software driver automatically.
USB Physical Interface and Differential Signaling
Standard USB 2.0 uses a 4-conductor shielded cable:
- Pin 1 (VBUS): +5V DC power supply (provides up to 500 mA on standard ports).
- Pin 2 (D-): Differential data minus line.
- Pin 3 (D+): Differential data plus line.
- Pin 4 (GND): Power and signal ground.
USB transmits data using differential signaling across the twisted pair D+ and D-:
- A logic state is determined by the voltage difference
V(D+) - V(D-)rather than reference to ground. - Common-mode electromagnetic noise induced on both lines cancels out at the receiver differential amplifier, enabling high-speed transmission over low-cost cables.
- Line coding uses NRZI (Non-Return-to-Zero Inverted) with bit stuffing (inserting a dummy 0 after six consecutive 1s) to guarantee frequent signal transitions for clock recovery.
| USB Specification | Marketing Name | Raw Data Rate | Primary Target Devices |
|---|---|---|---|
| USB 1.0 | Low Speed | 1.5 Mbps | Keyboards, mice, gamepads |
| USB 1.1 | Full Speed | 12 Mbps | Audio devices, low-speed printers |
| USB 2.0 | High Speed | 480 Mbps | Flash drives, webcams, hard drives |
| USB 3.0 / 3.1 Gen 1 | SuperSpeed | 5 Gbps | External SSDs, high-resolution video |
| USB 3.2 Gen 2x2 | SuperSpeed 20Gbps | 20 Gbps | Ultra-fast NVMe enclosures |
| USB4 | USB4 40Gbps | 40 Gbps | Multi-protocol PCIe and display tunneling |
Four USB Data Transfer Types
- Control Transfers: Bidirectional transfers used for device enumeration, configuration, and command/status messaging. Guaranteed delivery with hardware error recovery.
- Interrupt Transfers: Periodic, low-latency, small-payload transfers polled at guaranteed time intervals by the host (e.g., keyboard keystrokes, mouse coordinates).
- Bulk Transfers: Large-volume, non-periodic data transfers that use all remaining unallocated bus bandwidth. Guaranteed error-free delivery via CRC checks and automatic retransmission (used in flash drives, external storage, printers).
- Isochronous Transfers: Periodic, guaranteed-bandwidth real-time streams with fixed latency. Designed for streaming audio and video where timely delivery is critical, but dropped packets are tolerated without retransmission.
4.4.3 Introduction to USART
A USART (Universal Synchronous/Asynchronous Receiver/Transmitter) is a programmable peripheral interface chip that bridges the parallel data bus of a microprocessor and an external serial communication channel.
It handles parallel-to-serial conversion on transmit, serial-to-parallel conversion on receive, parity generation and checking, and framing/synchronization insertion and detection.
Intel 8251A USART Architecture
The Intel 8251A is a standard 28-pin programmable communication interface designed for 8085/8086 microprocessors.
+-----------------------------+
| INTEL 8251A USART |
| |
D7–D0 <======>| Data Bus Buffer |
+-----------------------------+
||
+-----------------------------+
CS_bar ---->| Read / Write & |
C/D_bar ---->| Control Logic |
RD_bar ---->| |
WR_bar ---->| |
RESET ---->| |
CLK ---->| |
+-----------------------------+
||
+-----------------------------+
| Modem Control Logic |
| DTR_bar, DSR_bar, |
| RTS_bar, CTS_bar |
+-----------------------------+
||
+------------------------+------------------------+
| |
+-------v---------------------+ +---------------v-------------+
| Transmit Buffer Register | | Receiver Buffer Register |
| Transmit Shift Register | | Receiver Shift Register |
| TXD (Serial Output) | | RXD (Serial Input) |
| TXRDY (Buffer Empty) | | RXRDY (Char Ready) |
| TXEMPTY (Shift Reg Empty) | | SYNDET / BRKDET |
| TXC_bar (Transmit Clock) | | RXC_bar (Receive Clock) |
+-----------------------------+ +-----------------------------+Main Functional Sections of 8251A
- Data Bus Buffer: Bidirectional 8-bit tri-state buffer that interfaces with the CPU data bus D7–D0. It passes data characters, control/mode words, and status bytes.
- Read/Write and Control Logic:
CS_bar: Active LOW Chip Select.C/D_bar(Control/Data):- When
C/D_bar = 0: Accesses the internal Data Buffer (Read RX data or Write TX data). - When
C/D_bar = 1: Accesses the Control Register (Write Mode/Command Word) or Status Register (Read Status).
- When
RD_bar: Active LOW read strobe.WR_bar: Active LOW write strobe.RESET: Active HIGH system reset.CLK: System clock input (used for internal timing, typically 2–3 MHz).
- Transmitter Section:
- Transmit Buffer: Latches parallel bytes written by the CPU.
- Transmit Shift Register: Converts the byte into serial format, prepends start bit, appends parity and stop bits, and shifts it out onto the
TXDpin. TXRDY: Output pin and status bit; goes HIGH when the Transmit Buffer is empty and ready to accept the next character from CPU.TXEMPTY: Goes HIGH when both the buffer and shift register are empty.TXC_bar: Transmitter Clock input; determines the baud rate.
- Receiver Section:
RXD: Serial data input pin.- Receiver Shift Register: Receives bits serially from RXD, strips start/stop bits, checks parity, and converts bits into a parallel byte.
- Receiver Buffer: Holds the assembled character for the CPU.
RXRDY: Output pin and status bit; goes HIGH when a complete character has been assembled and is waiting to be read by the CPU.RXC_bar: Receiver Clock input.
- Modem Control Section: Provides basic hardware handshaking lines:
DTR_bar(output),RTS_bar(output),DSR_bar(input), andCTS_bar(input). Note that transmitter shifting onTXDis inhibited unlessCTS_baris asserted LOW.
Programming the 8251A
Following a hardware or software reset, the 8251A expects a sequence of control words written to the control port (C/D_bar = 1, WR_bar = 0):
- Mode Instruction Word: Written first after reset. Sets transmission mode (asynchronous vs synchronous), baud rate factor, character length, parity, and stop bit count.
- Command Instruction Word: Written after the Mode word to control runtime operations (enable transmitter, enable receiver, reset error flags, assert DTR/RTS).
Mode Word Format for Asynchronous Mode
+----+----+----+----+----+----+----+----+
| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+----+----+----+----+----+----+----+----+
\_____/ | | \_____/ \_____/
Stop | | Character Baud Rate
Bits | | Length Factor
| +------------------------> Parity Enable: 1=Enable, 0=Disable
+-----------------------------> Parity Type: 1=Even, 0=Odd- Baud Rate Factor (D1, D0):
0 0: Synchronous Mode0 1: Asynchronous 1x clock1 0: Asynchronous 16x clock (standard)1 1: Asynchronous 64x clock
- Character Length (D3, D2):
0 0: 5 bits,0 1: 6 bits,1 0: 7 bits,1 1: 8 bits
- Stop Bits (D7, D6):
0 1: 1 stop bit,1 0: 1.5 stop bits,1 1: 2 stop bits
Command Word Format
+----+----+----+----+----+----+----+----+
| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
+----+----+----+----+----+----+----+----+
| | | | | | | |
| | | | | | | +---> TxEN: 1=Transmitter Enable, 0=Disable
| | | | | | +--------> DTR: 1=Force DTR_bar LOW
| | | | | +-------------> RxEN: 1=Receiver Enable, 0=Disable
| | | | +------------------> SBRK: 1=Send Break Character
| | | +-----------------------> ER: 1=Reset Error Flags (PE, OE, FE)
| | +----------------------------> RTS: 1=Force RTS_bar LOW
| +---------------------------------> IR: 1=Internal Reset (Returns to Mode)
+--------------------------------------> EH: 1=Enter Hunt Mode (Sync mode only)Worked Examples
Asynchronous Serial Transmission Time and Throughput Calculation
An asynchronous serial transmission system operates at a baud rate of 9600 baud. Each character frame is formatted with:
- 1 Start bit
- 8 Data bits
- 1 Even Parity bit
- 1 Stop bit
Calculate:
- The total number of bits per character frame.
- The time duration required to transmit one individual character in milliseconds.
- The total transmission time required to transfer a contiguous text file containing 1200 ASCII characters.
- The percentage transmission overhead of the framing bits.
Calculate Total Bits per Character Frame: Total frame bits: Total Bits = Start Bit + Data Bits + Parity Bit + Stop Bits Total Bits = 1 + 8 + 1 + 1 = 11 bits
Calculate Time to Transmit One Character: At 9600 baud with binary signaling, 1 bit duration is: T_bit = 1 / 9600 s = 104.167 microseconds
Time per 11-bit character frame: T_char = 11 x (1 / 9600) s = 11 / 9600 s = 1.146 ms
Calculate Total Transmission Time for 1200 Characters: T_total = 1200 x T_char = 1200 x (11 / 9600) s = 13200 / 9600 s = 1.375 seconds
Calculate Percentage Overhead: Out of 11 transmitted bits, only 8 bits represent actual payload data. Framing bits = 3 (1 start + 1 parity + 1 stop). Overhead Percentage = (3 / 11) x 100% = 27.27% Efficiency = (8 / 11) x 100% = 72.73%.
- Total frame = 11 bits.
- Time per character = 1.146 ms.
- Total transmission time for 1200 characters = 1.375 seconds.
- Framing overhead = 27.27% (efficiency = 72.73%).
Intel 8251A Mode and Command Word Construction
An Intel 8251A USART is interfaced to an 8085 system to establish asynchronous communication with a serial terminal. The operational specifications are:
- Asynchronous mode with 16x baud rate clock factor
- 8-bit character data length
- Even parity enabled
- 1 stop bit
- Transmitter enabled (
TxEN = 1) - Receiver enabled (
RxEN = 1) - Error flags reset (
ER = 1) - Control pins
DTR_barandRTS_barasserted LOW (DTR = 1,RTS = 1)
Derive the binary and hexadecimal values for:
- The Mode Instruction Word.
- The Command Instruction Word.
Formulate the Mode Instruction Word (Asynchronous): Bit allocation:
D1, D0(Baud rate factor):1 0for 16x clock factorD3, D2(Character length):1 1for 8-bit characterD4(Parity enable):1for parity enabledD5(Parity type):1for Even parityD7, D6(Stop bits):0 1for 1 stop bit
Assembled byte: D7 D6 D5 D4 D3 D2 D1 D0 = 0 1 1 1 1 1 1 0 B = 7EH
Formulate the Command Instruction Word: Bit allocation:
D0(TxEN):1(Transmitter Enable)D1(DTR):1(Force DTR_bar LOW)D2(RxEN):1(Receiver Enable)D3(SBRK):0(Normal operation, do not send break)D4(ER):1(Reset error flags: PE, OE, FE)D5(RTS):1(Force RTS_bar LOW)D6(IR):0(Normal operation, not internal reset)D7(EH):0(Hunt mode disabled)
Assembled byte: D7 D6 D5 D4 D3 D2 D1 D0 = 0 0 1 1 0 1 1 1 B = 37H
Mode Word = 7EH (01111110B). Command Word = 37H (00110111B).
Serial Character Transmission Program Using 8251A
An Intel 8251A USART is mapped in an 8085 system with:
- Data Port = 10H (
C/D_bar = 0) - Control/Status Port = 11H (
C/D_bar = 1)
Assuming the 8251A has already been initialized, write an 8085 assembly program to transmit the ASCII character 'A' (hex 41H) through the USART. The program must poll the Status register, wait until the Transmitter Buffer is ready (TXRDY = 1), and then write the character to the Data Port.
Analyze 8251A Status Register: When the CPU reads the Status Port (address 11H with C/D_bar = 1 and RD_bar = 0), the byte returned contains:
- Bit 0 (
TXRDY): Transmitter Ready. 1 = Transmit buffer empty and ready for a character; 0 = Busy. - Bit 1 (
RXRDY): Receiver Ready. - Bit 2 (
TXEMPTY): Transmitter Shift Register completely empty. - Bit 3 (
PE): Parity Error. - Bit 4 (
OE): Overrun Error. - Bit 5 (
FE): Framing Error.
To test bit 0, the CPU reads Port 11H and masks with 01H using ANI 01H. If the result is zero (JZ), the buffer is still busy.
Assembly Language Program:
ORG 2000H
WAIT_TX:
IN 11H
ANI 01H
JZ WAIT_TX
MVI A,41H
OUT 10H
HLTInstruction Trace and Register States:
IN 11H: Reads Status register. Assume status is 01H (Bit 0TXRDY = 1).ANI 01H: Accumulator = 01H;Z = 0,S = 0,P = 0(one 1-bit),CY = 0, andAC = 1(ANIalways sets AC on the 8085).JZ WAIT_TX: Branch not taken because Z = 0.MVI A,41H: Loads ASCII 'A' (41H) into Accumulator.
OUT 10H: Writes 41H into 8251A Data Buffer (port 10H). Cycles: OF (4T), MR (3T), IOW (3T) = 10 T-states.
The program continuously reads Status Port 11H, checks bit 0 (TXRDY) via ANI 01H, and loops until TXRDY becomes 1. Once ready, it loads 41H ('A') and outputs it to Data Port 10H.
Exercises
Exercises
Compare synchronous and asynchronous serial transmission across six key technical criteria: clock synchronization, framing structure, transmission efficiency, transmission distance/speed, error detection methods, and typical applications.
Comparison Table:
| Criteria | Asynchronous Transmission | Synchronous Transmission |
|---|---|---|
| 1. Clock Synchronization | Transmitter and receiver run independent local clocks; synchronized per character on the falling edge of the Start bit | Common clock source shared between transmitter and receiver, or recovered from data via DPLL/Manchester encoding |
| 2. Framing Structure | Each character is individually framed by 1 start bit, 5–8 data bits, optional parity, and 1–2 stop bits | Contiguous blocks of hundreds of bytes preceded by 1–2 SYN sync bytes and terminated with a CRC checksum |
| 3. Transmission Efficiency | Lower efficiency (typically 70% to 80%) due to 2 to 3 non-data framing bits per 8-bit character | Very high efficiency (> 98%) because frame header and trailer overhead is amortized across hundreds of bytes |
| 4. Transmission Speed | Typically lower speeds (up to 115.2 kbps for standard RS-232) | High speeds (megabits to gigabits per second, e.g., Ethernet, SPI, USB) |
| 5. Error Detection | Single parity bit (Even or Odd) per character; checks for framing and overrun errors | 16-bit or 32-bit Cyclic Redundancy Check (CRC) covering the entire data block |
| 6. Typical Applications | Microcontroller serial consoles, PC COM ports, modems, GPS NMEA streams | Telecommunication backbones, LAN/WAN networks, high-speed peripheral links |
Asynchronous transmission uses independent clocks and per-character start/stop framing (70–80% efficiency, simple hardware). Synchronous transmission uses a shared/embedded clock and block-level SYN characters (> 98% efficiency, high data rates, CRC checks).
Explain the RS-232C serial communication standard. What are its electrical voltage specifications for logic 1 and logic 0? Why is the MAX232 level converter IC required when connecting an 8085 microprocessor system to an RS-232 port, and how does it generate +/-10V from a single +5V supply?
RS-232C Electrical Specifications: RS-232C uses a bipolar, inverted logic convention:
- Logic 0 (Space / Active ON): +3V to +15V (nominally +12V).
- Logic 1 (Mark / Idle OFF): -3V to -15V (nominally -12V).
- Dead Zone: -3V to +3V (signals in this region are treated as invalid/noise).
Why MAX232 is Required: Microprocessors (8085) and UARTs (8251A) operate exclusively on TTL/CMOS voltage levels (0V for logic 0, +5V for logic 1). Connecting a +12V / -12V RS-232 signal directly to a TTL pin would permanently destroy the microprocessor. Conversely, a 0V/+5V TTL output cannot drive an RS-232 receiver, which requires negative voltage for logic 1.
The MAX232 IC acts as a bidirectional level translator:
- It converts 0V/+5V TTL signals into +/-10V RS-232 levels on the transmit path (drivers).
- It converts +/-12V RS-232 levels into clean 0V/+5V TTL levels with hysteresis on the receive path (receivers).
Dual Charge-Pump Operation from Single +5V Supply: The MAX232 incorporates two on-chip capacitive voltage charge pumps:
- Voltage Doubler (+5V to +10V): Uses two external 0.1 uF capacitors to charge from the +5V Vcc supply and stack the voltage, producing approximately +10V.
- Voltage Inverter (+10V to -10V): Uses a second pair of external 0.1 uF capacitors to invert the +10V rail, generating -10V.
Thus, the MAX232 generates the necessary +/-10V bipolar rails from a standard single +5V DC supply without requiring an external dual-rail power supply.
RS-232 uses -3V to -15V for logic 1 and +3V to +15V for logic 0. The MAX232 is required to prevent damage and convert between 0V/+5V TTL and +/-10V RS-232 levels. It uses internal dual charge pumps with external 0.1 uF capacitors to double and invert +5V into +/-10V.
Describe the architecture of the Universal Serial Bus (USB). Explain the four physical wires, the concept of differential signaling on D+ and D-, and summarize the four USB transfer types (Control, Interrupt, Bulk, and Isochronous).
USB Architecture and Topology: USB is a tiered-star network managed by a single Host Controller. Up to 127 devices connect in up to 7 tiers through USB hubs. All transfers are host-initiated.
Physical Wiring and Differential Signaling: Standard USB 2.0 uses four wires:
VBUS: +5V power supply (up to 500 mA).D-: Differential data minus.D+: Differential data plus.GND: Ground reference.
Differential Signaling Principle: Instead of measuring a signal relative to ground, the receiver measures the voltage difference V(D+) - V(D-):
- Logic state depends solely on the sign of the difference.
- External electromagnetic interference affects both closely twisted wires identically (common-mode noise). When the receiver computes
V(D+) - V(D-), the common noise cancels out completely. This enables USB to achieve 480 Mbps (USB 2.0) with high signal integrity.
Four USB Transfer Types:
- Control Transfer: Bidirectional transfer used for device enumeration, descriptor queries, and configuration. Guaranteed delivery with CRC and ACK.
- Interrupt Transfer: Small-payload, periodic polling with bounded latency (guaranteed service interval) for time-critical human-interface devices (keyboards, mice, joysticks).
- Bulk Transfer: High-volume data transfers using all unallocated bandwidth with guaranteed error-free delivery via automatic retransmission (flash drives, external hard disks, printers).
- Isochronous Transfer: Guaranteed bandwidth with fixed real-time latency for continuous audio/video streaming. Timeliness is prioritized over accuracy; errors are ignored without retransmission.
USB uses a tiered-star host-managed topology. Its 4 wires are VBUS (+5V), D+, D-, and GND. Differential signaling on D+/D- cancels common-mode noise. The four transfer types are: Control (configuration), Interrupt (low-latency polling), Bulk (error-free large data), and Isochronous (real-time streaming without retries).
Explain the internal block diagram and working of the Intel 8251A USART. Describe the functions of the pins C/D_bar, TXRDY, TXEMPTY, RXRDY, and CTS_bar.
Internal Architecture of 8251A: The Intel 8251A consists of:
- Data Bus Buffer: 8-bit bidirectional tri-state buffer connecting internal buses to CPU data bus D7–D0.
- Read/Write and Control Logic: Decodes CPU bus signals (
CS_bar,C/D_bar,RD_bar,WR_bar,RESET,CLK). - Transmitter Section: Contains a Transmit Buffer and a Transmit Shift Register that converts parallel bytes into serial bit streams with start, parity, and stop bits on pin
TXD. - Receiver Section: Contains a Receiver Shift Register and a Receiver Buffer that detects the start bit, shifts in serial data on
RXD, verifies parity, strips framing bits, and delivers parallel bytes to the CPU. - Modem Control Logic: Interfaces handshaking lines
DTR_bar,DSR_bar,RTS_bar,CTS_bar.
Functions of Specified Pins:
C/D_bar(Control/Data): When HIGH, the CPU accesses the Control Register (write) or Status Register (read). When LOW, the CPU accesses the Data Buffer (read RX data or write TX data).TXRDY(Transmitter Ready): Active HIGH output pin and status bit; asserts when the internal Transmit Buffer is empty and ready to accept the next character from the CPU.TXEMPTY(Transmitter Empty): Active HIGH output pin and status bit; asserts when both the Transmit Buffer and the Transmit Shift Register are empty (transmission finished).RXRDY(Receiver Ready): Active HIGH output pin and status bit; asserts when a complete character has been assembled in the Receiver Buffer and is ready to be read by the CPU.CTS_bar(Clear to Send): Active LOW input from modem/peripheral. If CTS_bar is HIGH, the 8251A transmitter is inhibited from shifting data out onto TXD.
The 8251A USART contains a Data Bus Buffer, Read/Write Logic, Transmitter, Receiver, and Modem Control. C/D_bar selects control vs data; TXRDY indicates transmit buffer empty; TXEMPTY indicates both buffer and shift register empty; RXRDY indicates character ready to read; CTS_bar enables serial transmission.
A serial asynchronous communication link operates at 19,200 baud. The frame format consists of 1 start bit, 7 data bits, 1 odd parity bit, and 2 stop bits.
- Calculate the total number of bits per character frame.
- Determine the maximum character transmission rate (characters per second).
- Calculate the exact time required to transmit a 50 KB data file (where 1 KB = 1024 bytes) across this link.
Calculate Frame Length: Total bits per frame: Bits per Frame = Start + Data + Parity + Stop Bits per Frame = 1 + 7 + 1 + 2 = 11 bits
Calculate Character Transmission Rate: At 19,200 baud (19,200 bits per second) with 11 bits per character: Character Rate = Baud Rate / Bits per Character = 19200 / 11 = 1745.45 characters/second
Calculate Time to Transmit a 50 KB File: Total characters in 50 KB file: Total Bytes = 50 x 1024 = 51,200 bytes
Total bits to transmit: Total Bits = 51,200 x 11 = 563,200 bits
Total transmission time: T = 563200 bits / 19200 bits/second = 88 / 3 seconds = 29.33 seconds
- Frame length = 11 bits.
- Character transmission rate = 1745.45 characters/second.
- Total transmission time for 50 KB = 29.33 seconds (88/3 s).