MEGA-1284P Xplained Getting Started Guide

MEGA-1284P Xplained Getting Started Guide

AVR370: MEGA-1284P Xplained Getting Started

Guide

Features

Easy to reprogram with just a USB cable and a preprogrammed bootloader

Easy to debug code with JTAG based debugger/emulator

8-bit

Microcontrollers

1 Introduction

The Atmel

®

MEGA-1284P Xplained evaluation kit is a hardware platform to evaluate the Atmel ATmega1284P microcontroller.

The kit offers a range of features that enables the Atmel megaAVR

®

user to get started using megaAVR peripherals right away and understand how to integrate the megaAVR device in their own design. This getting started guide will take you through all the basic steps needed to start using the MEGA-1284P Xplained evaluation kit.

Figure 1-1. MEGA-1284P Xplained evaluation kit.

Application Note

Rev. 8374A-AVR-04/11

2 What is needed to get started

To be able to run the preprogrammed code, you need the Atmel MEGA-1284P

Xplained evaluation kit and a USB cable (standard A to mini-B or mini AB) to connect the board to a PC.

To modify the example code or write new code and compile it, you need a toolchain for the Atmel AVR

®

microcontrollers and an IDE to edit and debug code. Atmel provides both the AVR Studio

®

4 and the AVR GNU toolchain. Other IDEs and toolchains are also available like the IAR Embedded Workbench

®

.

If you, in addition, want to debug the code at runtime, you’ll need a debugger like the

Atmel AVR JTAGICE mkII or the Atmel AVR ONE!

More information on these tools is available at the Atmel webpage. See the reference section later in this document for more details.

2.1 Documentation for MEGA-1284P Xplained

The “AVR364 MEGA-1284P Xplained Hardware User’s Guide” package includes all in-depth information about the kit like schematics, BOM, assembly drawings, 3D plots and more. The package is available from the Atmel web-site. www.atmel.com/xplained

2.2 AVR Studio 4

The AVR Studio 4 is a free IDE for the Atmel 8-bit AVR microcontrollers. It can be used to write code, program, and debug a microcontroller.

AVR Studio 4 www.atmel.com/avrstudio

2.3 Bootloader programming tools

2.3.1 AVR open source programmer (AVROSP)

The AVR Open Source Programmer (AVROSP) is an AVR programmer application that offers the possibility to program the Atmel megaAVR devices via a bootloader. It is a command-line tool, using the same syntax as the Atmel STK

®

500 and the Atmel

AVR JTAGICE command-line tools in the Atmel AVR Studio .

AVR911: AVR Open Source Programmer

http://www.atmel.com/dyn/resources/prod_documents/doc2568.pdf

http://www.atmel.com/dyn/resources/prod_documents/AVR911.zip

On the MEGA-1284P Xplained board the Atmel ATmega1284P microcontroller is preprogrammed with a bootloader firmware that is compatible to the AVROSP.

2.3.2 FLIP (BatchISP)

BatchISP is a command line tool for programming the flash and the EEPROM memories of the board controller, and is part of the FLIP installation. It can be used to communicate with the preprogrammed DFU bootloader on the board controller.

FLIP (FLexible In-system Programmer) for programming http://atmel.com/dyn/products/tools_card.asp?tool_id=3886

2

AVR370

8374A-AVR-04/11

AVR370

2.4 Toolchain

In order to build an application from the source code a toolchain is needed, which includes the required tools like assembler, compiler, and linker. The code for this kit is compatible with the AVR GNU and IAR™ AVR toolchains.

2.4.1 AVR GNU toolchain

The AVR GNU toolchain is a free toolchain that can be downloaded from the Atmel webpage. It includes all necessary tools like a C/C++ compiler, assembler and linker, which are necessary for the AVR application development. The toolchain integrates with the Atmel AVR Studio 4 through the AVR GCC plug-in.

AVR GNU toolchain (free C/C++ compiler for 8-bit and 32-bit AVRs) http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4118

2.4.2 IAR AVR toolchain

The IAR AVR toolchain is a commercial toolchain which includes all necessary tools like C/C++ compiler, assembler and linker which are needed for the AVR application development. There is a 30 day evaluation version as well as a 4k (code size limited) kick-start version available from their website.

IAR Embedded Workbench for the Atmel AVR

http://www.iar.com/website1/1.0.1.0/107/1/

2.5 Programmers and debuggers

Programmers and debuggers are needed when either the application should be programmed without using the bootloader, or when debugging support is needed.

Several different tools are available that can be used directly with the Xplained kit; the most common of these are described in the next chapters.

2.5.1 Atmel AVR Dragon

2.5.2 Atmel AVR JTAGICE mkII

The AVR JTAGICE mkII is a mid-range debug/programming tool that can be used for code development with the MEGA-1284P 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.5.3 Atmel AVR ONE!

The AVR Dragon™ is a low-cost debug/programming tool that can be used for code development with the Atmel MEGA-1284P Xplained kit.

Atmel AVR Dragon (on-chip programming and debugging tool) http://atmel.com/dyn/products/tools_card.asp?tool_id=3891

The AVR ONE! is a high-end debug/programming tool that can be used for code development with the MEGA-1284P Xplained kit.

Atmel AVR ONE! (on-chip programming and debugging tool) http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4279

3

8374A-AVR-04/11

3 Board overview

Figure 3-1 shows most of the available features on the board. For more detailed

information on the Atmel MEGA-1284P Xplained hardware, take a look at the Atmel application note “AVR364: MEGA-1284P Xplained Hardware User’s Guide”.

Figure 3-1. Overview of the MEGA-1284P Xplained kit.

Header J1

Power measurement

JTAG

Header

(ATmega1284P) header

USB

Connector

Header J3

LED2

Mechanical

Button

(SW0)

LIGHT

Sensor

NTC

Sensor

RC

Filter

QTouch

Button

(QTB0)

LED1

Header J2

ATmega1284P

Reset button

ATmega1284P

Dataflash footprints

Header J4

AT32UC3B1256

Mechanical

Button

(SW1)

Power &

Status LED

Mechanical

Button

(SW2)

LED3

4

AVR370

8374A-AVR-04/11

AVR370

4 Connecting the board

WARNING

Connect a USB cable between the board and a PC or a USB power supply to power it up. This is all that is needed. When power is applied the power/status LED will light up in green.

Do not power the board without having the jumper next to the USB connector or an ammeter mounted. Otherwise, the device may be damaged.

When connecting the Atmel MEGA-1284P 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-bit and 64-bit versions of Windows

®

XP and Windows 7. Driver installs are not necessary on Linux

®

operating systems.

4.1 Connecting the Atmel AVR Dragon

In order to connect the AVR Dragon to the MEGA-1284P Xplained, a 10-pin header cable is needed. Connect the cable between the JTAG connector on the AVR Dragon

kit and the MEGA-1284P Xplained JTAG connector. Take a look at Figure 4-1 how

the connection should be done.

Figure 4-1. Connecting AVR Dragon to an Xplained board.

8374A-AVR-04/11

5

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 Atmel MEGA-1284P Xplained. See Figure 4-2 for reference of how

to make the connection.

Figure 4-2. Connecting AVR JTAGICE mkII to an Xplained board.

4.3 Connecting of the Atmel AVR ONE!

The AVR ONE!

JTAG connector can be connected to the MEGA-1284P Xplained kit

with a standoff adapter as shown in Figure 4-3 .

Figure 4-3. Connecting AVR ONE! to a Xplained board.

6

AVR370

8374A-AVR-04/11

AVR370

5 Programming the kit

5.1 Programming via the bootloader

The preprogrammed bootloader on the Atmel ATmega1284P offers the possibility to program the device via the UART interface. Since the default firmware of the board controller acts as UART to USB bridge the ATmega1284P can be programmed from the PC via the USB connection to the kit.

The bootloader on the ATmega1284P is evoked by pushing the mechanical switch

(SW0) during reset. Programming can be performed by using the command line tool from the AVROSP package. More information about AVROSP can be found in the application note that is available for this package. The executable file avrosp.exe is the only file required to use AVROSP. It is contained in the avr911.zip file that comes with this application note. The zip-file also contains the complete source code and a copy of the part description files from an Atmel AVR Studio 4 installation.

5.1.1 Step-by-step guide

To program the device, follow these steps:

1. Connect the USB cable from the PC to the kit

2. Press the reset button and the SW0 button

3. Release the reset button while still pressing the SW0 button

4. Release the SW0 button

5. Open the device manager and locate the COM port used by the kit, it should be

listed as “XPLAINED Virtual Com Port” as shown in Figure 5-1

Figure 5-1. Xplained kit COM port.

8374A-AVR-04/11

6. The communication port settings (baud rate, parity control etc.) must be set manually before using AVROSP. The needed settings are 57600bps, no parity control and eight data bits. Therefore the following command must be executed on the DOS command interpreter assuming the kit is listed under COM6, as

shown in Figure 5-1 : mode com6 baud=57600 parity=n data=8

7

NOTE

7. Now the AVROSP application can be started to program the kit with the application. Following command can be used assuming that the kit uses COM6:

avrosp –dATmega128 –cCOM6 –pf –vf -

ifmega_1284p_xplained_example.hex –e

8. Your firmware should now be running

AVROSP only supports comports COM1 through COM8. Connecting to a higher comport than this will not work.

5.2 Restoring the bootloader

When the bootloader has been erased it can be restored with any of the previously mentioned programming tools.

The hex file for the bootloader is a part of the application note zip (in the folder named hex) file and is called mega_1284p_xplained_bootloader_and_example.hex

8

AVR370

8374A-AVR-04/11

AVR370

6 Example applications

6.1 Preprogrammed firmware

The preprogrammed firmware in the Atmel ATmega1284P is set up with an example code that demonstrates some of the basic features of the MEGA-1284P Xplained kit.

This includes sleep modes, reading the light sensor and the ntc sensor. The example application has two main modes, demo mode or terminal mode. For more information please refer to the doxygen documentation (readme.html) found in the zip file associated with this application note. It also includes a bootloader (AVROSP) which allows the user to re-program the ATmega1284P without using an external programmer.

The Atmel AT32UC3B1256 board controller is also pre-programmed with a bootloader and an USART-to-USB gateway application which can be used to communicate with the target controller ATmega1284P .

8374A-AVR-04/11

9

7 How to compile example projects

7.1 Atmel AVR Studio 4

Open the AVR Studio 4 project and compile the project. The compiler will generate an

Intel hex file and an ELF file. The Intel hex file can be downloaded to the Atmel

ATmega1284P via the AVROSP program.

7.2 IAR Embedded Workbench

Open the IAR Embedded Workbench project and compile the code. After compilation an Intel hex and a debug file will be available. The Intel hex file can be downloaded to the ATmega1284P via the AVROSP program.

10

AVR370

8374A-AVR-04/11

AVR370

8 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

8374A-AVR-04/11

11

9 Table of contents

Features ............................................................................................... 1

1 Introduction ...................................................................................... 1

2 What is needed to get started ......................................................... 2

2.1 Documentation for MEGA-1284P Xplained ......................................................... 2

2.2 AVR Studio 4 ....................................................................................................... 2

2.3 Bootloader programming tools ............................................................................ 2

2.3.1 AVR open source programmer (AVROSP) ................................................................ 2

2.3.2 FLIP (BatchISP) ........................................................................................................ 2

2.4 Toolchain ............................................................................................................. 3

2.4.1 AVR GNU toolchain ................................................................................................... 3

2.4.2 IAR AVR toolchain ..................................................................................................... 3

2.5 Programmers and debuggers .............................................................................. 3

2.5.1 Atmel AVR Dragon .................................................................................................... 3

2.5.2 Atmel AVR JTAGICE mkII ......................................................................................... 3

2.5.3 Atmel AVR ONE! ....................................................................................................... 3

3 Board overview ................................................................................ 4

4 Connecting the board ...................................................................... 5

4.1 Connecting the Atmel AVR Dragon ..................................................................... 5

4.2 Connecting the Atmel AVR JTAGICE mkII ......................................................... 6

4.3 Connecting of the Atmel AVR ONE! .................................................................... 6

5 Programming the kit ........................................................................ 7

5.1 Programming via the bootloader ......................................................................... 7

5.1.1 Step-by-step guide .................................................................................................... 7

5.2 Restoring the bootloader ..................................................................................... 8

6 Example applications ...................................................................... 9

6.1 Preprogrammed firmware .................................................................................... 9

7 How to compile example projects ................................................ 10

7.1 Atmel AVR Studio 4 ........................................................................................... 10

7.2 IAR Embedded Workbench ............................................................................... 10

8 EVALUATION BOARD/KIT IMPORTANT NOTICE ........................ 11

9 Table of contents ........................................................................... 12

12

AVR370

8374A-AVR-04/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

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

Fax: (+852) 2722-1369

© 2011 Atmel Corporation. All rights reserved. / Rev.: CORP072610

Atmel

®

, Atmel logo and combinations thereof, AVR

®

, AVR

®

logo, megaAVR

®

, AVR Studio

®

, STK

®

, 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.

8374A-AVR-04/11

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement