Resets & Interrupts.

Slides:



Advertisements
Similar presentations
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
Advertisements

MC68HC11 System Overview. System block diagram (A8 version)
External Interrupt Module MTT EXTERNAL INTERRUPT REQUEST MODULE (IRQ)
68HC11 Polling and Interrupts
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
1 TK2633TK Microprocessor Architecture DR MASRI AYOB.
Chapter 6 Interrupts and Resets
1 Reset and Interrupts Advanced Programming. 2 Resets and Interrupts See the Reset and Interrupts Section in the 68HC11E Family Technical Data Sheet (pp.79-96)
GURSHARAN SINGH TATLA PIN DIAGRAM OF 8085 GURSHARAN SINGH TATLA
Monitor ROM Module MTT48 V MONITOR ROM MODULE (MON)
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
Ch. 9 Interrupt Programming and Real-Time Sysstems From Valvano’s Introduction to Embedded Systems.
System Clocks.
Week #5 General Interfacing Techniques
Chapter 6: Interrupts and Resets
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
Nurudeen Olayiwola Thomas Gutierrez
ME 4447/6405 Interrupts and Resets Suzanne Price Scott Gilliliand Greg Graf.
Interrupts and reset operations. Overview  Introduction to interrupts – What are they – How are they used  68HC11 interrupt mechanisms – Types of interrupts.
Lecture 11 Low Power Modes & Watchdog Timers
Low Power Modes MTT48 V LOW POWER OPERATION.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
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.
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
System Integration Module MTT Motoola SYSTEM INTEGRATION MODULE (SIM)
MICRO-CONTROLLER MOTOROLA HCS12 Interrupts Mechatronics Department Faculty of Engineering Ain Shams University.
Resets & Interrupts MTT CPU08 Core Motorola CPU08 RESETS & INTERRUPTS.
Razvan Bogdan Embedded Systems
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Computer Operating Properly Module MTT COMPUTER OPERATING PROPERLY MODULE (COP)
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Unit Microprocessor.
HCS12 Exceptions Maskable Interrupts
COURSE OUTCOMES OF Microprocessor and programming
8085 INTRODUCTION The features of INTEL 8085 are :
Everybody.
ECE 3430 – Intro to Microcomputer Systems
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
ECE 3430 – Intro to Microcomputer Systems
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.
The process starts from the I/O device
Timer and Interrupts.
Refer to Chapter 5 in the reference book
Introduction to microprocessor (Continued) Unit 1 Lecture 2
CPU Sequencing 6/30/2018.
Interrupts In 8085 and 8086.
Introduction of microprocessor
Dr. Michael Nasief Lecture 2
8085 Microprocessor Architecture
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
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 동국대학교 홍유표.
8085 Microprocessor Architecture
전자의료시스템 및 실습 System Configuration/Interrupt
X1 & X2 These are also called Crystal Input Pins.
COMPUTER PERIPHERALS AND INTERFACES
Interrupts.
Interrupts 1/18/2019.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
8085 Microprocessor Architecture
Register sets The register section/array consists completely of circuitry used to temporarily store data or program codes until they are sent to the.
CPU Sequencing 7/20/2019.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Presentation transcript:

Resets & Interrupts

• Power-On Reset • External Hardware Reset • Crystal Monitor • Computer Operating Properly Real time interrupt

Power On Reset • Initiated by positive transition on VDD. 8192 E clock delay is built in to allow oscillator to stabilize. 8192 ECLK Cycles 64 ECLK Cycles 128 ECLK Cycles VDD CPU CLK DATA BUS/ ADDRESS BUS IRESET V F P P P FFFE FFFE 1st Opcode 2nd Opcode 3rd Opcode V - VECTOR FETCH F - FREE CYCLE P - PROGRAM FETCH Internal Reset is held low by MCU For about 8192 E clocks • In General: Subsystems and control bits are initialized to have least effect on system ( I.e. interrupts masked, ports read only, serial communication disabled,...)

External & Internal Resets 96 E Clocks 64 ECLK CYCLES 32 ECLK CYCLES CPU CLK DATA BUS/ ADDRESS BUS RESET IRESET FFFE FFFE 1st Opcode 2nd Opcode 3nd Opcode SAMPLE PIN • RESET pin asserted for > 2 E clocks. • RESET pin must negate before reset service can begin. • No delay to stabilize oscillator.

Crystal Monitor (1 of 2) Useful for: 1. Automatic Reset from a slow or stopped clock. 2. Improves fault tolerance of system. Description: If the E clock drops below a frequency of 10 KHZ* and the Crystal Monitor function has been enabled, then: 1. system reset is asserted on the external reset pin. 2. Crystal Monitor vector is fetched. Else Enter Self Clock Mode if Enabled * IF E CLOCK FREQUENCY > 10KHz and < 500KHz, THEN A CLOCK MONITOR RESET MAY OCCUR. ( NOT GUARANTEED ) Note: Crystal Monitor Time-out range 2usec - 150 usec.

Crystal Monitor (2 of 2) PLLCTL - CRG PLL Control Register Address Offset $0006 CME - Crystal Monitor Enable 1 = Monitor is enabled 0 = Monitor is disabled Crystal Monitor function can be enabled/ disabled at any time. When the Crystal Monitor is enabled, a slow or stopped clocks, (including the Stop instruction) causes a crystal failure to: 1. Reset the MCU (Fetch CM Vector from $FFFC-$FFFD) or 2. Enter self-clock mode PINS: 1. RESET – Asserted for 64 E clocks.

Crystal Loss/Stop & Reset Recovery Sequence Stop Instruction Clock Failed Power-On CME = 1 & SCME =0 ? CME = 1 & SCME =0 ? Yes Yes MCU Resets MCU Resets No No Stop Mode Interrupt ? Clock ? No No Count 8192 OSCLK Note2:Self Clock Mode Frequency Range = 2.5MHZ - 5.5MHZ Yes Yes SCME =1 ? Clock ? Yes No Assert SCM & SCMIF No Yes Clock ? MCU Enters Self CM No Wait for Clock Yes Note1:Crystal Monitor Timeout Range 6 - 18.5 us Count 8192 OSCLK Count 8192 OSCLK Yes Clock ? No Clocks Released Negate SCM Clocks resume Normal Operation Resume Normal Operation

Computer Operating Properly (1 of 3) Useful for: 1. Insuring that the MCU does not get "hung up" for an extended period of time. 2. Improves fault tolerance of system. Description: If the COP rate select bits are not “0” and if the watchdog timer is not reset within a specified time period: 1. Then a system reset is asserted on the external reset pin. 2. COP vector is fetched ( $FFFA-$FFFB ) Pins: 1. Reset - Asserted for 64E clocks.

Computer Operating Properly (2 of 3) COPCTL - CRG COP Control Register Address Offset $0008 WCOP - Window COP Mode 1 = Window COP operation (Writes to ARMCOP Register must occur in the last 25% of selected period). 0 = Normal COP operation CR[2:0] - COP Watchdog Timer Rate Select COPCTL : Write Once in user mode, anytime in test mode. A write to COPCTL will initialize COP counter . ARMCOP - CRG COP Arm/Reset Timer Address Offset $000E – Software writes $55 followed by $AA to ARMCOP, to reset internal COP counter. PINS 1. RESET Asserted for 64 E clocks

COP Time-out Period Select (3 OF 3) CR[2:0] = 000 - COP is Off OSCCLK COP Rate Selection Bit Definition COP Divider Chain Time-Out = WindowEnd = OscClkPeriod * (OscClkDivider +3) Window-Start = OscClkPeriod * ((0.75* OscClkDivider) + 9)

Determining Reset Source CLOCK N START FAILS CME=1 ? END Y GO TO GO TO CRYSTAL MONITOR ROUTINE GO TO COP ROUTINE RESET SERVICE ROUTINE ASSERT CLOCK RESET PIN MONITOR FOR 64 STATUS IS E-CLOCK EXTERNALLY LATCHED CYCLES ASSERTED RESET Y Y RESET PIN RESET PIN STILL LOW ? CRYSTAL MONITOR SYSTEM RESET ? N NEGATION, N 32 E-CLOCK CYCLES ALLOWED RESET PIN STILL LOW?

INTERRUPT INSTRUCTIONS INTERRUPT EXCEPTIONS INTERRUPT STACK PRIORITIES VECTORS INTERRUPT FLOW INTERRUPT INSTRUCTIONS STANDBY MODES

Interrupt Sources INTERNAL BUS EXTERNAL BUS The MC9S12DP256 From COP From P.I.T From Crystal Monitor EXTERNAL BUS INTERNAL BUS C.M RESET COP RESET P.I.T IRQ ECT IRQ’S SPI IRQ’S SCI IRQ’S Other IRQ’S Resets SWI ILLOP I_Vector X_Vector IPEND XPEND IRQ XIRQ RESET INTERRUPT & RESET VECTOR GENERATION PRIORITY The MC9S12DP256 can generate over 50 Interrupt requests

Interrupt Stacking Order SP after operation SP-9 CCR SP-8 D SP-6 X SP-4 Y SP-2 PC SP before operation SP xx When HCS12 acknowledges an interrupt, it stacks registers, then determines which vector to take. ( different from hc11 ). Note: Stack operation is performed in 5-bus cycles even if SP is misaligned.

Non-Maskable Exception Priority • More than 40 interrupt sources. • Separate vector for each Reset / Interrupt source. • 6 Non-Maskable sources 1. RESET 2. Crystal Monitor* 3. COP WATCHDOG* 4. TRAP 5. XIRQ** 6. SWI * Can generate external Reset ** Once enabled, cannot be masked

Interrupt Vector Table (1 of 3) (64 Exception Vector Entries)

Interrupt Vector Table (2 of 3)

Interrupt Vector Table (3 of 3)

Interrupt Request Pins Control HCS12 IRQ - Masked by I-Bit in CCR XIRQ - Masked by X-Bit in CCR* * Once enabled, can not be masked INTCR - Interrupt Control Register Address Offset $001E Write once IRQE - Interrupt Select Edge Sensitive 1 = IRQ PIN is configured for negative edge 0 = IRQ PIN is configured for level sensitive IRQEN - External IRQ Enable 1 = IRQ PIN is connected to interrupt logic 0 = IRQ PIN is disconnected from interrupt logic Note: XIRQ and IRQ have internal pull-ups and enabled out of reset Pull-up can be turned off by clearing PUPEE in PUCR register

Interrupt & Priority Control An interrupt source can be elevated to highest priority( i.e. 7 ) by writing to HPRIO register ( bits 7 - 1 ). Interrupt priority can only be changed when I = 1 in CCR HPRIO - High Priority Register Address Offset $001F To promote an interrupt the user writes the least significant byte of the associated interrupt vector address to this register. If an unimplemented vector address or a non I-masked vector address (value higher than $F2) is written, then $FFF2 vector will be the default. (highest priority interrupt).

Interrupt Flow SOFTWARE HARDWARE INTERRUPT INTERRUPT N STACK MPU Y MASK REGISTER CONTINUE MAIN SET? CONTENTS PROGRAM SET I BIT IN CCR $FF80 LOAD INTERRUPT VECTOR INTO VECTOR TABLE PROGRAM COUNTER $FFFF EXECUTE INTERRUPT SERVICE ROUTINE

Interrupt Instructions FUNCTION MNEMONIC OPERATION SOFTWARE INTERRUPT SWI REGS M  SP SP-9 SP  1 I  M PC FFF6  H M PC  FFF7 L RETURN FROM INTERRUPT RTI M REGS SP  SP + 9 SP  Note: RTI instruction will not unstack if another interrupt is pending.

Real-Time Interrupt Useful for: 1. Keep track of time 2. Initiate tasks on periodic bases. Description: When a time-out occurs: 1. Interrupt request to CPU is generated, if enabled 2. RTI vector is fetched ( $FFF0-$FFF1 )

Real-Time Interrupt Flow Chart COUNT IS AT AN INTERVAL ? INCREMENT INTERNAL COUNTER Y RTIF GOES to 1 START N N END RTIE=1 ? Y ASSERT INTERRUPT

Real-Time Control/Status Registers RTICTL - Real-Time Clock Control Register Address Offset $0007 Bit 7 6 5 4 3 2 1 0 Reset: 0 0 0 0 0 0 0 0 OSCCLK RTR[6:4] - Real-Time Interrupt Prescale Rate Select RTR[3:0] - Real-Time Interrupt Modulus Counter Select RTI Divider Chain Note: To initialize the internal RTI counter, write to the RTICTL register.

PLL Control Registers CRGFLG - CRG Flag Register Address Offset $0003 RTIF — Real Time Interrupt Flag RTIF bit is automatically set to one at the end of every RTI period. This flag can only be cleared by writing a 1. 0 = Time-out has not yet occurred. 1 = Set when the time-out period is met. CRGINT - CRG Interrupt Enable Register Address Offset $0004 RTIE - Real-Time Interrupt Enable 0 = Interrupt is disabled 1 = Interrupt is disabled

S12 Oscillator Layout Oscillator components on MCU side of board - no vias No ground or power planes under Oscillator components, to minimise parasitics.* Optional dc blocking capacitor goes in the EXTAL line here RESET signal noise free. Don’t use for external signals and / or add series filtering. PLL Filter cct C2 C1 Y1 R2 C3 TEST XTAL EXTAL VSSPLL C4 XFC VDDPLL No other signals should be routed near, or under the crystal components or the PLL components because these circuit nodes are very susceptible to coupled electric noise. RESET To 5V ‘star’ point at VSSA C5 C6 C7 VDDR VSSR C8 C9 PE4 Good isolation of PLL / Oscillator Power supply. C5 = 1nf, C6 = 100nF. Low impedance, no vias. * NOTE: EMC considerations should also be taken into consideration Connection to ground net/plane