Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.

Slides:



Advertisements
Similar presentations
Homework Reading Machine Projects Labs
Advertisements

Computer Architecture
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Parul Polytechnic Institute
Hoofdstuk 8 Interfaces en interface-ontwerp Prof. dr. ir. Dirk Stroobandt Academiejaar
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 1 A simple bus bus structure ProcessorMemory rd'/wr enable addr[0-11]
I/O Unit.
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Chapter 6 Interfacing.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 13 Direct Memory Access (DMA)
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 6 Interfacing ECE4330 Embedded System Design.
Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.
COMPUTER SYSTEMS An Integrated Approach to Architecture and Operating Systems Chapter 4 Processor Implementation ©Copyright 2008 Umakishore Ramachandran.
GURSHARAN SINGH TATLA PIN DIAGRAM OF 8085 GURSHARAN SINGH TATLA
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
2. Methods for I/O Operations
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
INPUT/OUTPUT ARCHITECTURE By Truc Truong. Input Devices Keyboard Keyboard Mouse Mouse Scanner Scanner CD-Rom CD-Rom Game Controller Game Controller.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 5 Memory.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Interrupts. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
MICROPROCESSOR INPUT/OUTPUT
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
Top Level View of Computer Function and Interconnection.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
DMA Versus Polling or Interrupt Driven I/O
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
Interrupts, Buses Chapter 6.2.5, Introduction to Interrupts Interrupts are a mechanism by which other modules (e.g. I/O) may interrupt normal.
Direct Memory Access (DMA) Microprocessors I -1. Topics to be discussed  Basic DMA Concept Basic DMA Concept  DMA pins and timing DMA pins and timing.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 6 Interfacing.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم MEMORY AND I/O.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Amdahl’s Law & I/O Control Method 1. Amdahl’s Law The overall performance of a system is a result of the interaction of all of its components. System.
1 Input / Output. Today: I/O Systems How does I/O hardware influence the OS? What I/O services does the OS provide? How does the OS implement those services?
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Chapter 5 Memory.
Microprocessor Systems Design I
The process starts from the I/O device
UNIT – Microcontroller.
Computer Architecture
Interrupts In 8085 and 8086.
Interrupt.
Operating Systems Chapter 5: Input/Output Management
X1 & X2 These are also called Crystal Input Pins.
8259 Programmable Interrupt Controller
COMPUTER PERIPHERALS AND INTERFACES
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Interfacing

This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and bus-based I/O Memory mapped I/O and Standard I/O  Microprocessor interfacing: Interrupts  Microprocessor interfacing: Direct memory access  Arbitration  Priority arbiter  Daisy-chain arbitration  Network oriented arbitration  Advanced communication principles  Serial / Parallel / Wireless communication  Error detection and correction  Serial protocols  Parallel protocols  Wireless protocols Chapter 6 Interfacing

Microprocessor interfacing: interrupts  Suppose a peripheral intermittently receives data, which must be serviced by the processor  The processor can poll the peripheral regularly to see if data has arrived – wasteful if too frequently performed, may miss service request if not performed frequently enough!  The peripheral can interrupt the processor when it has data  Requires an extra pin or pins: Int  If Int is 1, processor suspends current program, jumps to an Interrupt Service Routine, or ISR  Known as interrupt-driven I/O  Essentially, “polling” of the interrupt pin is built-into the hardware, so no extra time!

Microprocessor interfacing: interrupts  What is the address (interrupt address vector) of the ISR?  Fixed interrupt Address built into microprocessor, cannot be changed Either ISR stored at address or a jump to actual ISR stored if not enough bytes available Several interrupt pins are available to service interrupts from multiple peripherals  Vectored interrupt Peripheral must provide the address Common when microprocessor has multiple peripherals connected by a system bus Only one interrupt pin is necessary, which can be asserted by any peripheral  Compromise: interrupt address table

Interrupt-driven I/O using fixed ISR location 1(a): μP is executing its main program. 1(b): P1 receives input data in a register with address 0x : P1 asserts Int to request servicing by the μP. 3: After completing instruction at 100, μP sees Int asserted, saves the PC’s value of 100, and sets PC to the ISR fixed location of 16. 4(a): The ISR reads data from 0x8000, modifies the data, and writes the resulting data to 0x : The ISR returns, thus restoring PC to 100+1=101, where μP resumes executing. 4(b): After being read, P1 de- asserts Int. Time Read data received by Peripheral 1 (a sensor), transform and write it to Peripheral 2 (a display). μP normally runs its main program which is located at address 100 at the time interrupt from P1 is received.

Interrupt-driven I/O using fixed ISR location 1(a):  P is executing its main program 1(b): P1 receives input data in a register with address 0x8000. μP P1P2 System bus Int Data memory 0x80000x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR : 101: instruction Main program... Program memory PC 2: P1 asserts Int to request servicing by the microprocessor 3: After completing instruction at 100,  P sees Int asserted, saves the PC’s value of 100, and sets PC to the ISR fixed location of 16. 4(a): The system bus gets activated, the ISR reads data from 0x8000, modifies the data, and writes the resulting data to 0x (b): After being read, P1 deasserts Int. 5: The ISR returns, thus restoring PC to 100+1=101, where  P resumes executing. P1P2 0x

Interrupt-driven I/O using vectored interrupt 1(a): μP is executing its main program. 1(b): P1 receives input data in a register with address 0x : P1 asserts Int to request servicing by the microprocessor. 3: After completing instruction at 100, μP sees Int asserted, saves the PC’s value of 100, and asserts Inta, acknowledging the receipt of Int, and requests the address at which ISR reside. 5(a): μP jumps to the address on the bus (16). The ISR there reads data from 0x8000, modifies the data, and writes the resulting data to 0x : The ISR returns, thus restoring PC to 100+1=101, where μP resumes executing. 5(b): After being read, P1 deasserts Int. Time 4: P1 detects Inta and puts interrupt address vector 16 on the data bus. Read data received by Peripheral 1 (a sensor), transform and write it to Peripheral 2 (a display). μP normally runs its main program which is located at address 100 at the time interrupt from P1 is received.

Interrupt-driven I/O using vectored interrupt μP P1 P2 System bus Data memory 0x8000 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC 100 Int Inta 16 1(a): P is executing its main program 1(b): P1 receives input data in a register with address 0x8000.

Interrupt-driven I/O using vectored interrupt μP P1P2 System bus Data memory 0x8000 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC 100 Inta 16 2: P1 asserts Int to request servicing by the microprocessor Int 1

Interrupt-driven I/O using vectored interrupt 3: After completing instruction at 100, μP sees Int asserted, saves the PC’s value of 100, and asserts Inta μP P1P2 System bus Data memory 0x8000 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC Int Inta 16 1 Inta 100

μP P1P2 System bus Data memory 0x8000 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC Int Inta 16 Interrupt-driven I/O using vectored interrupt 100 4: P1 detects Inta and puts interrupt address vector 16 on the data bus 16

Interrupt-driven I/O using vectored interrupt 5(a): PC jumps to the address on the bus (16). The ISR there reads data from 0x8000, modifies the data, and writes the resulting data to 0x (b): After being read, P1 deasserts Int. μP P1P2 System bus Data memory 0x8000 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC Int Inta :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... P1 P2 0x8000 0x8001 System bus 0 Int

Interrupt-driven I/O using vectored interrupt 6: The ISR returns, thus restoring the PC to 100+1=101, where the μP resumes μP P1P2 System bus Data memory 0x80000x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC Int :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program

Interrupt address table  Compromise between fixed and vectored interrupts  One interrupt pin  Table in memory holding ISR addresses (maybe 256 words)  Peripheral doesn’t provide ISR address, but rather index into table Fewer bits are sent by the peripheral Can move ISR location without changing peripheral  Maskable vs. non-maskable interrupts  Maskable: programmer can set bit that causes processor to ignore interrupt Important when in the middle of time-critical code (time counting)  Non-maskable: a separate interrupt pin that can’t be masked Typically reserved for drastic situations, like power failure requiring immediate backup of data to non-volatile memory

Direct memory access  Buffering  Temporarily storing data in memory before processing  Data accumulated in peripherals commonly buffered  Microprocessor could handle this with ISR  Storing and restoring microprocessor state (register contents, such as PC) inefficient  Regular program must wait  DMA controller more efficient  Separate single-purpose processor  Move data between peripherals and memory Peripheral makes a request to DMA to write data to the memory DMA requests bus control from the μP Microprocessor merely relinquishes control of system bus to DMA controller (rather than jumping into an ISR) avoiding all the overhead associated with ISR Microprocessor can meanwhile execute its regular program No inefficient storing and restoring state due to ISR call Regular program need not wait unless it requires the system bus Harvard architecture – processor can fetch and execute instructions as long as they don’t access data memory – if they do, processor stalls

Peripheral to memory transfer without DMA, using vectored interrupt 1(a): μP is executing its main program.1(b): P1 receives input data in a register with address 0x : P1 asserts Int to request servicing by the microprocessor. 3: After completing instruction at 100, μP sees Int asserted, saves the PC’s value of 100, and asserts Inta. 5(a): μP jumps to the address on the bus (16). The ISR there reads data from 0x8000 and then writes it to 0x0001, which is in memory. 6: The ISR returns, thus restoring PC to 100+1=101, where μP resumes executing. 5(b): After being read, P1 deasserts Int. Time 4: P1 detects Inta and puts interrupt address vector 16 on the data bus. Writing peripheral data into a memory works just like an ISR. ISRs are costly, not worth going all that trouble just to write data to the memory!

Peripheral to memory transfer without DMA, using vectored interrupt 1(a):  P is executing its main program 1(b): P1 receives input data in a register with address 0x8000. Data memory 0x00000x0001 μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18: MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101: instruction... Main program... Program memory PC 100 Int Inta 16

Peripheral to memory transfer without DMA, using vectored interrupt 2: P1 asserts Int to request servicing by the microprocessor μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18:MOV 0x0001, R0 19: RETI # ISR return ISR 100: 101:instruction... Main program... Program memory PC Data memory 0x00000x Inta instruction Int

Peripheral to memory transfer without DMA, using vectored interrupt 3: After completing instruction at 100,  P sees Int asserted, saves the PC’s value of 100, and asserts Inta. μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18:MOV 0x0001, R0 19: RETI # ISR return ISR... Program memory PC Data memory 0x00000x Int 100: 101: instruction Main program... 1 Inta 100

Peripheral to memory transfer without DMA, using vectored interrupt (cont’) 4: P1 detects Inta and puts interrupt address vector 16 on the data bus. μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18:MOV 0x0001, R0 19: RETI # ISR return ISR 100: 101:instruction... Main program... Program memory PC Data memory 0x00000x Int Inta instruction System bus 16

μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18:MOV 0x0001, R0 19: RETI # ISR return ISR 100: 101:instruction... Main program... Program memory PC Data memory 0x00000x Int instruction Inta Peripheral to memory transfer without DMA, using vectored interrupt (cont’) 5(a):  P jumps to the address on the bus (16). The ISR there reads data from 0x8000 and then writes it to 0x0001, which is in memory. 5(b): After being read, P1 de-asserts Int. 100 Int 0

μP P1 System bus 0x :MOV R0, 0x :# modifies R0 18:MOV 0x8001, R0 19: RETI # ISR return ISR 100: 101:instruction... Main program... Program memory PC Data memory 0x00000x Int instruction Inta Peripheral to memory transfer without DMA, using vectored interrupt (cont’) 6: The ISR returns, thus restoring PC to 100+1=101, where  P resumes executing :MOV R0, 0x :# modifies R0 18:MOV 0x0001, R0 19: ISR 100: 101:instruction... Main program... instruction RETI # ISR return

Peripheral to memory transfer with DMA 1(a): μP is executing its main program. It has already configured the DMA ctrl registers. 1(b): P1 receives input data in a register with address 0x : P1 asserts req to request servicing by DMA ctrl. 7(b): P1 de-asserts req. Time 3: DMA ctrl asserts Dreq to request control of system bus. 4: After executing instruction 100, μP sees Dreq asserted, releases the system bus, asserts Dack, and resumes execution. μP stalls only if it needs the system bus to continue executing. 5: (a) DMA ctrl asserts ack (b) reads data from 0x8000 and (b) writes that data to 0x :. DMA de-asserts Dreq and ack completing handshake with P1. 7(a): μP de-asserts Dack and resumes control of the bus. Using DMA requires the μP to have two additional pins: Dreq used by the DMA controller to request control of the bus, and Dack used by the μP to acknowledge that bus control has been granted. The DMA also has two such pins ack and rec for a similar handshake with the peripheral

Peripheral to memory transfer with DMA (cont’) 1(a):  P is executing its main program. It has already configured the DMA ctrl registers 1(b): P1 receives input data in a register with address 0x8000. Data memory μP DMA ctrlP1 System bus 0x : instruction... Main program... Program memory PC 100 Dreq Dack 0x00000x : No ISR needed! 0x0001 0x8000 ack req

Peripheral to memory transfer with DMA (cont’) 2: P1 asserts req to request servicing by DMA ctrl. 3: DMA ctrl asserts Dreq to request control of system bus Data memory μP DMA ctrlP1 System bus 0x : instruction... Main program... Program memory PC 100 Dreq Dack 0x00000x : No ISR needed! 0x0001 0x8000 ack req 1 P1 Dreq 1 DMA ctrl

Peripheral to memory transfer with DMA (cont’) 4: After executing instruction 100,  P sees Dreq asserted, releases the system bus, asserts Dack, and resumes execution,  P stalls only if it needs the system bus to continue executing. Data memory μP DMA ctrlP1 System bus 0x : instruction... Main program... Program memory PC 100 Dreq Dack 0x00000x : No ISR needed! 0x0001 0x8000 ack req Dack 1

Data memory μP DMA ctrlP1 System bus 0x : instruction... Main program... Program memory PC 100 Dreq Dack 0x00000x : No ISR needed! 0x0001 0x8000 ack req Data memory DMA ctrlP1 System bus 0x8000 0x00000x0001 0x8000 ack req Peripheral to memory transfer with DMA (cont’) 5: DMA ctrl (a) asserts ack, (b) reads data from 0x8000, and (c) writes that data to 0x0001. (Meanwhile, processor still executing if not stalled!) ack 1

Peripheral to memory transfer with DMA (cont’) 6: DMA de-asserts Dreq and ack completing the handshake with P1. Data memory μP DMA ctrlP1 System bus 0x : instruction... Main program... Program memory PC 100 Dreq Dack 0x00000x : No ISR needed! 0x0001 0x8000 ack req ack 0 Dreq 0