1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 7: Interrupts (2) January 29, 2015 Some slides prepared by.

Slides:



Advertisements
Similar presentations
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Advertisements

Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
A look at interrupts What are interrupts and why are they needed.
CSCI 4717/5717 Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 7: Exceptions and Interrupts September 27, 2011.
A look at interrupts What are interrupts and why are they needed.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 7: Interrupts (2) September 23, 2014 Some slides prepared.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
COMPUTER SYSTEMS An Integrated Approach to Architecture and Operating Systems Chapter 4 Processor Implementation ©Copyright 2008 Umakishore Ramachandran.
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 7: Finish interrupts, group talks, start on serial buses Sept.
Exception and Interrupt Handling
Introduction to Embedded Systems
COMP201 Computer Systems Exceptions and Interrupts.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
MICROPROCESSOR INPUT/OUTPUT
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
PIC16F877 ISR Points to note Interrupt Triggers –Individual interrupt flag bits are set, regardless of the status of their corresponding mask bit, PEIE.
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 7: Finish interrupts, group talks, start on serial buses Feb.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Microprocessors 1 MCS-51 Interrupts.
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 6: Interrupts Sept. 19 th 2013 Slides developed in part by.
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 6: Interrupts January 30 th Slides developed in part by Prof.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
ARM Cortex-M0 August 23, 2012 Paul Nickelsberg Orchid Technologies Engineering and Consulting, Inc. CORTEX-M0 Structure Discussion.
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.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
9/20/6Lecture 3 - Instruction Set - Al1 Exception Handling.
CS-280 Dr. Mark L. Hornick 1 Sequential Execution Normally, CPU sequentially executes instructions in a program Subroutine calls are synchronous to the.
EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Lecture 6 & 7: Interrupts (please bring slides again on Thursday) January.
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Networked Embedded Systems Pengyu Zhang & Sachin Katti EE107 Spring 2016 Lecture 4 Timers and Interrupts.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Cortex-M3 Exceptions RTLAB. Hyeonggon Jo.  Exceptions Exception types & priority Abort model SVC and PendSV  Interrupt operation Pre-emption & Exit.
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Interrupts, Exceptions, Traps, Faults & ARM’s Nested Vectored Interrupt.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
A walk through interrupts on the PPC 823
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Interrupts and signals
Microprocessor Systems Design I
Mon. Oct 2 Announcements Quiz Postponed to Wednesday – still only on 2.a + 2.b Video lecture for 2.a posted Lab 6 experiment extension You must come to.
Timer and Interrupts.
EECS 373 Design of Microprocessor-Based Systems Prabal Dutta
Computer Architecture
Interrupts In 8085 and 8086.
EECS 373 Design of Microprocessor-Based Systems Prabal Dutta
Chapter 10 And, Finally... The Stack
* * * * * * * 8051 Interrupts Programming.
EECS 373 Design of Microprocessor-Based Systems Mark Brehob
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /20/2018.
Computer System Overview
Processor Fundamentals
Computer System Overview
Wireless Embedded Systems
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 7: Interrupts (2) January 29, 2015 Some slides prepared by Mark Brehob

High-level review of interrupts Why do we need them? Why are the alternatives unacceptable? –Convince me! What sources of interrupts are there? –Hardware and software! What makes them difficult to deal with? –Interrupt controllers are complex: there is a lot to do! Enable/disable, prioritize, allow premption (nested interrupts), etc. –Software issues are non-trivial Can’t trash work of task you interrupted Need to be able to restore state Shared data issues are a real pain 2

3

4

5

6

Pending interrupts 7 The normal case. Once Interrupt request is seen, processor puts it in “pending” state even if hardware drops the request. IPS is cleared by the hardware once we jump to the ISR. This figure and those following are from The Definitive Guide to the ARM Cortex-M3, Section 7.4

8

9

10

11

12

Masking 13

Interrupt Service Routines Automatic saving of registers upon exception –PC, PSR, R0-R3, R12, LR –This occurs over data buss While data bus busy, fetch exception vector –i.e. target address of exception handler –This occurs over instruction bus Update SP to new location Update IPSR (low part of xPSR) with exception new # Set PC to vector handler Update LR to special value EXC_RETURN Several other NVIC registers gets updated Latency can be as short as 12 cycles (w/o mem delays) 14

The xPSR register layout 15

ARM interrupt summary 1.We’ve got a bunch of memory-mapped registers that control things ( NVIC ) –Enable/disable individual interrupts –Set/clear pending –Interrupt priority and preemption 2.We’ve got to understand how the hardware interrupt lines interact with the NVIC 3.And how we figure out where to set the PC to point to for a given interrupt source. 16

1. NVIC registers (example) 17

1. More registers (example) 18

1. Yet another part of the NVIC registers! 19

2. How external lines interact with the NVIC 20 The normal case. Once Interrupt request is seen, processor puts it in “pending” state even if hardware drops the request. IPS is cleared by the hardware once we jump to the ISR. This figure and those following are from The Definitive Guide to the ARM Cortex-M3, Section 7.4

3. How the hardware figures out what to set the PC to g_pfnVectors:.word _estack.word Reset_Handler.word NMI_Handler.word HardFault_Handler.word MemManage_Handler.word BusFault_Handler.word UsageFault_Handler.word 0.word SVC_Handler.word DebugMon_Handler.word 0.word PendSV_Handler.word SysTick_Handler.word WdogWakeup_IRQHandler.word BrownOut_1_5V_IRQHandler.word BrownOut_3_3V_IRQHandler (they continue) 21

Discussion: So let’s say a GPIO pin goes high - When will we get an interrupt? - What happens if the interrupt is allowed to proceed? 22

What happens when we return from an ISR? 23 Interrupt exiting process –System restoration needed (different from branch) –Special LR value could be stored (0xFFFFFFFx) Tail chaining –When new exception occurs –But CPU handling another exception of same/higher priority –New exception will enter pending state –But will be executed before register unstacking –Saving unnecessary unstacking/stacking operations –Can reenter hander in as little as 6 cycles Late arrivals (ok, so this is actually on entry) –When one exception occurs and stacking commences –Then another exception occurs before stacking completes –And second exception of higher preempt priority arrives –The later exception will be processed first

Other stuff: The xPSR register layout 24

Example of Complexity: The Reset Interrupt 1)No power 2)System is held in RESET as long as VCC15 < 0.8V a)In reset: registers forced to default b)RC-Osc begins to oscillate c)MSS_CCC drives RC-Osc/4 into FCLK d)PORESET_N is held low 3)Once VCC15GOOD, PORESET_N goes high a)MSS reads from eNVM address 0x0 and 0x4 25

Interrupt types Two main types –Level-triggered –Edge-triggered 26

Level-triggered interrupts Signaled by asserting a line low or high Interrupting device drives line low or high and holds it there until it is serviced Device deasserts when directed to or after serviced Can share the line among multiple devices (w/ OD+PU) Active devices assert the line Inactive devices let the line float Easy to share line w/o losing interrupts But servicing increases CPU load  example And requires CPU to keep cycling through to check Different ISR costs suggests careful ordering of ISR checks Can’t detect a new interrupt when one is already asserted 27

Edge-triggered interrupts Signaled by a level *transition* (e.g. rising/falling edge) Interrupting device drive a pulse (train) onto INT line What if the pulse is too short? Need a pulse extender! Sharing *is* possible...under some circumstances INT line has a pull up and all devices are OC/OD. Devices *pulse* lines Could we miss an interrupt? Maybe...if close in time What happens if interrupts merge? Need one more ISR pass Must check trailing edge of interrupt Easy to detect "new interrupts” Benefits: more immune to unserviceable interrupts Pitfalls: spurious edges, missed edges Source of "lockups" in early computers 28