AVR1927 XMEGA-A1 Xplained Getting Started Guide
AVR1927 XMEGA-A1 Xplained Getting Started Guide
Guide
Features 8-bit
• Easy to reprogram with just a USB cable and a preprogrammed boot loader
• Easy to debug code with JTAG-based debugger/emulator
Microcontrollers
• Can be used with Atmel® AVR® STK®600, Atmel AVR Dragon™, Atmel AVR
JTAGICE mkII, and Atmel AVR ONE!
Application Note
1 Introduction
The Atmel XMEGA-A1 Xplained evaluation kit is a hardware platform for evaluating
the Atmel ATxmega128A1 microcontroller.
The kit offers a range of features that enable the Atmel AVR XMEGA® user to get
started using AVR XMEGA peripherals right away and understand how to integrate
the AVR XMEGA device in their own design. This getting started guide will walk
you through all the basic steps needed to start using the XMEGA-A1 Xplained
evaluation kit.
Rev. 8372A-AVR-04/11
2 What is needed to get started?
To be able to run the preprogrammed code, you need the Atmel XMEGA-A1 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 XMEGA-A1 Xplained 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 32- and 64-bit
versions of Windows® XP and Windows 7. Driver installs are not necessary on Linux®
operating systems.
To modify the example code or write new code and compile it, you need a toolchain
for Atmel AVR microcontrollers and an IDE to edit and debug code. Atmel provides
both the Atmel AVR Studio® 4 and the Atmel AVR GNU Toolchain. Other IDEs and
toolchains are also available, such as the IAR™ Embedded Workbench.
If you also want to debug the code at runtime, you’ll need a debugger like the Atmel
AVR JTAGICE mkII or Atmel AVR ONE! More information on these tools is available
from the Atmel website. See the reference section later in this document for more
details.
2 AVR1927
8372A-AVR-04/11
AVR1927
2.3.2 Embedded Workbench for Atmel AVR
IAR Embedded Workbench® is an integrated development environment with project
management tools and editor.
IAR Embedded Workbench for Atmel AVR
http://www.iar.com/website1/1.0.1.0/107/1/
2.5 Toolchain
In order to build an application from 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 AVR GNU and IAR AVR toolchains.
3
8372A-AVR-04/11
2.6.2 AVR JTAGICE mkII
Atmel AVR JTAGICE mkII is a mid-range debug/programming tool that can be used
for code development with the XMEGA-A1 Xplained kit.
Atmel AVR JTAGICE mkII (on-chip programming and debugging tool)
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3353
4 AVR1927
8372A-AVR-04/11
AVR1927
3 Board overview
Figure 3-1 shows the features available on the board. For more information on the
XMEGA-A1 Xplained hardware, take a look at the Atmel application note AVR1924:
XMEGA-A1 Xplained Hardware User’s Guide.
5
8372A-AVR-04/11
4 Connecting the board
Connect a USB cable 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 attached next to the
USB connector or an ammeter mounted. Otherwise, the device may be
damaged by power sourcing through I/O pins. The power measurement
header is located next to the USB connector, as shown in Figure 3-1.
6 AVR1927
8372A-AVR-04/11
AVR1927
Figure 4-2. Connecting the AVR JTAGICE mkII probe to an Xplained board.
7
8372A-AVR-04/11
5 Programming the kit
5.1.1 Prerequisite
To program the device, you need BatchISP, which can be found under the FLIP
installation directory. You need to install FLIP version 3.4.2 or later.
To program the new firmware into the device using BatchISP, you need to have the
UART-to-USB gateway in the board controller intact.
FLIP needs an XML configuration file for the device. If using FLIP v3.4.2, the XML
configuration file is not included. Copy the XML file from the zip file associated with
this application note, and put the file in the Flip 3.4.2\bin\PartDescriptionFiles
installation directory.
8 AVR1927
8372A-AVR-04/11
AVR1927
4. Run the command below using the correct COM port:
Batchisp -device ATXMEGA128A1
-hardware RS232
-port COM19
-baudrate 115200
–operation onfail abort
memory flash
erase f
blankcheck
loadbuffer your_firmware_file.hex
program verify
start reset 0
5. Your firmware should now be running.
NOTE The boot loader can only be synchronized once after power-up, which means that you
can only connect to the target once using BatchISP. If you were not able to do
everything you needed to do on the first try, you will need to power cycle the board
and run the command again. An example of programming the device via the boot
loader can be seen in Figure 5-2.
The boot loader supports reading and writing of the following memories:
• Flash (0x00000 - 0x1FFFF, application section of the flash)
• EEPROM (0x000 - 0x7FF)
• User (0x000 - 0x1FF, user signature row)
For more information about the BatchISP command line tool, run “batchisp -h” from a
command line to get a list of options and parameters. You can also read the FLIP
help file for information.
9
8372A-AVR-04/11
5.2 Restoring the boot loader
When the boot loader has been erased, it can be restored with any of the previously
mentioned programming tools.
The hex file for the boot loader can be found in the zip file associated with this
application note and is named atxmega128a1_batchisp_uart_bootloader.hex
NOTE The boot loader section is protected, and can only be erased with an external
programmer.
10 AVR1927
8372A-AVR-04/11
AVR1927
6 Example applications
Several examples are available in the ASF that can be downloaded from the Atmel
website ASF section:
http://atmel.com/dyn/products/tools_card.asp?tool_id=4192&category_id=163&family
_id=607&subfamily_id=2138
Each example has full source code with documentation, as well as ready-made
binaries to get you started quickly. The examples can be compiled using either GCC
or IAR compilers.
11
8372A-AVR-04/11
7 How to compile example projects
The compilers generate two files when compiling a project. The hex file contains the
actual data that will be programmed into the device. This hex file can be programmed
into the device using one of the programmers listed in Section 2.6 or by using the
preprogrammed boot loader.
The other file generated is a debug file, which contain both the data to be
programmed into the device and debug information to make the code readable during
debugging. This file can be opened in Atmel AVR Studio 4 for single-stepping and
debugging. The file extension of the debug file depends on the compiler, and will be
either .elf for AVR GNU Toolchain or .dbg for IAR Embedded Workbench.
The project can be compiled by pressing the F7 key on your keyboard or by selecting
“make” from the project menu. The binary and debug files are created as:
xmega_applications_xmega_a1_xplained_demo_atxmega128a1_xmega_a1_xplained.hex
xmega_applications_xmega_a1_xplained_demo_atxmega128a1_xmega_a1_xplained.dbg
12 AVR1927
8372A-AVR-04/11
AVR1927
8 References
[www.atmel.com/Xplained]
[www.atmel.com/avrstudio]
13
8372A-AVR-04/11
9 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
14 AVR1927
8372A-AVR-04/11
AVR1927
10 Table of contents
Features ............................................................................................... 1
1 Introduction ...................................................................................... 1
2 What is needed to get started?....................................................... 2
2.1 Documentation for XMEGA-A1 Xplained.......................................................................... 2
2.5 Toolchain.......................................................................................................................... 3
2.5.1 AVR GNU Toolchain..................................................................................................................... 3
2.5.2 IAR AVR Toolchain....................................................................................................................... 3
8 References...................................................................................... 13
8.1 IAR compiler ................................................................................................................... 13
15
8372A-AVR-04/11
10 Table of contents ......................................................................... 15
16 AVR1927
8372A-AVR-04/11
Atmel Corporation Atmel Asia Limited Atmel Munich GmbH Atmel Japan
2325 Orchard Parkway Unit 01-5 & 16, 19F Business Campus 9F, Tonetsu Shinkawa Bldg.
San Jose, CA 95131 BEA Tower, Milennium City 5 Parkring 4 1-24-8 Shinkawa
USA 418 Kwun Tong Road D-85748 Garching b. Munich Chou-ku, Tokyo 104-0033
Tel: (+1)(408) 441-0311 Kwun Tong, Kowloon GERMANY JAPAN
Fax: (+1)(408) 487-2600 HONG KONG Tel: (+49) 89-31970-0 Tel: (+81) 3523-3551
www.atmel.com Tel: (+852) 2245-6100 Fax: (+49) 89-3194621 Fax: (+81) 3523-7581
Fax: (+852) 2722-1369
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.
8372A-AVR-04/11