A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.

Slides:



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

Lab. 2 Overview. Lab. 2 and Assignment 3 Many Lab. 2 and Assignment 3 tasks involve “downloading” provided code, compiling and linking into a project.
A look at interrupts What are interrupts and why are they needed.
Embedded System Timers Details of independent timers build into the Blackfin Assignment 2-- Watchdog Timer can be used to prevent the OS system from locking.
ECE 372 – Microcontroller Design Parallel IO Ports - Interrupts
Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Introduction to Microprossor Topic : Pin function.
Assignment Overview Thermal oscillator One of the ENCM415 Laboratory 2 items Oscillator out GND +5V.
The planned but unexpected Program Sequencer controls program flow and provides the next instruction to be executed Interrupt – causing and handling.
6/2/20151 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items.
Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device.
Review of Blackfin Syntax Moves and Adds 1) What we already know and have to remember to apply 2) What we need to learn.
Lab. 2 – More details – Tasks 4 to 6 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have.
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
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.
Lab. 2 Overview 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have that knowledge?
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
A look at interrupts What are interrupts and why are they needed.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
ARM Timers.
Blackfin Timers Independent timers build into the processor Watchdog Timer is a major part of Lab. 2 (Code provided to you to use)
M. Smith University of Calgary.  Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device.
M. Smith University of Calgary.  Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system Manual control of RC car.
Timer Timer is a device, which counts the input at regular interval (δT) using clock pulses at its input. The counts increment on each pulse and store.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Lab. 2 Overview. Echo Switches to LED Lab1 Task 7 12/4/2015 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada 2 / 28.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
A first attempt at learning about optimizing the TigerSHARC code TigerSHARC assembly syntax.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
Assignment 4 / Lab. 3 Convert C++ ISR to ASM AND GET IT TO WORK Doing Assignment 4 / Lab. 3 the Test Driven Development way.
“Lab. 5” – Updating Lab. 3 to use DMA Test we understand DMA by using some simple memory to memory DMA Make life more interesting, since hardware is involved,
UNIT – Microcontroller.
ECE 3430 – Intro to Microcomputer Systems
Lab. 2 Overview.
A Play Core Timer Interrupts
Thermal arm-wrestling
Programmable Interval timer 8253 / 8254
ENCM K Interrupts Theory and Practice
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Lab. 2 – More details – Later tasks
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Thermal arm-wrestling
Programmable Interval timer 8253 / 8254
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
A Play Lab. 2 Task 8 Core Timer Interrupts
General purpose timers
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
General purpose timers
Thermal arm-wrestling
Explaining issues with DCremoval( )
Blackfin Timers Independent timers build into the Blackfin
Independent timers build into the processor Basis for Lab. 2
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
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.
ECE 3430 – Intro to Microcomputer Systems
Blackfin Timers Independent timers build into the processor
Independent timers build into the processor
Lab. 2 Overview Move the tasks you developed in Lab. 1 into the more controllable TTCOS operating system.
Thermal arm-wrestling
Post Lab Quiz 3 Review Assignment 2 Help
Blackfin Syntax Moves and Adds
Presentation transcript:

A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 2 / 21 Unanswered questions 1.What does “volatile” mean? 2.Why will “optimized code” probably not work if volatile is not used? 3.How do you tell C++ that this function is an ISR and not a standard function? 4.Why do you need to tell C++ that this function is an ISR and not a standard function? 5.What is the difference (in coding) between an ISR and a standard function? 6.How does an interupt get latched, why and where? 7.Why do I have to tell the timer that the interrupt has been serviced, and how do I do it? 8.Remind me to ask Googan to help me with the “human microprocessor example” on Thursday. Task 2 – file 2 (C++ or ASM) extern volatile int foo_flag; Tell “C++” that I am not a function but I am an ISR – interrupt service routine void ISR_count( ) { foo_flag--; Tell the timer that the interrupt has been serviced }

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 3 / 21 Timers available on Blackfin Watchdog timer – Hardware Reference Core timer – Hardware Reference General purpose timers 15-1 –Pulse Width Modulation –Pulse Width Count and Capture –External Event Application of timers to provide code safety and improved version of UseFixedTimeASM( ) Introduction to timer interrupts

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 4 / 21 Act 1 – The MAIN task

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 5 / 21 Main.cpp as assembly code Debug option Number of interrupts checked In loop

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 6 / 21 Main.cpp as assembly code Release option Number of interrupts NOT checked In loop

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 7 / 21 Main.cpp as assembly code Release option “Volatile” used

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 8 / 21 How NOT to add a C++ interrupt service routine Standard return From subroutine

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 9 / 21 How NOT to add a C++ interrupt service routine Since ISR’s can be caused to happen at “ANY” time by external signals you can’t code parameter passing or parameter returning

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 10 / 21 A proper C++ ISR Save and recover of all registers (volatile and nonvolatile) After recovering all registers we need to RTI -- return from interrupt NOT return from subroutine FP? ASTAT? Is saving all registers needed R7 and P1 enough?

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 11 / 21 The Core Timer Registers Core Timer Scale Register TSCALE –Requires ability to communicate with TCOUNT register Core Timer Count Register TCOUNT –Requires ability to count backwards in steps of TSCALE + 1 Core Timer Period Register TPERIOD –Requires ability to communicate with TCOUNT register Core Time Control Register TCNTL –Leadership role – has ability to put timer into low power mode, disable timer, enable auto reload feature which place TPERIOD into TCOUNT whenever TCOUNT reaches zero (causing an interrupts). Has a “sticky bit”

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 12 / 21 Core Timer Action You set Core timer register TSCALE to 0 (decrement by 0 + 1) You set register TPERIOD to 0x2000 You set register TCOUNT to 0x4000 You enable timer using control register TCNTL TCOUNT is decreased by 1 until it reaches 0 (0x4000 system clock ticks) When TCOUNT reaches 1, interrupt is caused and TCOUNT is reloaded with TPERIOD (0x2000) – counts down again

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 13 / 21 The play is about to start

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 14 / 21 Now we need to add the actors Main( ) -- 2 actors Doing something Number_Interrupts ISR routine – 1 actor

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 15 / 21 The play starts The main program and ISR operation will now be demonstrated

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 16 / 21 Now we need to add the actors Timer – 4 parts Core Timer Scale Register TSCALE Core Timer Count Register TCOUNT Core Timer Period Register TPERIOD Core Time Control Register TCNTL

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 17 / 21 Starting the play Attempt 2 Main( ) -- 2 actors Doing something Number_Interrupts ISR routine – 1 actor

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 18 / 21 Important system registers Core interrupt mask register IMASK –Must be super person with ability to stop / start all interrupts in the world –Controls IVTMR interrupt bit Core Interrupt Latch register ILAT –Has ability to remember if interrupt has occurred (been latched) but is being ignored – bits set to zero when interrupt has been accepted Core Interrupt Pending Register IPEND –Read but not written – indicates that interrupt is active or nested

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 19 / 21 Now we need to add the actors Timer – 4 parts Core Timer Scale Register TSCALE Core Timer Count Register TCOUNT Core Timer Period Register TPERIOD Core Time Control Register TCNTL CORE SYSTEM REGISTERS – 1 person with many hands Core interrupt mask register IMASK Core Interrupt Latch register ILAT Core Interrupt Pending Register IPEND

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 20 / 21 Real demonstration Main( ) -- 2 actors Doing something Number_Interrupts ISR routine – 1 actor Timer registers – 4 actors Core registers – 1 actor

6/3/2015 CORE Timer Interrupts -- a play, Copyright M. Smith, ECE, University of Calgary, Canada 21 / 21 Real demonstration Main( ) -- 2 actors Doing something Number_Interrupts ISR routine – 1 actor Timer registers – 4 actors Core registers – 1 actor