Interrupt and Exception Programming

Slides:



Advertisements
Similar presentations
ECE 353 Introduction to Microprocessor Systems
Advertisements

Lab III Real-Time Embedded Operating System for a SoC System.
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4
Cortex-M3 Exceptions and Interrupts
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
LOGO Chapter 1 Interrupt handling. hardware interrupt Under x86, hardware interrupts are called IRQ's. When the CPU receives an interrupt, it stops whatever.
The Cortex-M3 Embedded Systems: The Cortex-M3 Processor Basics
The ARM Programmer’s Model
Cortex-M3 Debugging System
Exception and Interrupt Handling
Introduction to Embedded Systems
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Lecture 23: LM3S9B96 Microcontroller - Interrupts.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
Cortex-M4 Exceptions and Interrupts
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
7/23 Interrupt Controller and Edge Port in Coldfire Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
1 General Purpose and Alternate Function I/O (GPIO and AFIO)
ARM Cortex-M0 August 23, 2012 Paul Nickelsberg Orchid Technologies Engineering and Consulting, Inc. CORTEX-M0 Structure Discussion.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
Renesas Electronics America Inc. © 2011 Renesas Electronics America Inc. All rights reserved. RX Interrupt Control Unit (ICU) Ver
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Interrupts Refer to Chapter 4 in the reference book “Stellaris® LM3S9B96 Microcontroller - DATA.
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.
Interrupt 마이크로 프로세서 (Micro Processor) 2015년 2학기 충북대학교 전자공학과 박 찬식
Exceptions and Interrupts Chap 7, 8 Tae-min Hwang.
Chapter 10 Interrupts. Basic Concepts in Interrupts  An interrupt is a communication process set up in a microprocessor or microcontroller in which:
1 The LPC1768 Architecture (with focus on Cortex-M3)
A walk through interrupts on the PPC 823
-Low Power and System Control Features
ARM Cortex M3 & M4 Chapter 4 - Architecture
Chapter 11 INTERRUPTS PROGRAMMING
Interrupts and exceptions
Interrupt and Exception Programming
Processor States normal exception
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
Refer to Chapter 7, 8, 9 in the reference book
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.
Anton Burtsev February, 2017
ARM Cortex-M3 RTLAB 박 유 진.
Interrupts In 8085 and 8086.
Interrupts – (Chapter 12)
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Lab 5 – Interrupts vs Polling
Interrupt and Exception Programming
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
Interrupt and Exception Programming
YOVI 2008 Core Interrupt Controller (INTC)
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /20/2018.
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
Lecture 18 Interrupt 동국대학교 홍유표.
Interrupt and Exception Programming
8259 Programmable Interrupt Controller
COMPUTER PERIPHERALS AND INTERFACES
Lecture 9: TI MSP430 Interrupts & Low Power Modes
Interrupts.
CNET 315 Microprocessor & Assembly Language
Interrupt and Exception Programming
CORTEX-M0 Structure Discussion 1
Basic Instruction Cycle
PIC18 Interrupt Programming
Computer System Overview
Architectural Support for OS
COMP3221: Microprocessors and Embedded Systems
Chapter 13: I/O Systems.
Presentation transcript:

Interrupt and Exception Programming Chapter 6 Interrupt and Exception Programming

Polling vs. Interrupts

NVIC in ARM Cortex-M

Interrupt Vector Table for Arm Cortex-M4 Memory Location (Hex)   Stack Pointer initial value 0x00000000 1 Reset 0x00000004 2 NMI 0x00000008 3 Hard Fault 0x0000000C 4 Memory Management Fault 0x00000010 5 Bus Fault 0x00000014 6 Usage Fault (undefined instructions, divide by zero, unaligned memory access,...) 0x00000018 7 Reserved 0x0000001C 8 0x00000020 9 0x00000024 10 0x00000028 11 SVCall 0x0000002C 12 Debug Monitor 0x00000030 13 0x00000034 14 PendSV 0x00000038 15 SysTick 0x0000003C 16 IRQ 0 for peripherals 0x00000040 17 IRQ 1 for peripherals 0x00000044 … 255 IRQ 239 for peripherals 0x000003FC

Going from Reset to Boot Program

Arm Cortex-M Stack Frame upon Interrupt

Main Program gets interrupted

Interrupt Priority for Arm Cortex-M4 Priority Level Stack Pointer initial value   1 Reset -3 Highest 2 NMI -2 3 Hard Fault -1 4 Memory Management Fault Programmable 5 Bus Fault 6 Usage Fault (undefined instructions, divide by zero, unaligned memory access,....) 7 Reserved 8 9 10 11 SVCall 12 Debug Monitor 13 14 PendSV 15 SysTick 16 IRQ 0 for peripherals 17 IRQ 1 for peripherals … 255 IRQ 239 for peripherals

CONTROL Register in Arm Cortex-M4   nPRIV (Privilege): Defines the Thread mode privilege level 0: Privileged 1: Unprivileged Active Stack Pointer (ASP): Defines the currently active stack pointer (ASP = SPSEL) 0: MSP is the current stack pointer. 1: PSP is the current stack pointer. Floating Point Context Active (FPCA) 0: No floating point context active. 1: Floating point context active.

Privileged level Execution and Processor Modes in Arm Cortex-M Software Privilege level Thread Applications Privileged and Unprivileged Handler ISR for Exceptions and IRQs Always Privileged In Thread mode, use bit 0 of the CONTROL register to select Privileged or Unprivileged

Processor Modes and Stack Usage in Arm Cortex-M Software Stack Usage Thread Applications MSP or PSP Handler ISR for Exceptions and IRQs MSP Note: In Thread mode, use bit 1 of the Control register to select MSP or PSP for stack pointer.

Processor Mode, Privilege, and Stack in Arm Cortex Stack Pointer Typical Example usage Handler Privileged Main Exception Handling Unprivileged Any Reserved since Handler is always Privileged Thread Operating system kernel Process   Application threads

Arm Cortex-M Registers

Special function registers of Arm Cortex-M Register name Privilege Usage MSP (main stack pointer) Privileged PSP (processor stack pointer) Privileged or Unprivileged PSR (Processor status register) APSR (application processor status register) ISPR (interrupt processor status register) EPSR (execution processor status register) PRIMASK (Priority Mask register) FAULTMASK(fault mask register) BASEPRI (base priority register) CONTROL (control register) Note: We must use MSR and MRS instructions to access the above registers

IRQ assignment in STM32F4xx (Partial Listing – For complete list see STM32F4 ref. manual)

External Interrupts Assignments to various Ports

External interrupt/event GPIO mapping

Associations of I/O pins to EXTINT signals (External interrupt/event GPIO mapping)

Interrupt Mask Register (EXTI_IMR)

Pending Interrupt Register (EXTI_PR)

SYSCFG external interrupt configuration register 1 (SYSCFG_EXTICR1)

Rising trigger selection register (EXTI_RTSR)

Falling trigger selection register (EXTI_FTSR)

Set Enable Register (ISER[1]) for IRQ 32–63

Clear Enable Register (ICER[1]) for IRQ 32–63

Enabling and Disabling an Interrupt

USARTx_CR1 to Enable Register to Enable RX interrupt

SysTick Internal Structure

SysTick Control and Status Register (SYST_CSR)

TIMx DMA/Interrupt enable register (TIMx_DIER) to Enbale Timer interrupt

IPRn Registers