Elective Data Communication

Data CommunicationUnit 47 min read

Synchronous vs Asynchronous Communication: Timing, Framing & Efficiency

Unit 4 of Data Communication explores how data is transmitted in real-time (synchronous) versus self-timed (asynchronous) methods, covering clocking mechanisms, framing techniques, and their trade-offs in modern networks like eSewa payments or Pathao ride queues.

TAKEAWAYS:

  • Synchronous communication uses a shared clock signal to align sender/receiver timing, while asynchronous uses start/stop bits for self-timing.
  • Synchronous achieves higher throughput (e.g., 100 Mbps Ethernet) but requires precise clock synchronization; asynchronous is simpler but slower (e.g., UART).
  • Framing techniques (bit stuffing, flags) distinguish data from control signals in both methods.
  • Real-world examples: Khalti’s payment API (synchronous HTTP requests), WhatsApp messages (asynchronous framing with escape sequences).
  • Errors in timing (skew, drift) and framing (bit stuffing overflow) are critical failure points.
  • Exam focus: Compare bit rates, clocking methods, and error handling in both modes.

1. Core Concepts: Clocking and Timing

1.1 Asynchronous Communication: Self-Timed Framing

Asynchronous (or start-stop) communication transmits data without a shared clock. Each character (or byte) is framed with:

  • Start bit (0): Signals the receiver to prepare.
  • Data bits (5–8, LSB first): The actual payload.
  • Parity bit (optional): Simple error detection.
  • Stop bit(s) (1): Marks the end of the frame.
stateDiagram-v2
    [*] --> Idle
    Idle --> StartBit: "Start bit (0)"
    StartBit --> DataBits: "5–8 data bits"
    DataBits --> ParityBit: "Optional parity"
    ParityBit --> StopBit: "1 or 2 stop bits"
    StopBit --> Idle: "Back to idle"

Why it works:

  • The receiver samples the line mid-bit (after the start bit) and counts bits to reconstruct timing.
  • No clock synchronization needed between devices.

1.2 Synchronous Communication: Shared Clock

Synchronous communication uses a common clock signal to align sender/receiver bit streams. Key features:

  • No start/stop bits: Overhead is lower for bulk data.
  • Clock signal (separate wire or embedded in data, e.g., Manchester encoding).
  • Framing bits (e.g., flags, sync words) to delimit messages.

Clocking Methods:

Method Description Example
Separate clock Dedicated wire carries clock pulses. Old RS-232 with DTR/DSR lines.
Embedded clock Clock encoded in data (e.g., Manchester, NRZI). Ethernet, USB.
Derived clock Receiver recovers clock from data transitions (e.g., PLL circuits). Modern serial ports (UART).

2. Framing Techniques: Separating Data from Control

Both methods need to distinguish data from control signals (e.g., flags, errors). Common techniques:

2.1 Asynchronous: Start/Stop Bits

  • Pros: Simple, no clock sync needed.
  • Cons: Overhead (10–20% for 8N1 framing), slow for high-speed links.

Worked Example: UART Transmission Scenario: Sending 'A' (ASCII 65, 01000001) with 8N1 (8 data, no parity, 1 stop bit).

  1. Start bit: 0
  2. Data: 01000001
  3. Stop bit: 1 Total bits: 10 (1 start + 8 data + 1 stop). Bit rate: 9600 baud → 960 characters/sec (9600/10).

2.2 Synchronous: Bit Stuffing and Flags

Synchronous links use flags (e.g., 01111110) to mark frame boundaries. To avoid false flags in data:

  • Bit stuffing: Insert a 0 after every 5 consecutive 1s in the data.
  • Flag escape: Use 011111100 to transmit a literal 01111110.
sequenceDiagram
    Sender->>Receiver: Flag (01111110)
    Sender->>Receiver: Data (e.g., 11111011111110)
    Note over Sender,Receiver: Sender inserts 0 after 5th 1: 11111011111010
    Sender->>Receiver: Flag (01111110)

3. Real-World Applications

3.1 Asynchronous in Everyday Life

  • eSewa Payments:

    • When you scan a QR code, your phone sends payment details via UART (asynchronous) to the merchant’s POS terminal.
    • Why? Low-cost, simple hardware (no clock sync needed).
    • Bit rate: Typically 9600–115200 baud (slow but reliable for short transactions).
  • WhatsApp Messages:

    • Your phone buffers messages and sends them asynchronously over the cellular network (TCP/IP, but lower layers may use async framing for control signals).
    • Escape sequences handle special characters (e.g., 0x10 for flags).

3.2 Synchronous in High-Speed Networks

  • Pathao Ride Allocation:

    • When you request a ride, Pathao’s server processes thousands of requests synchronously using HTTP/2 (multiplexed streams with shared clock timing).
    • Why? Low latency for real-time matching.
  • NTC’s Fiber-Optic Backbone:

    • Nepal’s national fiber network uses synchronous optical networking (SONET) for 10Gbps+ links.
    • Clock recovery: Optical receivers use PLLs to derive timing from incoming signals.

SONET frame structureSTS-1 frame with overhead and payload bytes (Image: Email4mobile, Public domain, via Wikimedia Commons)


4. Performance Comparison

Feature Asynchronous Synchronous
Clocking No shared clock; start/stop bits Shared clock (embedded/derived)
Overhead High (10–20% for framing) Low (flags + FCS only)
Speed Slow (max ~115 kbps for UART) Fast (Mbps–Gbps, e.g., Ethernet)
Error Handling Parity bits only CRC (e.g., HDLC, PPP)
Use Cases Low-speed devices (modems, sensors) High-speed networks (Ethernet, USB)
Example RS-232, UART Ethernet, ATM, SONET

5. Common Pitfalls and Errors

5.1 Timing Issues

  • Bit skew: Clock drift between sender/receiver causes misaligned bits.
    • Fix: Use PLLs (Phase-Locked Loops) in synchronous systems.
  • Stop-bit errors: Receiver may miss the stop bit if the line is noisy.
    • Fix: Increase stop-bit duration or use flow control (XON/XOFF).

5.2 Framing Errors

  • Bit stuffing overflow: Too many 1s cause buffer overflow.
    • Fix: Use longer stuffing sequences (e.g., 6 1s → insert 0).
  • False flags: Data accidentally matches the flag pattern.
    • Fix: Escape sequences (e.g., 011111100 for literal 01111110).

Worked Example: Bit Stuffing Overflow Scenario: Sending 1111111111111111 (16 1s) in HDLC.

  1. After 5 1s, insert a 0: 111110111110111110111110.
  2. If the sender doesn’t stuff, the receiver sees 11111110 (false flag) and drops the frame.

6. Exam Tip: How to Score Full Marks

  1. Define clearly:

    • Asynchronous: "Data transmission without a shared clock, using start/stop bits for framing."
    • Synchronous: "Data transmission with a shared clock, using flags or sync words for framing."
  2. Compare with a table (as above) and highlight trade-offs (speed vs. complexity).

  3. Worked examples:

    • For async: Calculate bit rate given baud rate (e.g., 9600 baud, 8N1 → 960 chars/sec).
    • For sync: Draw a bit-stuffing scenario (like the one above).
  4. Real-world tie-ins:

    • Mention eSewa’s UART for async or NTC’s SONET for sync.
    • Explain why Pathao uses synchronous HTTP (low latency) vs. WhatsApp’s async framing (simplicity).
  5. Error handling:

    • Async: "Parity bits detect single-bit errors but cannot correct them."
    • Sync: "CRC in HDLC provides strong error detection (e.g., 16-bit CRC covers 99.99% of errors)."

Based on the PU BE Computer (PU) syllabus for Data Communication, unit 4.

Discussion

Loading…