Atmel AVR32930: UC3-A3 Xplained Getting Started Guide Features • Easy to reprogram with just a USB cable and a preprogrammed boot loader • Easy to debug code with JTAG-based debuggers and emulators 1 Introduction 32-bit Atmel Microcontrollers Application Note The Atmel® UC3-A3 Xplained evaluation kit is a hardware platform for evaluating the Atmel AT32UC3A3256 microcontroller. The kit offers a range of features that enable Atmel AVR® UC3 users to get started using UC3 peripherals right away and understand how to integrate the UC3 device in their own design. This getting started guide will take you through all the basic steps needed to start using the UC3-A3 Xplained evaluation kit. Figure 1-1. UC3-A3 Xplained evaluation kit. Rev. 32163A-AVR-03/11 2 What is needed to get started? To be able to run the preprogrammed code, you need the Atmel UC3-A3 Xplained evaluation kit and a USB cable (Standard-A to Mini-B or Mini-AB) to connect the board to a PC. When connecting the UC3-A3 Xplained board to a PC, the operating system will request a driver file for installing the serial communication driver. This driver file is available in the zip file associated with this document. The driver file supports both the 32- and the 64-bit versions of Windows® XP and Windows 7. Driver installs are not necessary on Linux® operating systems. To modify the example code or to write new code and compile it, you need a toolchain for the Atmel AVR microcontrollers and an integrated development environment (IDE) to edit and debug the code. Atmel provides both Atmel AVR Studio® 4 and Atmel AVR32 GNU Toolchain. Other IDEs and toolchains are also available, such as IAR Embedded Workbench®. If you also want to debug the code at runtime, debuggers like the Atmel AVR JTAGICE mkII or the Atmel AVR ONE! are needed. More information about these tools is available from the Atmel website. 2.1 Documentation for the UC3-A3 Xplained The “AVR32918: UC3-A3 Xplained Hardware User’s Guide” package includes all indepth information about the kit, such as schematics, BOM, assembly drawings, 3D plots, and more. The package is available from the Atmel website. www.atmel.com/xplained 2.2 Atmel AVR Software Framework (ASF) The Atmel AVR Software Framework provides software drivers and libraries to build applications for Atmel AVR devices. It has been designed to help develop and merge the different components of a software design. It can easily integrate into an operating system (OS) or run as a standalone product. The ASF (version 1.7.0) that integrates with Atmel AVR32 Studio can be found here: http://atmel.com/dyn/products/tools_card.asp?tool_id=4192 However, the above framework does not include the latest examples for this kit. The new AVR Software Framework (version 2+) should be used to get the latest software updates, and it can be found here: http://asf.atmel.no/readme.html 2.3 Integrated development environment for Atmel AVR 32-bit microcontrollers 2.3.1 AVR32 Studio The AVR32 Studio is a free integrated development environment (IDE) for developing applications for the Atmel AVR 32-bit microcontrollers. It offers an advanced editor as well as programming and debugging support. Atmel AVR32 Studio http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4116 2 AVR32930 32163A-AVR-03/11 AVR32930 To learn how to use this tool, please read the document: AVR32015: AVR32 Studio getting started http://atmel.com/dyn/resources/prod_documents/doc32086.pdf 2.3.2 IAR Embedded Workbench for Atmel AVR32 IAR Embedded Workbench is an integrated development environment with project management tools and editor. IAR Embedded Workbench for Atmel AVR32 http://www.iar.com/website1/1.0.1.0/124/1/ 2.4 FLIP (BatchISP) BatchISP is a command line tool for programming the flash memory and EEPROM of the board controller, and is part of the FLIP installation. It can be used to communicate with the preprogrammed boot loader on the board controller. FLIP (FLexible In-system Programmer) for programming: http://atmel.com/dyn/products/tools_card.asp?tool_id=3886 2.5 Toolchain In order to build an application from the source code, a toolchain, which includes the assembler, compiler, linker, and other required tools, is needed. The code for this kit is compatible with the AVR32 GNU Toolchain and the IAR™ AVR Toolchain. 2.5.1 Atmel AVR32 GNU Toolchain The AVR32 GNU Toolchain is a free toolchain that can be downloaded from the Atmel website. It includes all the necessary tools, such as C/C++ compiler, assembler and linker, for AVR application development. The toolchain is included in the Atmel AVR32 Studio installation, but it is also available as a separate installation. The toolchain is also available for Linux. For more information about the supported distributions, please see the release notes on the Atmel website. AVR32 GNU toolchain (free C/C++ compiler for AVR 8- and 32-bit MCUs) http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4118 2.5.2 IAR AVR32 Toolchain The IAR AVR32 toolchain is a commercial toolchain from IAR that includes all the necessary tools, such as C/C++ compiler, assembler, and linker, for AVR application development. A 30-day evaluation version as well as a 32K (code size limited) kickstart version are available from the IAR website. IAR Embedded Workbench for Atmel AVR32 http://www.iar.com/website1/1.0.1.0/124/1/ 2.6 Programmers and debuggers Programmers and debuggers are needed when either the application is programmed without using the boot loader, or when debugging support is needed. Several different tools are available that can be used directly with the Xplained kit. The most common tools are described in the following sections. 3 32163A-AVR-03/11 2.6.1 Atmel AVR Dragon AVR Dragon™ is a low-cost debug and programming tool that can be used for code development with the UC3-A3 Xplained kit. Atmel AVR Dragon (on-chip programming and debugging tool) http://atmel.com/dyn/products/tools_card.asp?tool_id=3891 2.6.2 Atmel AVR JTAGICE mkII AVR JTAGICE mkII is a mid-range debug and programming tool that can be used for code development with the UC3-A3 Xplained kit. Atmel AVR JTAGICE mkII (on-chip programming and debugging tool) http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3353 2.6.3 Atmel AVR ONE! AVR ONE! is a high-end debug and programming tool that can be used for code development with the UC3-A3 Xplained kit. Atmel AVR ONE! (on-chip programming and debugging tool) http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4279 4 AVR32930 32163A-AVR-03/11 AVR32930 3 Board overview Figure 3-1 shows the features on the UC3- A3 Xplained board. For more information on the Atmel UC3-A3 Xplained board, please see the Atmel application note, AVR32918: UC3-A3 Xplained Hardware User’s Guide. Figure 3-1. Overview of the UC3-A3 Xplained board. 5 32163A-AVR-03/11 4 Connecting the board Connect a USB cable (Standard-A to Mini-B or Mini-AB) between the board and a PC or a USB power supply to power it up. That is all that is needed. When power is applied, the Power/Status LED will light up green. WARNING Do not power the board without having the jumper or an ammeter mounted on the power measurement header. Otherwise, the device may be damaged. The power measurement header is located next to the USB connector, as shown in Figure 3-1. 4.1 Connecting the Atmel AVR Dragon A 10-pin header cable is needed to connect the AVR Dragon tool to the Atmel UC3A3 Xplained board. Connect the cable between the JTAG connector on the AVR Dragon kit and the UC3-A3 Xplained JTAG connector. Take a look at Figure 4-1 to see how the connection should be made. Figure 4-1. Connecting the AVR Dragon tool to the UC3-A3 Xplained board. 4.2 Connecting the Atmel AVR JTAGICE mkII The grey connector on the AVR JTAGICE mkII probe has to be used when connecting to the UC3-A3 Xplained board. See Figure 4-2 for reference on how to make the connection. The notch of the grey connector must be placed into the cut-out of the board. 6 AVR32930 32163A-AVR-03/11 AVR32930 Figure 4-2. Connecting the Atmel AVR JTAGICE mkII to the UC3-A3 Xplained board. 4.3 Connecting the Atmel AVR ONE! The AVR ONE! JTAG connector can be connected to the UC3-A3 Xplained kit with a standoff adapter, as shown in Figure 4-3. Figure 4-3. Connecting the AVR ONE! to the UC3-A3 Xplained board. 7 32163A-AVR-03/11 5 Programming the kit 5.1 Programming via the boot loader The boot loader is evoked by pushing the physical push button (SW0) during powerup; that is, push the button, and then connect a USB cable to the kit. Programming can be performed by using the BatchISP command line tool, which is part of the FLIP installation. BatchISP can also run under Atmel AVR32 Studio, which has a GUI interface. Once the boot loader is active, it will appear as a USB DFU class device, and Windows will ask for a driver. The driver can be found under the FLIP installation directory. Figure 5-1. The AVR32 Studio AVR Targets menu. To program a new firmware, right-click on the UC3A3 DFU target in the AVR Targets section of AVR32 Studio (see Figure 5-1), and then select “Program…” from the menu (see Figure 5-2). Figure 5-2. The DFU boot loader menu. 8 AVR32930 32163A-AVR-03/11 AVR32930 The following window will appear on the screen: Figure 5-3. The DFU boot loader file select and programming options. Browse and select the .hex file, set up the options as shown here, and click OK. A small progress bar will appear in the lower right corner to indicate that programming is ongoing. When the progress bar stops and disappears, the programming is done, and the application will start automatically. 5.2 Restoring the boot loader If the boot loader has been overwritten or erased, for example by performing a chip erase command, the boot loader can be reprogrammed by using one of the programmer tools described in Section 2.6, Programmers and debuggers. 5.2.1 Reprogramming the boot loader via Atmel AVR32 Studio To reprogram the boot loader, right-click on the target to use in the AVR32 Studio AVR Targets window, as shown in Figure 5-4, and select “Program Bootloader” from the context menu. 9 32163A-AVR-03/11 Figure 5-4. The AVR32 Studio AVR Targets menu. Select the boot loader version to program, as shown in Figure 5-5. Please see the document, AVR32784: AVR32 UC3 USB DFU Bootloader, for more information about the available versions and possible settings for the boot loader. 10 AVR32930 32163A-AVR-03/11 AVR32930 Figure 5-5. The DFU boot loader version selection menu. Set up all the specifications for the boot loader, as shown in Figure 5-6, and select finish to complete the boot loader programming. Figure 5-6. The DFU boot loader options setting menu selections. 11 32163A-AVR-03/11 6 Example applications Several examples are available in ASF that can be downloaded from the Atmel website ASF section: http://asf.atmel.no. Each example has the full source code with documentation, as well as ready-made binaries for getting started quickly. The examples can be compiled using either the GCC or IAR compilers. 6.1 Preprogrammed firmware The Atmel AT32UC3A3256 that is mounted on the Atmel UC3-A3 Xplained board is preprogrammed with a USB boot loader and default demonstration firmware. The preprogrammed firmware in the AT32UC3A3256 is a demonstration of the Atmel QTouch® button and the Atmel QTouch slider. Touching the SW1 QTouch button will cause LED1 to light up. Moving a finger along the QTouch slider will cause either LED2 or LED3 to light up, depending on the position of the finger. The delay at the start of the application is due to an SDRAM check, which is performed each time the kit is powered up. This has been removed in the updated firmware, described in Section 6.2. 6.2 Updated default firmware This application note includes a software package that contains the source code of a demo application. The demo application demonstrates the QTouch functionality of the UC3-A3 Xplained board similar to the pre-programmed default firmware but with two differences: 1) When powered up, the board will not perform the SDRAM check any more since this has been removed from the application. 2) If the slider is touched, the intensity of LED3 will be adjusted according to the touch position on the slider, and LED2 will light up when the slider is touched. 12 AVR32930 32163A-AVR-03/11 AVR32930 7 EVALUATION BOARD/KIT IMPORTANT NOTICE This evaluation board/kit is intended for use for FURTHER ENGINEERING, DEVELOPMENT, DEMONSTRATION, OR EVALUATION PURPOSES ONLY. It is not a finished product, and may not (yet) comply with some or any technical or legal requirements that are applicable to finished products, including, without limitation, directives regarding electromagnetic compatibility, recycling (WEEE), FCC, CE, or UL (except as may be otherwise noted on the board/kit). Atmel supplied this board/kit “AS IS,” without any warranties, with all faults, at the buyer’s and further users’ sole risk. The user assumes all responsibility and liability for proper and safe handling of the goods. Further, the user indemnifies Atmel from all claims arising from the handling or use of the goods. Due to the open construction of the product, it is the user’s responsibility to take any and all appropriate precautions with regard to electrostatic discharge and any other technical or legal concerns. EXCEPT TO THE EXTENT OF THE INDEMNITY SET FORTH ABOVE, NEITHER USER NOR ATMEL SHALL BE LIABLE TO EACH OTHER FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES. No license is granted under any patent right or other intellectual property right of Atmel covering or relating to any machine, process, or combination in which such Atmel products or services might be or are used. Mailing Address: Atmel Corporation, 2325 Orchard Parkway, San Jose, CA 95131 Copyright © 2011, Atmel Corporation 13 32163A-AVR-03/11 8 Table of contents Features ............................................................................................... 1 1 Introduction ...................................................................................... 1 2 What is needed to get started?....................................................... 2 2.1 Documentation for the UC3-A3 Xplained ............................................................ 2 2.2 Atmel AVR Software Framework (ASF) .............................................................. 2 2.3 Integrated development environment for Atmel AVR 32-bit microcontrollers ..... 2 2.3.1 AVR32 Studio............................................................................................................ 2 2.3.2 IAR Embedded Workbench for Atmel AVR32 ........................................................... 3 2.4 FLIP (BatchISP)................................................................................................... 3 2.5 Toolchain ............................................................................................................. 3 2.5.1 Atmel AVR32 GNU Toolchain ................................................................................... 3 2.5.2 IAR AVR32 Toolchain................................................................................................ 3 2.6 Programmers and debuggers.............................................................................. 3 2.6.1 Atmel AVR Dragon .................................................................................................... 4 2.6.2 Atmel AVR JTAGICE mkII ......................................................................................... 4 2.6.3 Atmel AVR ONE! ....................................................................................................... 4 3 Board overview ................................................................................ 5 4 Connecting the board ...................................................................... 6 4.1 Connecting the Atmel AVR Dragon..................................................................... 6 4.2 Connecting the Atmel AVR JTAGICE mkII ......................................................... 6 4.3 Connecting the Atmel AVR ONE!........................................................................ 7 5 Programming the kit ........................................................................ 8 5.1 Programming via the boot loader ........................................................................ 8 5.2 Restoring the boot loader .................................................................................... 9 5.2.1 Reprogramming the boot loader via Atmel AVR32 Studio......................................... 9 6 Example applications .................................................................... 12 6.1 Preprogrammed firmware.................................................................................. 12 6.2 Updated default firmware .................................................................................. 12 7 EVALUATION BOARD/KIT IMPORTANT NOTICE ........................ 13 8 Table of contents ........................................................................... 14 14 AVR32930 32163A-AVR-03/11 Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chou-ku, Tokyo 104-0033 JAPAN Tel: (+81) 3523-3551 Fax: (+81) 3523-7581 © 2011 Atmel Corporation. All rights reserved. / Rev.: CORP072610 ® ® ® ® ® Atmel , Atmel logo and combinations thereof, AVR , AVR logo, AVR Studio , QTouch , and others are registered trademarks or ® trademarks of Atmel Corporation or its subsidiaries. Windows and others are registered trademarks of Microsoft Corporation in U.S. and or other countries. Other terms and product names may be trademarks of others. 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 THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, 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 AND 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 products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. 32163A-AVR-03/11