Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device.

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.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
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.
Lab 3 Details. Lab 3 Develop a bio-feedback system based on a PWM (pulse width modulated) thermal sensor Use temperature setting to control the delays.
The planned but unexpected Program Sequencer controls program flow and provides the next instruction to be executed Interrupt – causing and handling.
6/2/2015 Labs in ENCM415. Laboratory 2 PF control, Copyright M. Smith, ECE, University of Calgary, Canada 1 Temperature Sensor Laboratory 2 Part 2 – Developing.
Building a simple loop using Blackfin assembly code M. Smith, Electrical and Computer Engineering, University of Calgary, Canada.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin There is always a “MAKE-UP-YOUR-QUESTION-AND-ANSWER-IT” Question on a Dr. Smith.
Developing a bicycle speed-o-meter Part 2 A comparison between the Analog Devices ADSP-BF533 (Blackfin) and Motorola MC68332.
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.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
Core Timer Code Development How you could have done the Take- Home Quiz using a test driven development (TDD) approach.
Specialized Video (8-bit) and Vector (16-bit) Instructions on the Blackfin Expand on these ideas for Q9 question and answer on the final.
LCD programming Design and implementation details on the way to a valid SPI-LCD interface driver.
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.
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
Understanding the Blackfin ADSP-BF5XX Assembly Code Format
A look at interrupts What are interrupts and why are they needed.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Laboratory 1 – ENCM415 Familiarization with the Analog Devices’ VisualDSP++ Integrated Development Environment.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Developing a bicycle speed-o-meter Midterm Review.
Input Laboratory: GPIO Pin control needed to have the Blackfin accept your commands Re-uses information from ENEL353 and ENCM369 courses and text books.
Blackfin Timers Independent timers build into the processor Watchdog Timer is a major part of Lab. 2 (Code provided to you to use)
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.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
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.
Multi-threaded projects Services and Drivers Alternate ways of doing Labs 1, 2, 3 and 4.
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
Building a simple loop using Blackfin assembly code If you can handle the while-loop correctly in assembly code on any processor, then most of the other.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
“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,
Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and.
Developing a bicycle speed-o-meter
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
A Play Core Timer Interrupts
SPI Compatible Devices
Thermal arm-wrestling
DMA example Video image manipulation
The planned and expected
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
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
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
Expand on these ideas for Q9 question and answer on the final
Thermal arm-wrestling
Concept of TDD Test Driven Development
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.
DMA example Video image manipulation
Developing a bicycle speed-o-meter
Blackfin Timers Independent timers build into the processor
Independent timers build into the processor
Developing a bicycle speed-o-meter
Developing a bicycle speed-o-meter
Thermal arm-wrestling
Building a simple loop using Blackfin assembly code
Developing a bicycle speed-o-meter Part 2
Developing a reliable communication between Blackfin and Slave device
Post Lab Quiz 3 Review Assignment 2 Help
Presentation transcript:

Thermal arm-wrestling Design of a video game using two programmable flags (PF) interrupts Tutorial on handling 2 Hardware interrupts from an external device that cause the same IVG12 PF- Interrupt A

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada2 / 24 + extras Problem to be solved Customer game concept I WINYOU WIN Has two TMP03 thermal sensors and a ready signal (LED) At the ready signal – the two players have to use bio-feedback to move the cursor into the winning area Three play modes One person player – moves the cursor with one sensor One person player – controls the cursor with two sensors sort of EXO-Sketch mode Game mode – two players Sensor reading is determined by the difference in temperature NOW compared to the temperature at the ready signal

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada3 / 24 + extras Customer game plan Player1_TemperatureNow, and Player1_TemperatureStart Ditto player 2 While not started { Determine Player1 Temperature, Player2 temperature Update Game Screen with start information } Cursor is centered – update Game screen While nobody has won { Determine Player1 Temperature, Player2 temperature Determine Player1, player2 difference in temperature if player1 difference larger then decrease cursor, else cursor ++ Update Game screen Determine if somebody has won } Display winning message

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada4 / 24 + extras 5 – Need to handle the “true PF registers” to generate a hardware interrupt Functions needed  unsigned long int SetPFInterruptsASM( ??) Returns old interrupt settings Set new settings  void StartPFInterruptsASM(???)  void StopPFSettingsASM(???)  Hardware information Chapter 14

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada5 / 24 + extras PF registers  Direction, Data, Polarity and Enable all from Lab. 2  Flag Mask registers – Flag mask Interrupt data register – basically which PF pins have been set to allow to cause interrupt Flag mask Interrupt Set register – sets PF pin that is allowed to cause an interrupt, without the need for a read – or mask – write operation Flag Mask Interrupt Clear register – which PF pin is no longer allowed to cause an interrupt without the need for a read – and mask – write operation Flag interrupt Sensitivity register (FIO_EDGE) – set for edge-sensitive – also need FIO_BOTH

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada6 / 24 + extras 6 – Build a test to show that write the needed code (in ASM) to set up the PF interrupts Registers described in Chapter 14  Stop all interrupts for the moment – CLI instruction  Need to set FIO_MASKA_D bits 1 Write only needed if “set” using FIO_MASK_S register  Need to set FIO_POLAR for active rising edge – Lab 2 code 1 read – then mask – then 1 write  Need to set FIO_INEN (R – mask – W)  Need to set FIO_DIR (R – mask – W)  Need to clear FIO_FLAG_D so that don’t think interrupt already happened (1W if use FIO_FLAG_C register approach))  Need to set FIO_EDGE and FIO_BOTH (2R – mask 2W)  Restart interrupts – STI instruction – but with PF interrupt stopped Possibility that missing stuff since first time tried this

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada7 / 24 + extras First Test for Set up PF interrupts

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada8 / 24 + extras Need to do code review  After fixing the error – get this result  Check code – need to return old interrupt level FIO_MASKA_D – that requires a read that I had not designed in – change the test

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada9 / 24 + extras Move onto setting FIO_FLAG registers

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada10 / 24 + extras Check Ability to turn off PF interrupts

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada11 / 24 + extras Test for interrupts using switches PF interrupts active NOTHING HAPPENING SYSTEM IS HUNG

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada12 / 24 + extras Turns out – missing stuff in set up  IMASK -- Page 4-33 Global register – allows IVG12 interrupts to occur  SIC_IMASK – Page 4-28 System interrupt mask – especially for peripheral devices Enabling PF Interrupt A during SetUpPFInterrupts( ) fixed the problem of getting INTO interrupts – but the function never came out BECAUSE  Bit 11 of FIO_FLAG_D MUST BE CLEARED inside interrupt service routine – clearing the interrupt bit!!!!!!

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada13 / 24 + extras What is the necessary code for the C++ interrupt service routine to handle the PF11 interrupts?  Add your code here  Essentially 3 lines of code needed

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada14 / 24 + extras Add this stage  Either PF11 interrupt  Need PF10 interrupt  Need both

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada15 / 24 + extras Core timer interrupt PF interrupt  Core timer interrupt register_handler(ik_timer, CoreTimerISR)  PF11 interrupt register_handler(ik_ivg12, PF11_ISR);  PF10 interrupt register_handler(ik_ivg12, PF10_ISR);  If Core timer and PF11 interrupts occurred – different interrupt levels  If Core timer and PF10 interrupts occurred – different interrupt levels  If PF11 and PF10 interrupts occurred – SAME interrupt level

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada16 / 24 + extras PF11 and PF10 interrupt PF interrupt PF11 and PF10 interrupt register_handler(ik_ivg12, PF_ISR); ISR code must look like this EX_INTERRUPT_HANDLER(PF_ISR) {  If this interrupt was caused by PF11 interrupt – then do this action – CalculatePF11Temperature( );  But if this interrupt was caused by PF10 interrupt – then do this action – CalculatePF10Temperature( );  Clear the correct interrupt flag so the ISR can exit properly }

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada17 / 24 + extras What hardware register can tell us which of the two PF lines caused an interrupt?  See hardware manual on page for the information

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada18 / 24 + extras What is the necessary code for the C++ interrupt service routine to handle the PF10 interrupts?  Add your code here  Essentially 3 lines of code needed

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada19 / 24 + extras PF11 interrupt test

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada20 / 24 + extras PF10 test

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada21 / 24 + extras Can handle both PF10 and PF11 interrupts – but ISR can’t tell the different

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada22 / 24 + extras Can handle both PF10 and PF11 interrupts – but ISR CAN tell the different

6/2/2015 Thermal Arm Wrestling, Copyright M. Smith, ECE, University of Calgary, Canada23 / 24 + extras  Information taken from Analog Devices On-line Manuals with permission s/ s/  Information furnished by Analog Devices is believed to be accurate and reliable. However, Analog Devices assumes no responsibility for its use or for any infringement of any patent other rights of any third party which may result from its use. No license is granted by implication or otherwise under any patent or patent right of Analog Devices. Copyright  Analog Devices, Inc. All rights reserved.