When data travels between devices, corruption can happen due to noise, interference, timing errors, or synchronization issues.
That’s why error detection and handling is a core feature of almost ALL communication protocols.

This part explains how protocols detect, report, and recover from errors, using clear examples and ASCII diagrams.


1. Why Errors Happen in Communication

Common causes:

  • Electrical noise in wires
  • Crosstalk between signals
  • Clock mismatch
  • Packet collision
  • Signal attenuation (long distance)
  • EMI (Electromagnetic Interference)
  • Buffer overflow in receivers

2. Types of Errors

Error TypeDescriptionExample
Single-bit errorOnly 1 bit flips1010 → 1000
Burst errorMultiple consecutive bits corrupted1010110 → 1110100
Packet lossEntire packet missingNo data received
Out-of-orderPackets received in wrong order1,3,2,4
Duplicate packetsSame data repeated2,2,3,4

3. Common Error Detection Techniques

3.1 Parity Bit (Simple, used in UART, RAM)

Adds 1 extra bit to make total number of 1s either EVEN or ODD.

Example (Even parity):

Data:  1010  -> 2 ones (even) -> Parity = 0<br>Sent:  10100<br>

Pros: Simple
Cons: Detects only single-bit errors


3.2 Checksum (Used in IP, TCP, UDP)

Adds all bytes and keeps the sum.

Example:

  0x10
+ 0x22
------
  0x32  -> checksum sent

Receiver:

  • Calculates again
  • Compares with checksum

Pros: Can detect some burst errors
Cons: Not very strong compared to CRC


3.3 CRC (Cyclic Redundancy Check) – Used in Ethernet, USB, PCIe

Most powerful and widely used.

Treats data as a polynomial, divides by a generator polynomial, and sends the remainder.

ASCII Representation:

[Data Bits] / [Generator Polynomial] = Remainder (CRC)

Pros: Detects burst errors up to 32 bits (CRC-32)
Cons: Requires more hardware/software logic


4. Error detection and Handling Approaches

ApproachWhat Happens
Error Detection onlyReceiver discards data
Error Correction (FEC)Receiver fixes data using math (e.g., Hamming code)
Retransmission (ARQ)Receiver requests sender to re-send

5. Automatic Repeat Request (ARQ)

Used in TCP, Wi-Fi, LTE, etc.

5.1 Stop-and-Wait ARQ

Sender --> Frame 1 --> Receiver
Sender <-- ACK 1 ---- Receiver

Simple but slow (waits every time)


5.2 Go-Back-N ARQ

Sends multiple frames without waiting but if one fails, go back and resend all after that frame.

1 2 3 X 5
      ^
   error at 4
Resend: 4,5

5.3 Selective Repeat ARQ

Only resend the corrupted frame.
Most efficient but complex.

1 2 3 X 5
      ^
   error at 4
Resend: 4 only

6. ACK and NACK Mechanism

TermMeaning
ACKAcknowledged – OK
NACKNot Acknowledged – Something went wrong

Some protocols don’t use NACK — only timeouts.


7. Timeouts and Retries

If no ACK within time, the sender retransmits.

Sender: Frame 1
(wait...)
No ACK
Resend Frame 1

8. Sequence Numbers (Important!)

Used to:

  • Detect lost packets
  • Prevent duplicates
  • Maintain order

Example:

Frame 1 → ACK 1
Frame 2 → ACK 2

If ACK doesn’t match, something went wrong.


9. Flow Control vs Error Control

TermPurpose
Flow ControlPrevents overwhelming receiver (speed matching)
Error ControlHandles data corruption or loss

Often both exist in protocols (e.g., TCP).


10. Where These Techniques Are Used (Real Protocol Examples)

ProtocolError Technique
UARTParity
EthernetCRC
USBCRC + Retries
SPIUsually none (assumes perfect wires)
I2CACK/NACK
PCIeCRC + Retry
TCP/IPChecksum + Sequence + ACK + Retransmission
Satellite/5GFEC + ARQ (Hybrid)

11. ASCII Summary Table

+------------------+-------------------+----------------------+
| Layer             | Error Technique   | Action               |
+------------------+-------------------+----------------------+
| Physical          | None/Parity       | Hardware fix         |
| Data Link (Ethernet)| CRC + Retry    | Frame resend         |
| Network (IP)      | Checksum only     | Drop packet          |
| Transport (TCP)   | Checksum + ARQ    | Retransmit, reorder  |
| Application       | App-specific      | Retry or notify user |
+------------------+-------------------+----------------------+

Scroll to Top