AVR1503: Xplain training - XMEGA Programmable Multi Interrupt Controller 8-bit Microcontrollers Application Note Prerequisites

Similar documents
AVR1501: Xplain training XMEGA Timer/Counter 8-bit Microcontrollers Application Note Prerequisites 1 Introduction

AVR1508: Xplain training - XMEGA DAC 8-bit Microcontrollers Application Note Features 1 Introduction

AVR1922: Xplain Board Controller Firmware 8-bit Microcontrollers Application Note Features 1 Introduction

AVR1303: Use and configuration of IR communication module. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1518: XMEGA-A1 Xplained Training - XMEGA Clock System. 8-bit Atmel Microcontrollers. Application Note. Prerequisites.

AVR1315: Accessing the XMEGA EEPROM. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32917: picopower Board getting started. 32-bit Microcontrollers. Application Note. Preliminary. Features. 1 Introduction

AVR32752: Using the AVR32 UC3 Static Memory Controller. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32901: EVKLCD100/EVKLCD101 Hardware User's Guide. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

a clock signal and a bi-directional data signal (SCL, SDA)

AVR532: Migration from ATmega48/88/168 to ATmega48A/88A/168A. 8-bit Microcontrollers. Application Note. 1 Introduction

AVR based 125kHz RFID Evaluation Kit (Re)Programming Guide ATA2270-EK1. Overview. Fuse Settings: ISP Programming

One-channel Toggle-mode Touch Sensor IC with Power Management Functions AT42QT1012. Summary

AVR32401: AVR32 AP7 Linux Interfacing DataFlash. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AT697E. Application Note. Checking AT697E Code for Occurrence of LDF/FPOPd Instructions Sequence with a dependency on an Odd-Numbered Register

AVR1512: XMEGA-A1 Xplained training - XMEGA Basics. 8-bit Atmel Microcontrollers. Application Note. Prerequisites. 1 Introduction

Atmel QT600 Quick Start Guide Touch Solutions

APPLICATION NOTE. Atmel AVR1638: XMEGA RTC Calibration. 8-bit Atmel Microcontrollers. Features. Introduction

Atmel AVR1619: XMEGA-B1 Xplained Demonstration. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AT03160: Migrating Bootloader from ATxmega128A1 to other Atmel XMEGA Devices. Atmel AVR XMEGA. Features.

8-megabyte, 4-megabyte, and 2-megabyte 2.7-volt Only DataFlash Cards AT45DCB008D AT45DCB004D AT45DCB002D. Not Recommended for New Design

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny87 ATtiny167 Automotive

AVR097: Migration between ATmega128 and ATmega1281/ATmega bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR1926: XMEGA-B1 Xplained Getting Started Guide. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

Hardware Prerequisites Atmel Xplained Pro Evaluation Kit Atmel WINC1500 extension USB Micro Cable (TypeA / MicroB)

APPLICATION NOTE. AT03324: Atmel REB212BSMA-EK Quick Start Guide. Atmel MCU Wireless. Introduction

OLED display with pixels resolution Ambient light sensor CPU load Analog filter Quadrature Encoder with push button Digital I/O

Atmel LF-RFID Kit Comparison Chart. Application Note. Atmel LF-RFID Kit Comparison Chart. 1. Description

ATDH2200E Programming Kit... User Guide

AVR32015: AVR32 Studio getting started. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AT91 ARM Thumb Microcontrollers. Application Note. Using the ECC Controller on AT91SAM9260/9263 and AT91SAM7SE Microcontrollers. 1.

8-bit Microcontroller with 2K/4K/8K Bytes In-System Programmable Flash. Appendix A. Preliminary. ATtiny261 ATtiny461 ATtiny861 Automotive

Atmel AVR ATxmega384C3 microcontroller OLED display with 128x32 pixels resolution Analog sensors. Ambient light sensor Temperature sensor

Atmel AVR32847: Migration from/to the UC3L0 64/32/16 from/to the UC3L0 256/ bit Atmel Microcontrollers. Application Note.

AVR32 UC3 Software Framework... User Manual

APPLICATION NOTE. Atmel AT03304: SAM D20 I 2 C Slave Bootloader SAM D20. Description. Features

APPLICATION NOTE. Atmel AT01080: XMEGA E Schematic Checklist. Atmel AVR XMEGA E. Features. Introduction

STK521. User Guide B AVR 01/12

Embedded AVR Microcontroller Including RF Transmitter and Immobilizer LF Functionality for Remote Keyless Entry ATA5795. Summary.

AVR469: MC301 Hardware User Guide. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR4018: Inertial Two (ATAVRSBIN2) Hardware User's Guide. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AVR2131: Lightweight Mesh Getting Started Guide. Atmel MCU Wireless. Features. Description

APPLICATION NOTE. Atmel AT02260: Driving AT42QT1085. Atmel QTouch. Features. Description

CAN, 80C51, AVR, Microcontroller. Application Note

AVR ONE!... Quick-start Guide. EVK Windows 32103C AVR ONE! 02/10

Application Note. Microcontrollers. Using Keil FlashMon Emulator with AT89C51CC01/03 AT89C51CC01/ Summary. 2. Background overview

AVR32817: Getting Started with the 32-bit AVR UC3 Software Framework lwip TCP/IP Stack. 32-bit Microcontrollers. Application Note.

APPLICATION NOTE. Atmel AVR116: Wear Leveling on DataFlash. 32-bit Atmel Microcontrollers. Features. Description. Wear leveling

APPLICATION NOTE. Atmel AVR3009: Driving QTouch Device with I 2 C Interface. Atmel QTouch. Introduction

Atmel CryptoAuthentication Starter Kit

AT91 ARM Thumb-based Microcontroller. Application Note. AT91SAM7X and AT91SAM7XC Microcontroller Series Schematic Check List. 1.

OLED display Sensors readout. Light sensor Temperature sensor

AT03975: Getting Started with SAM L21. Descripton. Features. SMART ARM-Based Microcontroller APPLICATION NOTE

AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

AT17F Series. Application Note. Programming Circuits for AT17F Series Configurators with Xilinx FPGAs. 1. Introduction

APPLICATION NOTE. Atmel AVR057: Internal RC Oscillator Calibration for ATtiny4/5/9/10/20/40. 8-bit Atmel Microcontrollers. Features.

CAN Microcontrollers. Application Note. Migrating from T89C51CC01 to AT89C51CC03. Feature Comparison

AT91 ARM Thumb Microcontrollers. Application Note. AT91 Host Flash Loader. 1. Package Contents. 2. Definition of Terms. 3.

APPLICATION NOTE. Atmel AVR536: Migration from ATmega644 to ATmega644A. 8-bit Atmel Microcontrollers. Introduction

64K (8K x 8) High Speed Parallel EEPROM with Page Write and Software Data Protection AT28HC64BF

Rad Hard FPGA. AT40KEL-DK Design Kit Content. Description. Kit Content. Reference Material. Support

Atmel AVR473: ATAVRSB202 Hardware User Guide. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR1924: XMEGA-A1 Xplained Hardware User's Guide. 8-bit Atmel Microcontrollers. Application Note. Preliminary. Features.

ATA2270-EK1. User Guide

AVR2015: RZRAVEN Quick Start Guide. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AT89ISP Programmer Cable Introduction AT89ISP Programmer Cable Parallel Port Settings Application Note AT89ISP Software AT89ISP Cable polarized

1-megabit (128K x 8) Paged Parallel EEPROM AT28C010

8-bit Microcontroller. Application Note. AVR320: Software SPI Master

Atmel AT697F. Rad-Hard 32-bit SPARC v8 Processor ERRATA SHEET. Active Errata List

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Atmel ATMXT143E touchscreen controller Capacitive touch ITO 320 x 240 pixel LCD display with SPI interface LED backlight

Power Management and Analog Companions (PMAAC) Application Note. AT73C240 Power-On and Power-Off Sequences. 1. Scope. 2. Operating Conditions

Interfacing the internal serial EEPROM

32Kbytes on-chip SRAM. Viterbi decoding and CRC PRIME compliant 128-bit AES encryption Channel sensing and collision pre-detection

Section 5 SERCOM. Tasks SPI. In this section you will learn:

USER GUIDE. ZigBit USB Stick User Guide. Introduction

USER GUIDE. Wireless Production Test Reference Protocol Specification Document. Atmel MCU Wireless. Description

64K (8K x 8) Battery-Voltage Parallel EEPROM with Page Write and Software Data Protection AT28BV64B

APPLICATION NOTE. Atmel AT03261: SAM D20 System Interrupt Driver (SYSTEM INTERRUPT) SAM D20 System Interrupt Driver (SYSTEM INTERRUPT)

Native route discovery algorithm

AT89C51CC03 UART Bootloader

AVR515: Migrating from ATmega48/88/168 and ATmega48P/88P/168P/328P to ATtiny48/88. 8-bit Microcontrollers. Application Note. Features.

Atmel AT697F. Rad-Hard 32-bit SPARC v8 Processor ERRATA SHEET. Active Errata List

AT06467: Getting started with SAM D09/D10/D11. Features. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

SAM4 Reset Controller (RSTC)

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

APPLICATION NOTE. Atmel AT03782: Using Low Power Modes in SAM4N Microcontroller. Atmel 32-bit Microcontroller. Features.

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

APPLICATION NOTE. AT6486: Using DIVAS on SAMC Microcontroller. SMART ARM-Based Microcontroller. Introduction. Features

512K (64K x 8) 3-volt Only Flash Memory AT29LV512

Smart RF Device Family - Getting Started Guide. Features. Description. References ATAN0115 APPLICATION NOTE

Trusted Platform Module AT97SC3203S. SMBus Two-Wire Interface. Summary

QTouch 8-key Touch Sensor IC AT42QT1085. Summary

AT60142H/HT. Rad-Hard 512Kx8 Very Low Power CMOS SRAM ERRATA-SHEET. Active Errata List. Errata History. Abbreviations. 1.

AVR501: Replacing ATtiny15 with ATtiny25. 8-bit Microcontrollers. Application Note PRELIMINARY. Features. 1 Introduction

hex file. The example described in this application note is written for the AT94K using the FPSLIC Starter Kit. Creating a New Project

USER GUIDE EDBG. Description

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

8-bit RISC Microcontroller. Application Note. AVR151: Setup And Use of The SPI

AT73C246-EK1 Evaluation Kit... User Guide

Transcription:

AVR1503: Xplain training - XMEGA Programmable Multi Interrupt Controller Prerequisites Required knowledge Completed AVR1500 XMEGA Basics training Software prerequisites Atmel AVR Studio 4.18 SP2 or later WinAVR/GCC 20100110 or later Hardware prerequisites Xplain evaluation board JTAGICE mkii Estimated completion time: 1.5 hours 8-bit Microcontrollers Application Note 1 Introduction Atmel XMEGA has an advanced Programmable Multi-level Interrupt Controller (PMIC). The PMIC allows control over interrupt priorities and scheduling of interrupts. In this hand-on we will learn more about the Atmel XMEGA Programmable Interrupt Controller. Rev.

2 Introduction to the PMIC Atmel XMEGA has a Programmable Multi-level Interrupt Controller (PMIC). All peripherals can define three different priority levels for interrupts; high, medium or low. Medium level interrupts may interrupt low level interrupt service routines. High level interrupts may interrupt both low and medium level interrupt service routines. Low level interrupts have an optional Round Robin scheme to make sure all interrupts are serviced within a certain amount of time. 3 Overview This training session covers the basic features of the Atmel XMEGA Programmable Multi-level Interrupt Controller (PMIC). The goal of this training is to get you started with simple interrupt handlers, using the priority levels and scheduling features of the PMIC to create robust interrupt controlled applications. Here is a short overview of the tasks in this training: Task 1: Overflow Interrupt This task shows how to create a simple interrupt handler for a timer overflow interrupt. Task 2: Interrupt Levels This task shows how different interrupt levels interact. Task 3: Round Robin This task shows how interrupt priorities can cause starvation of interrupts with lower priority, and how the Round Robin scheduling feature can be used to prevent starvation. GOOD LUCK! 2 AVR1503

AVR1503 4 Task 1: Overflow Interrupt Blinking LEDs are fun, but interrupt controlled blinking LEDs are more fun! This task shows the necessary steps to configure a timer and enable its overflow interrupt to blink an LED for us. The goal for this task is that you know how to: Write an interrupt handler function, and associate it with the corresponding interrupt vector Enable an interrupt source such as a timer s overflow interrupt, and select the interrupt level Configure the PMIC to let through interrupts of a certain level, and to enable interrupts globally TASK: 1. Locate the XMEGA-PMIC folder, find the Task 1 folder and open the OverflowInterrupt.aps project file in Atmel AVR Studio 2. Look through the code and ensure you understand how things are set up 3. Notice how easy it is to change LEDPORT and LEDMASK definitions, if you want another LED port and/or other LEDs than the default one 4. Build the project and start a debug session (click on the Play icon) in AVR Studio 5. Place a breakpoint (F9) inside the interrupt handler, run the code (F5) and observe it stopping at the breakpoint 6. Remove the breakpoint (F9 again) and run the code to see the LED blink 7. Feel free to change interrupt levels, and timer speed. Recompile and run again 3

5 Task 2: Interrupt Levels If an interrupt handler is badly designed and ends up in an endless loop, for instance by doing something stupid like waiting for a switch to be pressed by the user, it halts the entire processor, right? Not quite so with Atmel XMEGA... This task shows how different interrupt levels interact, and how lower level interrupts can easily be interrupted by higher level ones. The goal for this task is that you know how to: Implement several interrupt handlers, and assign different levels to the interrupt sources Enable several interrupt levels in the PMIC Make code that utilizes nested interrupts TASK: 1. Locate the XMEGA-PMIC folder, find the Task 2 folder and open the InterruptLevels.aps project file in Atmel AVR Studio 2. Look through the code and ensure you understand how things are set up 3. Build the project and start a debug session (click on the Play icon) in AVR Studio The code sets up three different interrupt service routines (ISR) with different priority levels. Each ISR blinks a LED, and does not return as long as the corresponding switch is being pressed. 4. Run the code (press F5) to see the code blink the three LEDs. Press the switches to block one of the interrupts and observe higher level interrupts are still running. Also observe that lower level interrupts are blocked 5. Change the interrupt levels. Recompile and run again 4 AVR1503

AVR1503 6 Task 3: Round Robin When several interrupts are assigned the same interrupt level, the interrupt vector number decides the priority. Lower numbers first. What happens if an interrupt takes so much CPU time that interrupts with lower priority never gets to run? Well, they starve unless you enable the Round Robin scheduling scheme of the PMIC. The last interrupt vector that got CPU time will have the lower priority. This task shows how to use the Round Robin scheme to allow two interrupts to execute, even if one of them would take almost 100% CPU time. Note that Round Robin scheduling is only available for low level interrupts. The goal for this task is that you know how to: Turn on and off Round Robin scheduling for low level interrupts Know how to prevent one high rate interrupt from starving another low rate interrupt TASK: 1. Locate the XMEGA-PMIC folder, find the Task 3 folder and open the RoundRobin.aps project file in Atmel AVR Studio 2. Look through the code and ensure you understand how things are set up 3. Build the project and start a debug session in AVR Studio 4. Run the code (press F5) to see the code blink one LED while the other does not get CPU time to blink. Press the switch SW1 to enable Round Robin scheduling and SW0 to turn Round Robin scheduling off. When enabled observe the other LED also getting CPU time to blink 5. Comment away the PMIC.INTPRI = 0; line, recompile, run What happens the next time you release the switch to turn off Round Robin scheduling again, and why? 7 Summary In this training we have looked at the programmable interrupt controller (PMIC). We have seen how you can set up different priorities for interrupts (low, medium, high). We have also seen that the low level interrupts can have different priority schemes (Round Robin or fixed) and what effect this has on the interrupts. 5

8 Resources Atmel XMEGA Manual and Datasheets o http://www.atmel.com/xmega Atmel AVR Studio with help files o http://www.atmel.com/products/avr/ WINAVR GCC compiler o http://winavr.sourceforge.net/ Atmel IAR Embedded Workbench compiler o http://www.iar.com/ 9 Atmel Technical Support Center Atmel has several support channels available: Web portal: http://support.atmel.no/ All Atmel microcontrollers Email: avr@atmel.com All Atmel AVR products Email: avr32@atmel.com All 32-bit AVR products Please register on the web portal to gain access to the following services: Access to a rich FAQ database Easy submission of technical support requests History of all your past support requests Register to receive Atmel microcontrollers newsletters Get information about available trainings and training material 6 AVR1503

Disclaimer Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Unit 1-5 & 16, 19/F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon Hong Kong Tel: (852) 2245-6100 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-en- Yvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Product Contact Web Site www.atmel.com Technical Support avr@atmel.com Sales Contact www.atmel.com/contacts Literature Request www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. 2010 Atmel Corporation. All rights reserved. Atmel, Atmel logo and combinations thereof, AVR, AVR logo, AVR Studio and others, are the registered trademarks, XMEGA and others are trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.