Computer Organization & Architecture
Unit 5: Input-Output Organization
From peripheral devices to DMA controllers โ master how computers communicate with the outside world, handle interrupts, and transfer data at blazing speed.
โฑ๏ธ 5 hrs theory + 3 hrs lab | ๐ฏ GATE ~2 marks | ๐ฅ๏ธ Aadhaar Biometric I/O
๐ผ Jobs this unlocks: Embedded Systems Engineer (โน5โ10 LPA) | Hardware Design Engineer (โน6โ12 LPA) | IoT Developer (โน4โ8 LPA)
Opening Hook โ The Fingerprint That Feeds 80 Crore Indians
๐๏ธ How Aadhaar's Fingerprint Scanner Bypasses the CPU
Walk into any Indian ration shop, place your thumb on the biometric scanner, and within 2 seconds your identity is verified against a database of 1.4 billion records. But here's the engineering marvel most people miss: when that fingerprint scanner captures your print, the image data doesn't pass through the CPU.
The biometric device uses Direct Memory Access (DMA) โ a hardware technique where the scanner writes fingerprint data directly into memory, bypassing the CPU entirely. Why? Because the CPU is too busy running the operating system, managing the display, and handling network packets. If the CPU had to personally move every byte of fingerprint image data, the verification would take 10ร longer.
This isn't just theory โ it's the I/O architecture that powers India's largest digital identity system. The same DMA principle is used in your phone (camera sensor โ memory), your laptop (SSD โ RAM), and every ATM you've ever used. This chapter teaches you exactly how all of this works.
Learning Outcomes โ Bloom's Taxonomy Mapped
| Bloom's Level | Learning Outcome |
|---|---|
| ๐ต Remember | List the three modes of data transfer (Programmed, Interrupt-driven, DMA) and define each |
| ๐ต Remember | Recall the difference between Memory-mapped I/O and Isolated (I/O-mapped) I/O |
| ๐ข Understand | Explain how DMA transfers data without CPU intervention and describe cycle stealing |
| ๐ข Understand | Describe the handshaking protocol in asynchronous data transfer with timing diagrams |
| ๐ก Apply | Calculate DMA transfer rates, bus bandwidth, and interrupt latency for given configurations |
| ๐ก Apply | Draw the UART frame format for a given character with correct start, data, parity, and stop bits |
| ๐ Analyze | Compare daisy chain vs parallel priority interrupt structures with trade-offs |
| ๐ Analyze | Analyze why certain I/O devices (keyboard vs disk) use different transfer modes |
| ๐ด Evaluate | Evaluate which data transfer mode is optimal for a given real-world I/O scenario (sensor, camera, network card) |
| ๐ด Evaluate | Assess the performance impact of DMA burst mode vs cycle stealing on CPU utilization |
| ๐ฃ Create | Design a priority interrupt system for a given set of devices with different priority levels |
| ๐ฃ Create | Design a complete I/O interface block diagram for an embedded system with multiple peripherals |
Concept Explanation โ I/O Organization from Scratch
1. Peripheral Devices
A computer processor by itself is just a number-crunching machine. It becomes useful only when it can communicate with the outside world โ keyboards, monitors, printers, scanners, network cards, and sensors. These external devices are called peripheral devices (or simply peripherals).
๐ฅ๏ธ Classification of Peripheral Devices
Input Devices: Send data INTO the computer โ Keyboard, mouse, scanner, microphone, fingerprint sensor, barcode reader, webcam
Output Devices: Receive data FROM the computer โ Monitor, printer, speaker, LED display, motor controller
Input/Output (I/O) Devices: Both send and receive โ Hard disk, SSD, USB flash drive, network card (NIC), touchscreen, modem
The fundamental challenge: peripherals operate at vastly different speeds. A keyboard generates ~10 bytes/second, a mouse ~100 bytes/second, but an NVMe SSD can deliver 7 GB/second. The CPU runs at GHz speeds. How do you connect a snail to a bullet train? That's what I/O organization solves.
Speed Hierarchy
Device Speed Analogy
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
Keyboard ~10 B/s ๐ถ Walking
Mouse ~100 B/s ๐ฒ Cycling
Printer ~100 KB/s ๐ Car
USB 2.0 ~60 MB/s ๐ Train
Gigabit Ethernet ~125 MB/s โ๏ธ Airplane
SATA SSD ~600 MB/s ๐ Rocket
NVMe SSD ~7 GB/s โก Lightning
CPU โ RAM ~50 GB/s ๐ซ Speed of Light
2. I/O Interface
Peripherals can't talk directly to the CPU โ they speak different "languages" (voltage levels, data formats, speeds). An I/O Interface acts as a translator that sits between the CPU/memory bus and the peripheral device.
Analogy: Think of a post office in a small town. The CPU is the District Collector (DC) who writes orders. The I/O Interface is the post office that receives the DC's order, translates it into the right format (Hindi to local language), and delivers it to the right person (device). The post office also handles incoming letters (data from devices) and routes them to the DC.
๐ CPU โ I/O Interface โ Device Architecture
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ โ Address Bus โ โ
โ โโโโโโโโโโโโโโโโโโโโ โ Peripheral โ
โ CPU โ Data Bus โ โโโโโโโโโโโโโโ โ Device โ
โ โโโโโโโโโโโโโโโโโโโโฌโโโถโ I/O โ โ (Printer, โ
โ โ Control Bus โ โ Interface โโโโโถ Scanner, โ
โ โโโโโโโโโโโโโโโโโโโโ โ (Port/ โ โ Disk...) โ
โ โ โ Controllerโ โ โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโ โ
โโโโโโโโโโถโ Memory โโโโโโโโโโโโโโ
โ (RAM) โ
โโโโโโโโโโโโ
Functions of I/O Interface:
โโโ Data Format Conversion (serial โ parallel)
โโโ Speed Matching (fast CPU โ slow device via buffers)
โโโ Device Selection (address decoding)
โโโ Status Monitoring (ready / busy / error flags)
โโโ Control Signal Generation (read, write, strobe)
Memory-Mapped I/O vs Isolated I/O
There are two ways the CPU can address I/O devices:
Memory-Mapped I/O
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Single Address Space โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 0x0000 โโโ RAM โ โ
โ โ ... โ โ
โ โ 0x7FFF โโโ RAM (ends) โ โ
โ โ 0x8000 โโโ Keyboard Port โ โโโ I/O addresses are
โ โ 0x8004 โโโ Display Port โ part of memory map
โ โ 0x8008 โโโ Printer Port โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ CPU uses: MOV, LOAD, STORE โ
โ Same instructions for I/O & memory โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Isolated I/O (I/O-Mapped)
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ Memory Space โ โ I/O Space โ
โ 0x0000 โโโ RAM โ โ Port 0 โ Keyboard โ
โ ... โ โ Port 1 โ Display โ
โ 0xFFFF โโโ RAM โ โ Port 2 โ Printer โ
โ โ โ โ
โ SEPARATE spaces โ โ SEPARATE spaces โ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
CPU uses: IN / OUT (special I/O instructions)
IO/Mฬ control line distinguishes the two spaces
| Feature | Memory-Mapped I/O | Isolated I/O (I/O-Mapped) |
|---|---|---|
| Address Space | Shared with memory | Separate I/O address space |
| Instructions | MOV, ADD, any ALU instruction | Special IN/OUT instructions only |
| Control Line | No special I/O line needed | IO/Mฬ line needed |
| Address Bits | Reduces available memory addresses | Full memory space preserved |
| Flexibility | Can use any instruction on I/O | Limited to IN/OUT |
| Hardware | Simpler | Needs extra decoder for I/O space |
| Used By | ARM (Raspberry Pi), MIPS, RISC-V | Intel x86 (your PC) |
| Indian Example | ARM-based Aadhaar biometric devices | Old railway booking terminals (x86) |
3. Data Transfer Modes โ How Data Moves Between CPU and Peripherals
There are three fundamental ways data can move between I/O devices and the CPU/memory. Think of them as three levels of postal service:
๐ฆ The Three Modes of Data Transfer
Mode 1 โ Programmed I/O (Polling): The CPU keeps asking the device "Are you ready?" in a loop. Like standing at the door waiting for a courier โ you do nothing else until the parcel arrives.
Mode 2 โ Interrupt-Driven I/O: The device sends a signal (interrupt) when it's ready. Like giving your phone number to the courier โ "Call me when you arrive, I'll be working on other things."
Mode 3 โ Direct Memory Access (DMA): A special hardware controller transfers data directly between device and memory, without involving the CPU at all. Like hiring a personal assistant to receive all parcels and put them in the right room โ you don't even know the delivery happened.
Programmed I/O (Polling)
CPU Device
โ โ
โโโโโ Read Status โโโโโโโโโโโถ โ
โโโโโ Status: NOT READY โโโโ โ
โ โ
โโโโโ Read Status โโโโโโโโโโโถ โ โ CPU stuck in
โโโโโ Status: NOT READY โโโโ โ busy-wait loop
โ โ (wasting time!)
โโโโโ Read Status โโโโโโโโโโโถ โ
โโโโโ Status: READY โโโโโโโโ โ โ Finally ready!
โ โ
โโโโโ Read Data โโโโโโโโโโโโโถ โ
โโโโโ Data: 0x4D โโโโโโโโโโโ โ โ Data transferred
โ โ
โผ โผ
Interrupt-Driven I/O
CPU Device
โ โ
โ โ doing other work... โ โ preparing data...
โ (executing programs) โ
โ โ
โโโโโโ INTERRUPT! โโโโโโโโโโโ โ โ Device signals CPU
โ โ
โโโโโ Save context โโโโโ โ
โ (push registers) โ โ
โ โผ โ
โโโโโ Read Data โโโโโโโโโโโโโถ โ
โโโโโ Data: 0x4D โโโโโโโโโโโ โ โ Data transferred
โ โ
โโโโโ Restore context โโโ โ
โ (pop registers) โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ resume original work โ
โผ โผ
Programmed I/O = Going to the bank counter โ you stand in line, wait your turn, hand over the cheque, wait for processing, collect receipt. You're stuck at the bank the whole time.
Interrupt I/O = Getting an emergency call during a meeting โ you're busy working, the bank calls "Your cheque is cleared!", you briefly handle it and go back to your meeting.
DMA = NEFT/RTGS transfer โ you set it up once, then the bank transfers money directly from account to account without you being involved at all. You don't even need to be awake!
| Feature | Programmed I/O | Interrupt-Driven I/O | DMA |
|---|---|---|---|
| CPU Involvement | 100% โ CPU stuck in loop | Partial โ CPU handles interrupt | Minimal โ CPU only initiates |
| CPU Efficiency | โ Very poor (busy waiting) | โ Good | โ โ Excellent |
| Speed | Slow | Medium | Fast |
| Hardware Cost | ๐ฐ Cheapest | ๐ฐ๐ฐ Moderate | ๐ฐ๐ฐ๐ฐ Expensive (DMA controller) |
| Data Path | Device โ CPU โ Memory | Device โ CPU โ Memory | Device โ Memory (bypasses CPU) |
| Best For | Slow devices (keyboard) | Medium devices (mouse, UART) | Fast devices (disk, camera, NIC) |
| GATE Favourite | Comparison questions | ISR, vector table Qs | DMA transfer time numericals |
4. Direct Memory Access (DMA) โ The Star of Unit 5
DMA is the most important topic in this unit. It appears in GATE every 2โ3 years, and understanding it deeply will help you crack both exams and interviews.
How DMA Works โ Step by Step
โก DMA Controller Block Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DMA CONTROLLER โ
โ โ
CPU โโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ Bus Request โ โ Address Reg โ โ Word Count โ โ
โ (BR/HRQ) โ โ (AR) โ โ Register โ โ
โ โ โ Starting โ โ (WC) โ โ
โ โโโโโโโโโโโโโโโถโ โ address in โ โ Number of โ โ
โ Bus Grant โ โ memory โ โ words to โ โ
โ (BG/HLDA) โ โโโโโโโโฌโโโโโโโโ โ transfer โ โ
โ โ โ โโโโโโโโฌโโโโโโโโ โ
โ โ โโโโโโโโดโโโโโโโโ โ โ
โโโ System Bus โโโโฌโโโ Control โโโโโโโโโโโ โ
โ โ โ Logic โ โ
โ โ โ (R/Wฬ, DMA โ โโโโโโโโโโโโโโโโ โ
โ โ โ Request, โ โ Data Reg โ โโโโถ I/O Device
โ โ โ DMA Ack) โโโโ (DR) โ โ
โ โ โโโโโโโโโโโโโโโโ โ Buffer for โ โ
โ โ โ data byte โ โ
โ โ โโโโโโโโโโโโโโโโ โ
โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โMโ
โEโ DMA Registers:
โMโ โโโ AR = Starting memory address
โOโ โโโ WC = Word count (decrements each transfer)
โRโ โโโ DR = Data register (holds one word in transit)
โYโ โโโ Control = Direction (Read/Write), DMA mode
โโโ
DMA Transfer Sequence
DMA Handshake
Step CPU DMA Controller Device
โโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโ
1 CPU initializes DMA:
โ Loads AR (start addr)
โ Loads WC (word count)
โ Sets direction (R/W)
โ Enables DMA
2 CPU continues its DMA waits for device Device
normal work... request... prepares data
3 Device sends DRQ โโโโโโโโโ DRQ
(DMA Request)
4 DMA sends BR โโโโโโโโโโโโโถ CPU
(Bus Request / HRQ)
5 CPU finishes current
bus cycle, then sends
BG (Bus Grant / HLDA) โโโถ DMA takes over bus
6 CPU floats its
address/data lines DMA puts address on bus
(tri-state) DMA transfers 1 word:
Device โโโโถ Memory
7 WC = WC - 1
AR = AR + 1
If WC โ 0: repeat from 3
If WC = 0: send interrupt
to CPU (transfer complete!)
8 CPU gets interrupt,
resumes normal bus
ownership
DMA Transfer Modes
| Mode | How It Works | CPU Impact | Use Case |
|---|---|---|---|
| Burst Mode | DMA holds the bus for entire block transfer | CPU blocked for duration of transfer | Disk read (large sequential block) |
| Cycle Stealing | DMA takes bus for 1 word, returns it, then takes again | CPU slowed down slightly, but not blocked | Network card, audio streaming |
| Transparent / Interleaved | DMA uses bus only when CPU is not using it | Zero CPU impact (uses idle bus cycles) | Refresh, background transfers |
Cycle Stealing โ Timing Diagram
Bus Ownership Timeline:
Time โ T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12
โโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโฌโโโโโ
Owner: โCPU โCPU โDMA โCPU โCPU โDMA โCPU โCPU โDMA โCPU โCPU โCPU โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
โโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโดโโโโโ
โ โ โ
steal steal steal
1 word 1 word 1 word
DMA "steals" one bus cycle, transfers one word,
then gives bus back. CPU barely notices the slowdown.
5. Input-Output Processor (IOP)
While DMA handles simple block transfers, complex I/O operations need a dedicated processor โ the I/O Processor (IOP), also called an I/O Channel.
Analogy: DMA is like a delivery boy who can carry packages from A to B. An IOP is like a logistics manager who can plan routes, handle returns, repackage items, manage multiple deliveries simultaneously, and make decisions without calling the CEO (CPU).
๐ IOP Architecture
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ โ CMD โ I/O Processor โ
โ CPU โโโโโโโโโโถโ (Channel) โ
โ (Main โ โ โ
โ Proc.) โ โ โโโโโโโโโโโโโโโ โ โโโโโโโโโโโโ
โ โโโโโโโโโโโ โ Channel Cmd โ โโโโโโโโถโ Device 1 โ
โ โ STATUS โ โ Word (CCW) โ โ โโโโโโโโโโโโ
โโโโโโโโโโโโ โ โโโโโโโโโโโโโโโ โ โโโโโโโโโโโโ
โ โ โโโโโโโโถโ Device 2 โ
โ โ Own registers, โ โโโโโโโโโโโโ
โโโโโโผโโโโโโ โ can execute โ โโโโโโโโโโโโ
โ Main โโโโโโโโโโถโ channel programs โโโโโโโโถโ Device 3 โ
โ Memory โ โ โ โโโโโโโโโโโโ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
Channel Command Word (CCW): The CPU sends a high-level command to the IOP (e.g., "Read 1000 records from disk into memory starting at address 0x5000"). The IOP breaks this into individual I/O operations, executes them independently, and notifies the CPU only when the entire operation is complete (or if an error occurs).
Types of I/O Channels
| Channel Type | Description | Use Case |
|---|---|---|
| Multiplexer Channel | Handles multiple slow/medium devices simultaneously by interleaving bytes | Multiple printers, card readers, terminals |
| Selector Channel | Handles one high-speed device at a time; dedicated until transfer completes | Magnetic tape, disk drive |
| Block Multiplexer Channel | Combines both: handles multiple high-speed devices by interleaving blocks | Multiple disks (mainframe environments) |
6. Priority Interrupt System
When multiple devices request CPU attention simultaneously, who goes first? The priority interrupt system decides. It's like a hospital emergency room โ a heart attack patient gets treated before someone with a headache, even if the headache patient arrived first.
Daisy Chain Priority
Daisy Chain Priority Interrupt
Priority: Highest โโโโโโโโโโโถ Lowest
โโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ โ PI โ Device 0 โ PO โ Device 1 โ PO โ Device 2 โ
โ โโโโโโถโ (Highest โโโโโโถโ (Medium โโโโโโถโ (Lowest โ
โ CPU โ โ Priority)โ โ Priority)โ โ Priority)โ
โ โ โ โ โ โ โ โ
โ โโโโโโโชโโโโโโโโโโโชโโโโโโชโโโโโโโโโโโชโโโโโโชโโโโโโโโโโโชโโโ INT Line
โ โ โ โ โ โ โ โ (common
โโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ wired-OR)
INT = Interrupt Request (active when ANY device requests)
PI = Priority In (from CPU or previous device)
PO = Priority Out (to next device)
Rule: A device can respond to the acknowledge signal
ONLY if its PI input is active (1).
If it has an interrupt pending, it blocks PO (sends 0).
Otherwise, it passes PI through as PO.
Example: If Device 1 and Device 2 both request simultaneously,
Device 1 gets serviced first (it blocks PO to Device 2).
Parallel Priority Interrupt (Hardware)
Parallel Priority โ Using Priority Encoder
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโ
โ Device 0 โโโโโโถโ โ โ โ
โ Device 1 โโโโโโถโ Priority Encoder โโโโโโถโ CPU โ
โ Device 2 โโโโโโถโ (Combinational โ โ โ
โ Device 3 โโโโโโถโ Logic Circuit) โ โ Gets โ
โ Device 4 โโโโโโถโ โโโโโโถโvectorโ
โ Device 5 โโโโโโถโ Outputs: highest โ โnumberโ
โ Device 6 โโโโโโถโ priority device ID โ โ โ
โ Device 7 โโโโโโถโ as binary code โ โ โ
โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโ
8 devices โ 3-bit output (2ยณ = 8 combinations)
ISR = Interrupt Service Routine (fetched from vector table)
Advantage: Fastest โ all devices checked in ONE clock cycle
Disadvantage: More hardware (encoder, mask register, etc.)
Software Poll
Instead of hardware priority, the CPU checks each device's status register in software, in a fixed order. The first device found with an interrupt pending gets serviced.
Assembly-style Pseudocode ; Software Polling Routine POLL: IN STATUS_DEV0 ; Read Device 0 status BNZ ISR_DEV0 ; If interrupt pending, jump to ISR IN STATUS_DEV1 ; Read Device 1 status BNZ ISR_DEV1 IN STATUS_DEV2 ; Read Device 2 status BNZ ISR_DEV2 IN STATUS_DEV3 BNZ ISR_DEV3 JMP POLL ; No device pending, keep polling
| Method | Speed | Hardware Cost | Flexibility | Best For |
|---|---|---|---|---|
| Daisy Chain | Medium | Low (just PI/PO wires) | Fixed priority | Small systems, microcontrollers |
| Parallel Priority | Fast (1 cycle) | High (encoder, mask reg) | Programmable via mask | High-performance CPUs, servers |
| Software Poll | Slow (sequential) | Minimal (no extra HW) | Fully flexible in software | Simple embedded systems |
7. Asynchronous Data Transfer โ Handshaking
In synchronous transfer, both sender and receiver are controlled by the same clock. But what if they run at different speeds? Asynchronous transfer uses a handshaking protocol โ a conversation of control signals that says "I'm sending" / "I received it" / "Send the next one."
Analogy: Think of handing a heavy box to someone. You don't just throw it โ you say "Ready?", they say "Ready!", you hand it over, they say "Got it!", then you pick up the next box. That's handshaking.
๐ค Source-Initiated Strobe Handshaking
Source (Sender) Destination (Receiver)
โ โ
โโโ places data on bus โโโโโโโโโโโโโโโถโ
โ โ
โโโ sends STROBE pulse (โ) โโโโโโโโโโถโ
โ โโโ reads data from bus
โ โโโ sends ACK (โ)
โโโโ ACK received โโโโโโโโโโโโโโโโโโโโ
โโโ removes data from bus โ
โ โโโ removes ACK (โ)
โ โ
Timing:
Data โโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ Valid Data โ
STROBE โโโโโโโโโ โโโโโโโโโโโโโโโ
โ
ACK โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโ
๐ค Full Handshaking (4-Phase)
Phase Source Destination Signals
โโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโโโโโโโ
1 Places data on bus โ DATA valid
Sets DATA_VALID = 1 โ DV โ
2 โ Reads data
โ Sets DATA_ACK = 1 DA โ
3 Sees ACK, removes data โ DV โ
Sets DATA_VALID = 0 โ
4 โ Sees DVโ DA โ
โ Sets DATA_ACK = 0
Timing Diagram:
DATA โโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโ
DATA_VALID โโโโ โโโโโโโโโโโ
DATA_ACK โโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โโโโโโโโโโโ
1 2 3 4 (phases)
8. UART โ Universal Asynchronous Receiver-Transmitter
UART is the most common serial communication protocol. Every Arduino project, GPS module, Bluetooth module (HC-05), GSM module (SIM800), and even your computer's serial port uses UART.
Analogy: Think of UART like sending a telegram. You send one letter at a time (serial), with special "start" and "stop" markers so the receiver knows when a message begins and ends. You also include a check digit (parity) so the receiver can detect errors.
๐ก UART Frame Format
UART Idle State: Line held HIGH (1)
โโโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโโโโโโฌโโโโโโโ
โ ST โ D0โ D1โ D2โ D3โ D4โ D5โ D6โ D7โ Parity โ STOP โ
โ 0 โ b โ b โ b โ b โ b โ b โ b โ b โ bit โ 1 โ
โโโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโโโโโโดโโโโโโโ
โ โ โ โ
โ โ โ โ
Start 8 Data Bits Parity Stop
Bit (LSB first) (Even/ Bit
(0) Odd) (1)
Total frame = 1 + 8 + 1 + 1 = 11 bits per character
Example: Sending ASCII 'A' (0x41 = 0100 0001) with Even Parity
โโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโฌโโโโ
โ 0 โ 1 โ 0 โ 0 โ 0 โ 0 โ 0 โ 1 โ 0 โ 0 โ 1 โ
โ S โD0 โD1 โD2 โD3 โD4 โD5 โD6 โD7 โ P โ SPโ
โโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโดโโโโ
LSB โโโโโโโโโโโโโโโโโโโโโถ MSB
D0โD7 = 1,0,0,0,0,0,1,0 (binary of 0x41, LSB first)
Parity = 0 (even parity: total 1s in data = 2, already even)
Baud Rate = bits per second
Common: 9600, 115200
At 9600 baud: 1 character = 11 bits / 9600 = 1.146 ms
| UART Parameter | Common Value | Notes |
|---|---|---|
| Baud Rate | 9600, 115200 | Bits per second (both sides must match) |
| Data Bits | 8 | 5, 6, 7, or 8 bits; 8 is standard |
| Parity | None / Even / Odd | Error detection; optional |
| Stop Bits | 1 or 2 | Marks end of frame |
| Flow Control | None / RTS-CTS | Hardware handshaking for fast transfers |
Serial.begin(9600) in Arduino, you're configuring the UART module at 9600 baud. The Serial Monitor receives UART frames, strips the start/stop/parity bits, and shows you the ASCII characters.
Learn by Doing โ 3-Tier Lab Structure
๐ข Tier 1 โ GUIDED: Simulate UART Transmission in Python
Objective:
Write a Python program that takes an ASCII character, converts it to a UART frame (Start + 8 Data + Parity + Stop), and displays the bit stream.
Step 1: Get the ASCII value
Python char = input("Enter a character: ") ascii_val = ord(char) print(f"ASCII value of '{char}' = {ascii_val} (decimal) = {bin(ascii_val)} (binary)")
Step 2: Build the UART frame
Python # Convert to 8-bit binary (LSB first for UART) data_bits = format(ascii_val, '08b')[::-1] # Reverse for LSB first # Calculate even parity ones_count = data_bits.count('1') parity = '0' if ones_count % 2 == 0 else '1' # Build frame: Start(0) + Data(8) + Parity(1) + Stop(1) frame = '0' + data_bits + parity + '1' print(f"\nUART Frame for '{char}':") print(f"Start | Data (LSBโMSB) | Parity | Stop") print(f" {frame[0]} | {frame[1:9]} | {parity} | {frame[-1]}") print(f"Complete frame: {frame} ({len(frame)} bits)")
Step 3: Calculate transmission time
Python baud = 9600 bit_time = 1 / baud # seconds per bit frame_time = len(frame) * bit_time * 1000 # milliseconds print(f"\nAt {baud} baud:") print(f"Time per bit = {bit_time*1000:.4f} ms") print(f"Time per frame = {frame_time:.4f} ms") print(f"Max characters/sec = {baud // len(frame)}")
๐ก Tier 2 โ SEMI-GUIDED: DMA Transfer Simulator in C
Your Mission:
Simulate a DMA controller in C that transfers a block of data from a "device buffer" array to a "memory" array, word by word, while counting cycles.
Hints:
- Data Structures: Create
struct DMA { int AR; int WC; int DR; int mode; } - Device Buffer:
int device_buffer[256]filled with random data - Memory:
int memory[1024]initialized to zero - Transfer Loop: On each "cycle", copy
device_buffer[i]โDMA.DRโmemory[DMA.AR], thenAR++,WC-- - Mode Switch: In burst mode, complete all transfers in one go. In cycle-stealing mode, interleave with "CPU work" prints
- Completion: When
WC == 0, print "DMA INTERRUPT: Transfer Complete!"
๐ด Tier 3 โ OPEN CHALLENGE: Priority Interrupt Controller in Verilog/VHDL
The Brief:
Design a priority interrupt controller for 8 devices using a priority encoder, interrupt mask register, and interrupt acknowledge logic. Implement in Verilog (or use Logisim for a visual approach).
- Inputs: 8 interrupt request lines (IR0โIR7)
- Outputs: 3-bit interrupt vector, INT signal to CPU
- Mask Register: 8-bit register to enable/disable individual interrupts
- Priority Logic: IR0 = highest priority, IR7 = lowest
- Acknowledge: When CPU sends INTA, latch the current vector and clear the serviced interrupt
- Test: Simulate simultaneous interrupts on IR2 and IR5 โ verify IR2 is serviced first
Practice Problems โ Diagrams, Numericals, Industry & GATE
๐ Diagram-Based Problems (D1โD3)
Draw the complete block diagram of a DMA controller showing AR, WC, DR, Control Logic, and its connections to CPU, Memory, and I/O device. Label all bus signals (BR, BG, Address Bus, Data Bus).
Draw the daisy chain priority interrupt structure for 4 devices. Show the INT (wired-OR), PI, and PO connections. Indicate which device gets priority if Device 1 and Device 3 raise interrupts simultaneously.
Draw a complete UART frame for transmitting the character 'M' (ASCII 77 = 0x4D = 01001101) with odd parity, 8 data bits, and 1 stop bit. Label each bit.
๐ข Numerical Problems (N1โN6)
A DMA controller transfers data from a disk to memory. The disk transfer rate is 2 MB/s, memory cycle time is 40 ns, and the DMA uses cycle stealing. Calculate: (a) Number of memory cycles stolen per second, (b) Percentage of memory cycles stolen if CPU also uses memory at 20 million accesses/sec.
A UART operates at 115200 baud with 8 data bits, even parity, and 1 stop bit. Calculate: (a) Time to transmit one character, (b) Maximum characters per second, (c) Effective data rate in bits/second (only data bits, not overhead).
A system has a 32-bit data bus operating at 100 MHz. DMA transfers a 1 MB file from disk. Calculate: (a) Bus bandwidth in MB/s, (b) Minimum time for DMA burst transfer, (c) Number of bus cycles needed.
In a priority interrupt system with 4 devices, the ISR execution times are: Dev0 = 25 ฮผs, Dev1 = 40 ฮผs, Dev2 = 15 ฮผs, Dev3 = 30 ฮผs. If all four devices raise interrupts at t=0, and Dev0 has highest priority, what is the response time for each device?
A DMA controller has a 16-bit address register and 12-bit word count register. What is: (a) Maximum addressable memory, (b) Maximum block size per DMA transfer?
A system uses cycle-stealing DMA. The CPU clock is 500 MHz, and the DMA steals 1 cycle every 10 ฮผs. What is the percentage slowdown of the CPU?
๐ญ Industry Application Problems (I1โI3)
Aadhaar Biometric Authentication: An Aadhaar-enabled POS device captures a 300 KB fingerprint image. The biometric scanner uses DMA at a transfer rate of 5 MB/s. The authentication server responds in 150 ms via the network. Calculate the total time from scan to verification, assuming CPU processing takes 20 ms.
ISRO Satellite Data: ISRO's Chandrayaan-3 orbiter sends scientific data at 8 Mbps. The onboard computer uses DMA with a 64-bit data bus at 50 MHz. Is the bus bandwidth sufficient? What percentage of bus capacity does the data link use?
UPI Payment Terminal: A UPI terminal has: touchscreen (interrupt-driven), QR scanner (DMA), receipt printer (programmed I/O), and network module (DMA). Design the priority interrupt assignment and justify which device gets highest priority.
๐ฏ GATE-Style Problems (G1โG5)
A device with a transfer rate of 10 KB/s is connected to a CPU via DMA. The CPU clock rate is 1 GHz, and one bus cycle takes 4 clock cycles. What fraction of CPU time is consumed by the DMA in cycle-stealing mode? [GATE 2015 Style]
Consider a system with memory-mapped I/O. The address space is 16 bits. If 1 KB is reserved for I/O ports, how many bytes of memory are addressable? [GATE 2018 Style]
In a system with daisy-chained interrupt, which of the following is TRUE?
(A) The device closest to CPU has the lowest priority
(B) The device farthest from CPU has the highest priority
(C) Priority is determined by the physical position in the chain
(D) All devices have equal priority
A DMA controller is transferring a 64 KB block. The word size is 4 bytes, and each word transfer takes 100 ns (cycle stealing). What is the total DMA transfer time? [GATE 2020 Style]
A computer has 4 I/O devices. Device interrupt response times must satisfy: Dev A โค 50ฮผs, Dev B โค 100ฮผs, Dev C โค 200ฮผs, Dev D โค 500ฮผs. ISR times: A=30ฮผs, B=60ฮผs, C=40ฮผs, D=100ฮผs. Determine a valid priority ordering. Can all deadlines be met?
MCQ Assessment Bank โ 30 Questions (Bloom's Mapped)
Remember / Identify (Q1โQ6)
DMA stands for:
- Direct Memory Allocation
- Direct Memory Access
- Dynamic Memory Addressing
- Dual Mode Architecture
In isolated I/O, the CPU uses _____ instructions to communicate with I/O devices.
- MOV and ADD
- IN and OUT
- LOAD and STORE
- PUSH and POP
The start bit in a UART frame is always:
- Logic 1
- Logic 0
- Same as parity bit
- Depends on data
Which register in the DMA controller holds the starting memory address for data transfer?
- Word Count Register (WC)
- Data Register (DR)
- Address Register (AR)
- Status Register (SR)
In programmed I/O, the CPU checks device status using:
- Interrupts
- DMA
- Polling (busy-wait loop)
- Channel commands
UART stands for:
- Universal Asynchronous Receiver-Transmitter
- Unified Address Register Transfer
- Universal Analog Relay Terminal
- Uniform Access Resource Table
Understand / Explain (Q7โQ12)
Why does DMA improve system performance compared to programmed I/O?
- DMA uses faster memory chips
- DMA bypasses the CPU during data transfer, freeing it for other tasks
- DMA increases the clock speed of the processor
- DMA eliminates the need for I/O devices
In memory-mapped I/O, I/O devices are treated as:
- Separate I/O ports with special instructions
- Memory locations accessible through regular memory instructions
- CPU registers
- External interrupt sources only
What is the purpose of the parity bit in a UART frame?
- To increase data transfer speed
- To detect single-bit transmission errors
- To encrypt the data
- To synchronize sender and receiver clocks
In cycle stealing DMA, the CPU is:
- Completely halted during the entire transfer
- Slowed down slightly as DMA steals one bus cycle at a time
- Not affected at all
- Powered off to save energy
Why is handshaking necessary in asynchronous data transfer?
- To encrypt data between devices
- To ensure the receiver is ready before the sender transmits
- To increase the clock speed
- To convert serial data to parallel
In a daisy chain priority interrupt, the device closest to the CPU:
- Has the lowest priority
- Has the highest priority
- Has no priority advantage
- Cannot generate interrupts
Apply / Calculate (Q13โQ18)
A UART with 9600 baud, 8 data bits, no parity, and 1 stop bit can transmit at most _____ characters per second.
- 9600
- 960
- 1200
- 800
A DMA controller with a 16-bit word count register can transfer a maximum of:
- 32 KB
- 64 KB words
- 65,536 words
- 16 words
If a disk transfers at 4 MB/s and DMA cycle stealing steals 1 cycle per word (word = 4 bytes), how many cycles are stolen per second?
- 4,000,000
- 1,000,000
- 16,000,000
- 500,000
In a system with 20-bit address space and memory-mapped I/O, 256 addresses are reserved for I/O. How much memory is available?
- 1 MB
- 1 MB โ 256 bytes
- 1,048,320 bytes
- Both B and C
A priority encoder with 8 inputs requires how many output bits to represent the highest-priority active input?
- 2
- 3
- 4
- 8
A DMA burst transfer of 256 words on a bus with 50 ns cycle time takes:
- 12.8 ฮผs
- 5.12 ฮผs
- 256 ฮผs
- 0.05 ฮผs
Analyze / Compare (Q19โQ24)
Which data transfer mode would be most appropriate for a high-definition video camera streaming at 300 MB/s?
- Programmed I/O
- Interrupt-driven I/O
- DMA with burst mode
- Software polling
Compared to daisy chain, parallel priority interrupt has:
- Lower hardware cost but slower response
- Higher hardware cost but faster response
- Same cost and same speed
- Lower cost and faster speed
Memory-mapped I/O is preferred over isolated I/O when:
- The system needs maximum memory address space
- The system needs to perform arithmetic operations on I/O data
- The system has very few I/O devices
- Both B and C
A selector channel differs from a multiplexer channel in that:
- Selector handles one device at a time; multiplexer handles many simultaneously
- Selector handles many devices; multiplexer handles one
- Both handle the same number of devices
- Selector is slower than multiplexer
In DMA cycle stealing vs burst mode, which statement is TRUE?
- Burst mode gives better CPU utilization
- Cycle stealing gives better CPU utilization but slower total transfer
- Both give equal CPU utilization
- Cycle stealing blocks the CPU completely
Strobe-based handshaking vs full handshaking: which is more reliable and why?
- Strobe โ because it uses fewer signals
- Full handshaking โ because both sides confirm every phase of transfer
- Both are equally reliable
- Neither is reliable for high-speed transfers
Evaluate & Create (Q25โQ30)
A system designer must choose between DMA burst mode and cycle stealing for a network card receiving 100 Mbps Ethernet. Which is more suitable and why?
- Burst mode โ to transfer each Ethernet frame in one shot
- Cycle stealing โ to avoid blocking CPU during continuous network traffic
- Programmed I/O โ network speeds are manageable
- No DMA needed โ interrupt-driven is sufficient
An embedded system has a temperature sensor (1 reading/sec), a motor controller (100 commands/sec), and an SD card logger (1 MB/min). Assign optimal data transfer modes.
- All three use DMA
- Sensor: Polling, Motor: Interrupt, SD card: DMA
- All three use interrupts
- Sensor: DMA, Motor: Polling, SD card: Interrupt
If you're designing a UART for an IoT device that must work at extreme distances (200m+), which modification would improve reliability?
- Increase baud rate to 1 Mbps
- Use differential signaling (RS-485) instead of single-ended UART
- Remove parity bit to reduce overhead
- Reduce data bits to 5
Design a priority scheme for 4 devices: Keyboard (slow), Disk (fast, bulk), Network (medium, real-time), Timer (critical). What is the optimal priority order?
- Timer > Network > Disk > Keyboard
- Keyboard > Timer > Network > Disk
- Disk > Network > Timer > Keyboard
- Network > Disk > Keyboard > Timer
You're building an Arduino-based weather station. Which I/O concepts from this chapter would you use for: (1) reading a temperature sensor every 5 seconds, (2) logging data to an SD card, (3) sending data over Bluetooth (HC-05)?
- All polling
- (1) Timer interrupt, (2) SPI with DMA, (3) UART interrupt
- All DMA
- (1) DMA, (2) Polling, (3) DMA
A company needs an I/O system for an ATM machine: card reader, keypad, receipt printer, screen, network module, and cash dispenser motor. Which combination of transfer modes and priority interrupts would you recommend?
- All devices on programmed I/O with round-robin polling
- Network & card reader on DMA; keypad & screen on interrupt; printer & motor on programmed I/O; Priority: Network > Card > Keypad > Motor > Screen > Printer
- All devices on DMA with daisy chain
- All devices on interrupt with no priority
Short Answer Questions (8 Questions)
Differentiate between Memory-Mapped I/O and Isolated I/O with one example each. (4 marks)
Memory-Mapped I/O: I/O ports share the same address space as memory. CPU uses regular instructions (MOV, ADD) to access devices. Example: ARM-based Raspberry Pi โ GPIO registers are mapped to memory addresses like 0x3F200000. Advantage: Any instruction works. Disadvantage: Reduces available memory addresses.
Isolated I/O: I/O ports have a separate address space. CPU uses special IN/OUT instructions. Example: Intel x86 PCs โ keyboard port at I/O address 0x60. Advantage: Full memory space preserved. Disadvantage: Limited to IN/OUT instructions only.
Explain the handshaking mechanism in asynchronous data transfer with a timing diagram. (5 marks)
Handshaking is a protocol where sender and receiver exchange control signals to synchronize data transfer without a common clock. The 4-phase handshake: (1) Source places data and raises DATA_VALID, (2) Destination reads data and raises DATA_ACK, (3) Source sees ACK, removes data, lowers DATA_VALID, (4) Destination sees DV low, lowers DATA_ACK. Each phase waits for the other side's response, ensuring reliable transfer regardless of speed mismatch. See timing diagram in Section C.7.
What are the three modes of DMA transfer? Compare them briefly. (4 marks)
Burst Mode: DMA holds bus for entire block. CPU fully blocked. Fastest total transfer. Used for disk reads.
Cycle Stealing: DMA takes one bus cycle per word, then returns bus to CPU. CPU slightly slowed. Best for streaming devices like network cards.
Transparent/Interleaved: DMA uses bus only during CPU idle cycles. Zero CPU impact. Slowest overall but no CPU interference.
Draw and explain the UART frame format for transmitting 'Z' (ASCII 90) with even parity. (5 marks)
ASCII 'Z' = 90 = 0x5A = 01011010 binary. LSB first: 0,1,0,1,1,0,1,0. Count of 1s = 4 (even). For even parity, parity bit = 0 (already even). Frame: Start(0) + Data(01011010 LSB first) + Parity(0) + Stop(1) = 0-01011010-0-1 = 11 bits. At 9600 baud, transmission time = 11/9600 = 1.146 ms.
List the registers in a DMA controller and state the function of each. (4 marks)
Address Register (AR): Holds the memory address where data is to be transferred. Incremented after each word transfer.
Word Count Register (WC): Holds the number of words to transfer. Decremented after each transfer. When WC=0, transfer complete.
Data Register (DR): Temporary buffer holding one word during transit between device and memory.
Control Register: Specifies direction (read/write), DMA mode (burst/cycle stealing), enable/disable, and interrupt enable.
Compare daisy chain and parallel priority interrupt mechanisms. Which is faster? (4 marks)
Daisy Chain: Devices connected in series. Acknowledge signal cascades through chain. Priority = physical position (closest to CPU = highest). Simple hardware (just PI/PO wires). Fixed priority. Slower for many devices.
Parallel Priority: All devices connect to a priority encoder simultaneously. Resolves priority in one clock cycle using combinational logic. Requires more hardware (encoder, mask register). Programmable priority via mask. Much faster โ O(1) vs O(n) for daisy chain.
Explain the concept of cycle stealing in DMA with a timing example. (4 marks)
In cycle stealing, the DMA controller "steals" one bus cycle from the CPU to transfer one word, then returns bus control. Example: CPU clock = 100 MHz (10 ns cycle). DMA needs to transfer 1 word every 1 ฮผs (device rate). In 1 ฮผs = 100 CPU cycles, DMA steals 1 cycle. CPU slowdown = 1/100 = 1%. The CPU continues executing instructions during the 99 unstolen cycles, making cycle stealing nearly transparent.
What is an I/O Processor (IOP)? How does it differ from a DMA controller? (5 marks)
IOP is a dedicated processor that handles all I/O operations independently. It has its own instruction set (channel commands), can execute I/O programs, manage multiple devices, perform error handling, and make decisions โ all without CPU intervention.
Key differences: DMA transfers data blocks passively (no decision-making). IOP can execute programs, handle errors, manage device queues, and perform data formatting. DMA is simpler and cheaper; IOP is a full processor dedicated to I/O. DMA needs CPU to initialize each transfer; IOP needs CPU only for high-level commands.
Long Answer Questions (3 Questions)
Explain the complete working of a DMA controller with a neat block diagram. Describe the DMA transfer sequence (initialization, request, acknowledge, transfer, completion). Discuss burst mode vs cycle stealing with timing diagrams and calculate the CPU slowdown for a given configuration: disk at 10 MB/s, 32-bit bus, 200 MHz clock. (15 marks)
Block Diagram: DMA controller contains AR, WC, DR, Control Logic. Connected to CPU via BR/BG lines, to system bus (Address + Data + Control), and to device via DRQ/DACK. See Section C.4 for complete diagram.
Transfer Sequence: (1) CPU loads AR, WC, direction into DMA registers. (2) Device raises DRQ when data ready. (3) DMA raises BR (Bus Request) to CPU. (4) CPU completes current cycle, sends BG (Bus Grant). (5) DMA places AR on address bus, transfers data between device and memory. (6) AR incremented, WC decremented. (7) Repeat until WC=0. (8) DMA sends interrupt to CPU โ transfer complete.
Burst vs Cycle Stealing: Burst holds bus for all N transfers continuously. Cycle stealing takes bus for 1 transfer, returns, repeats. Burst is faster total but blocks CPU. Cycle stealing has better CPU utilization.
Calculation: Disk = 10 MB/s = 10ร10โถ bytes/s. Bus width = 32 bits = 4 bytes. Words/sec = 10M/4 = 2.5M. CPU clock = 200 MHz = 200M cycles/s. If each DMA transfer = 1 bus cycle, cycles stolen = 2.5M/s. Slowdown = 2.5M/200M = 1.25%.
Compare and contrast the three methods of data transfer: Programmed I/O, Interrupt-driven I/O, and DMA. For each method, draw the data flow path, explain the algorithm, discuss advantages and disadvantages, and provide real-world examples. Include a comprehensive comparison table. (15 marks)
Programmed I/O: Data path: Device โ CPU โ Memory. Algorithm: CPU reads status in loop โ reads data โ stores to memory. Advantage: Simple hardware. Disadvantage: CPU stuck in polling loop. Example: Old dot-matrix printer, simple embedded keypad.
Interrupt-Driven I/O: Data path: Device โ CPU (via ISR) โ Memory. Algorithm: Device raises interrupt โ CPU saves context โ executes ISR โ reads data โ stores to memory โ restores context. Advantage: CPU free between interrupts. Disadvantage: Context switch overhead. Example: Mouse, UART serial port, keyboard.
DMA: Data path: Device โ Memory (bypasses CPU). Algorithm: CPU initializes DMA โ DMA requests bus โ transfers data โ interrupts CPU on completion. Advantage: Highest throughput, minimal CPU load. Disadvantage: Complex hardware, DMA controller cost. Example: Disk, SSD, network card, video capture.
See comparison table in Section C.3 for detailed feature-by-feature comparison.
Explain the priority interrupt system in detail. Describe (a) Daisy Chain priority with diagram, (b) Parallel priority using priority encoder, (c) Software polling method. Compare all three methods and design a priority interrupt system for a computer with 6 peripheral devices. (15 marks)
(a) Daisy Chain: Devices connected in series via PI/PO lines. Common INT line (wired-OR) goes to CPU. When CPU sends acknowledge, it passes through chain. First device with pending interrupt captures it, blocks propagation. Priority = position. Diagram shows CPU โ Dev0(PIโPO) โ Dev1(PIโPO) โ Dev2 โ ... with common INT line.
(b) Parallel Priority: All 6 devices connect to a priority encoder. Encoder outputs 3-bit vector of highest-priority active device. Mask register enables/disables individual interrupts. Interrupt status register stores pending interrupts. Resolution time = 1 clock cycle. Hardware: 8-to-3 encoder, 8-bit mask register, AND gates, comparator.
(c) Software Polling: CPU sequentially reads each device's status register. First device found with interrupt flag set is serviced. Priority = order of polling. No extra hardware. Slowest method.
Design for 6 devices: Use parallel priority encoder (8-input, 6 used). Assign priorities based on urgency: Timer(0) > Network(1) > Disk(2) > Serial(3) > Keyboard(4) > LED Display(5). Mask register allows runtime priority changes.
Industry Spotlight โ A Day in the Life
๐ฉโ๐ป Meera Nair, 27 โ Embedded Systems Engineer at Texas Instruments, Bangalore
Background: B.Tech ECE from NIT Calicut. Fascinated by microcontrollers in 3rd year. Built an IoT weather station using Arduino and ESP32 as her final-year project. Got placed at TI through campus recruitment after acing the hardware design round.
A Typical Day:
8:30 AM โ Morning stand-up with the MSP430 microcontroller team. Review yesterday's Verilog simulation results for a new DMA controller IP block.
9:30 AM โ Write RTL (Register Transfer Level) code in Verilog for a priority interrupt controller that supports 16 interrupt sources with programmable priority and nested interrupts.
11:00 AM โ Run gate-level simulations. Check timing analysis โ does the DMA controller meet the 100 MHz clock target? Fix a setup time violation on the address register path.
12:30 PM โ Lunch at TI's campus cafeteria in Outer Ring Road, Bangalore. Chat about upcoming tapeout deadline.
1:30 PM โ Debug a UART module that's dropping characters at 921600 baud. Root cause: FIFO buffer overflow. Fix: increase FIFO depth from 16 to 64 bytes.
3:30 PM โ Code review with senior architect. Discuss trade-offs between cycle-stealing DMA and burst DMA for the new industrial sensor interface.
5:00 PM โ Write test vectors for the I/O subsystem. Simulate multiple devices raising interrupts simultaneously โ verify priority encoding works correctly.
6:00 PM โ Learning hour: study AXI bus protocol (ARM's advanced I/O bus used in modern SoCs).
| Detail | Info |
|---|---|
| Tools Used Daily | Verilog/SystemVerilog, Synopsys VCS, Cadence Genus, Logic Analyzers, Oscilloscopes |
| Entry Salary (2025) | โน8โ12 LPA + benefits (TI is among the best-paying for fresh grads) |
| Mid-Level (3โ5 yrs) | โน15โ25 LPA |
| Senior (7+ yrs) | โน30โ50 LPA |
| Key Skills | Verilog, VHDL, I/O architecture, DMA design, interrupt handling, UART/SPI/I2C protocols |
| Companies Hiring | Texas Instruments, Qualcomm, Intel, Samsung, MediaTek, ISRO, DRDO, Analog Devices, Microchip, NXP |
Earn With It โ IoT & Embedded Projects
๐ฐ Your Earning Path After This Chapter
Portfolio Pieces You Can Build:
โข UART Communication Logger โ Arduino reads sensors, sends data via UART to a PC dashboard โ โน2,000โโน5,000 freelance projects
โข DMA Transfer Simulator โ Python/C visualization of DMA with performance graphs โ Portfolio showcase for TI/Qualcomm interviews
โข Priority Interrupt Controller โ Verilog project on GitHub โ โน6โ12 LPA job applications in VLSI design
| Project Idea | Skills Needed | Earning Potential |
|---|---|---|
| IoT Sensor Station | Arduino + UART + I2C + WiFi | โน3,000โโน10,000/project on Freelancer.in |
| Home Automation System | ESP32 + GPIO interrupts + relay control | โน5,000โโน15,000/installation |
| Industrial Data Logger | RS-485 (UART variant) + SD card (DMA) + sensors | โน10,000โโน30,000/project for factories |
| Verilog IP Blocks on OpenCores | Verilog/VHDL + I/O controller design | Resume gold for โน8โ12 LPA VLSI jobs |
| PCB Design with I/O | KiCad + UART/SPI/I2C headers + DMA-capable MCU | โน5,000โโน20,000/board design on Fiverr |
โฑ๏ธ Time to First Earning: 3โ4 weeks (build an IoT project + create a portfolio on GitHub + apply on Internshala for embedded systems internships)
Chapter Summary
๐ Key Takeaways โ Unit 5: I/O Organization
- Peripheral Devices communicate with the CPU through I/O interfaces that handle speed matching, format conversion, and device selection.
- I/O Interface sits between CPU bus and device. Two addressing schemes: Memory-Mapped I/O (shared address space, any instruction) and Isolated I/O (separate space, IN/OUT instructions).
- Three Data Transfer Modes:
- Programmed I/O โ CPU polls device status in a loop (simplest, least efficient)
- Interrupt-Driven I/O โ Device signals CPU when ready (better efficiency)
- DMA โ Hardware controller transfers data directly to memory (best for high-speed devices)
- DMA Controller has AR, WC, DR, and Control registers. Supports burst mode (fastest transfer, CPU blocked), cycle stealing (interleaved, CPU slightly slowed), and transparent mode (uses idle cycles).
- I/O Processor (IOP) is a dedicated processor for complex I/O operations. Types: Multiplexer Channel, Selector Channel, Block Multiplexer Channel.
- Priority Interrupts resolve simultaneous device requests. Methods: Daisy Chain (hardware, simple, fixed priority), Parallel Priority (fast, encoder-based), Software Poll (flexible, slow).
- Asynchronous Transfer uses handshaking (strobe + ACK) for devices without a common clock.
- UART transmits serial data with Start + 8 Data + Parity + Stop bits. Common config: 9600 baud, 8N1.
Earning Checkpoint
| Skill Learned | Tool / Method | Portfolio Artifact | Can You Earn? |
|---|---|---|---|
| I/O Addressing (Mem-mapped vs Isolated) | Conceptual + ARM/x86 comparison | โ | โ Yes โ interview topic for embedded jobs |
| Data Transfer Modes | Conceptual comparison | Comparison chart / notes | โ Yes โ GATE + interview essential |
| DMA Architecture | Block diagrams + numericals | DMA Simulator (C/Python) | โ Yes โ portfolio for TI/Qualcomm roles |
| UART Protocol | Python simulation + Arduino | UART Frame Generator program | โ Yes โ IoT freelance projects |
| Priority Interrupts | Verilog / Logisim | Interrupt Controller on GitHub | โ Yes โ VLSI design jobs โน8โ12 LPA |
| Handshaking Protocol | Timing diagrams | โ | โ Yes โ embedded systems interviews |
| IOP / Channel Architecture | Conceptual (mainframe focus) | โ | โฌ Niche โ relevant for IBM/HCL mainframe roles |
| IoT Integration | Arduino/ESP32 + sensors + UART | IoT Weather Station project | โ Yes โ โน3,000โโน15,000/project |
โ Unit 5 complete. You've mastered I/O Organization!
[QR: Link to EduArtha video tutorial โ I/O Organization]