Debugging Applications with the JTAG In-Circuit Emulator

Similar documents
Programming Options. For the EM250 SoC Platform and EM260 Co-Processor. Contents General Programming Notes... 2

Getting Started with STK200 Dragon

EM35x Breakout Board Technical Specification

AVR Development Tools. Shenzhen April 2005

USER GUIDE. ATmega168 Xplained Mini User Guide. Introduction

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

Figure 1. JTAGAVRU1 application The JTAGAVRU1 is supported by AVR Studio. Updated versions of AVR Studio is found on

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

Note that FLIP is an Atmel program supplied by Crossware with Atmel s permission.

Development Tools. 8-Bit Development Tools. Development Tools. AVR Development Tools

Programming in the MAXQ environment

HAND HELD PROGRAMMER QUICK START GUIDE

IAR EWARM Quick Start for. Holtek s HT32 Series Microcontrollers

M32 Development Board

Preparations. Creating a New Project

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

IAR C-SPY Hardware Debugger Systems User Guide

Debugging in AVR32 Studio

ZICM357P2 - Evaluation Kit User s Guide

Ember EM35x Mini Module Companion Kit

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018

HAND HELD PROGRAMMER QUICK START GUIDE

Daintree Light Sensor Demo Application Note

8-bit Microcontroller. Application Note. AVR030: Getting Started with C for AVR

C Programming in Atmel Studio 7 Step by Step Tutorial

BitCloud Software 1.2 Serial Bootloader User's Guide

Silicon Laboratories' EM35x Mini Module Companion Kit

ZIC2410 Getting Started Guide

The Atmel-ICE Debugger

IAR Embedded Workbench

AN-103 Preparing ZBasic Generic Target Devices

USER GUIDE. ATmega328P Xplained Mini User Guide. Introduction

AVR Development Board

Converting Firmware Projects to CoIde and IAR Embedded Workbench for ARM

Figure 26 CC Debugger Interface

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

ADSP-218x Family EZ-ICE Hardware Installation Guide

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.0 Revision: 0 Date: September 18, 2017

3 TUTORIAL. In This Chapter. Figure 1-0. Table 1-0. Listing 1-0.

QSG126: Bluetooth Developer Studio Quick-Start Guide

AVR- M16 development board Users Manual

Tutorial. How to use Keil µvision with Spansion templates Spansion Inc.

Also available for purchase separately are socket daughter boards for the QFN-11 and QFN-10 packages.

Lab Course Microcontroller Programming

ONE AVR D EVELOPMENT SECTION I NTRODUCTION TO NTRODUCTION TO AVR EVELOPMENT TOOLS. Section One: Introduction to AVR Development Tools

Rhino Robot Control Board [RKI-1550]

LPC2468 Industrial Reference Design Platform System Development Kit Version 1.2. August 2008

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

AN888: EZR32 Simple TRX Application Quick Start Guide

AVR Development Board

EM35x Ember Companion Kit Technical User Guide

SBAT90USB162 Atmel. SBAT90USB162 Development Board User s Manual

Router-E and Router-E-PA Wireless Router PRODUCT MANUAL

LBAT90USB162 Atmel. LBAT90USB162 Development Board User s Manual

SPECIFICATIONS SUBJECT TO CHANGE WITHOUT NOTICE

Assembly Programming in Atmel Studio 7 Step by Step Tutorial

Lab 3-2: Exploring the Heap

F²MC-8FX FAMILY MB95100 SERIES EMULATOR HW SETUP 8-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

Mega128-Net Mega128-Net Mega128 AVR Boot Loader Mega128-Net

AN10428 UART-SPI Gateway for Philips SPI slave bridges

S3 Flash In-System Programmer

EnerChip RTC Evaluation Kit CBC34803 Real-Time Clock with Integrated Backup Power. CBC-TAB Registers

Disassemble the machine code present in any memory region. Single step through each assembly language instruction in the Nios II application.

1.2 - Introduction to the IAR Workbench IDE *

NEW CEIBO DEBUGGER. Menus and Commands

AVR Hand Held Programmer

STK521. User Guide B AVR 01/12

Obsolete Product(s) - Obsolete Product(s)

ZigBeeNet Software 1.0 Application Note. Serial Bootloader. Doc. AN-481~04 v.1.2 March MeshNetics

Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX

Section 1 AVR Studio User Guide

Ember Desktop User Guide. Version 3.3 Build 1985

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front

Ethernet1 Xplained Pro

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

EMUL-PPC-PC. Getting Started Guide. Version 1.0

AN1369 APPLICATION NOTE

USER GUIDE. ZigBit USB Stick User Guide. Introduction

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

user guide January 2006 CSR Cambridge Science Park Milton Road Cambridge CB4 0WH United Kingdom Registered in England

USER GUIDE. Atmel Segment LCD1 Xplained Pro. Preface

System Designer. Programmable SLI AT94K/AT94S Series. Features. Description

HAND HELD PROGRAMMER QUICK START GUIDE

Figure 1-1 ISPAVRU1 application

Software Setup and Introductory Assembly programs for the MSP430 *

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

An FTDI connection: The ATtiny microcontrollers don t have a hardware UART External Crystal header pins for an optional crystal

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

EMUL IP2K PC. User Guide. Edition 1, July 13, Nohau Corporation. All rights reserved worldwide.

Figure 1. Simplicity Studio

Table Of Contents TABLE OF CONTENTS...1

EW The Source Browser might fail to start data collection properly in large projects until the Source Browser window is opened manually.

BOOTLOADER for AVR-Development Modules

Marten van Dijk, Syed Kamran Haider

Quick Start Guide for the Turbo upsd DK3300-ELCD Development Kit- RIDE

USER GUIDE. ATWINC1500 Xplained Pro. Preface

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

TotalShredder USB. User s Guide

Transcription:

Application Note 5000 16 April 2008 Debugging Applications with the JTAG In-Circuit Emulator AVR64/128 This document describes how to debug embedded wireless applications using the JTAG in-circuit emulator (ICE) for AVR microcontrollers. This method is principally useful in the early stages of development to debug device-level functionality. When application development moves into debugging the network behavior of devices, the JTAG ICE method becomes much less useful for the following reasons: It can only provide information about a single device. Not being a realtime debugger, it must halt code execution to read state, which negatively affects both the device under scrutiny and the operation of its neighbors, because the node is effectively removed from active participation in any mesh routing. The Ember developer kit provides tools that can be used to debug network behavior, such as an Ethernet backchannel and the EmberScope packet sniffer. User guides for these tools are provided in the developer kit. Note: T o use the JTAG ICE, you must be using an image from an EmberZNet network stack or an EmberNet network stack release of 3.0-b12 or greater. You should be familiar with the Atmel AVR Studio software, because JTAG debugging of AVR processors typically requires use of this interface. You should also be familiar with AVR JTAG ICE debugging procedures; for moreinformation, refer to the AVR JTAG ICE User Guide: http://www.atmel.com/dyn/resources/prod_documents/doc2475.pdf. Topics This document covers the following topics: Preliminary steps for using the JTAG ICE, page 2 Setting up and using the JTAG ICE, page 3 Restoring the RCM to normal operation, page 4

Page 2 Preliminary steps for using the JTAG ICE Before using the JTAG ICE, you must configure the microcontroller fuses and adjust the IAR build process to allow for JTAG debugging. Note: When you finish with the JTAG debugging process for your RCM, remember to follow the procedures described later, in Restoring the RCM to normal operation, so you can use your node in a standard context and bootload a new image onto it. Configuring microcontroller fuses Only three fuse settings are relevant to using the JTAG ICE: the Reset Vector (BOOTRST), EESAVE, and JTAGEN. Other fuses, lockbits, and boot options may need to be configured for your hardware to function correctly. For more information about microcontroller fuses, including suggested settings and the purpose and procedure for setting them, see Application Note 5001, Bringing Up Custom Nodes for AVR 64/128. Configuring the fuses requires an in-system programmer (ISP). The Ember developer kit does not include one, but many are available. Be sure to select a device that supports the microcontroller used in your Ember radio frequency communication module (RCM). (ISP usage is described in Application Note 5001, Bringing Up Custom Nodes for AVR 64/128.) Note: If you plan to use the Kanda programmer, you must obtain an adapter from Ember in order to connect the Kanda device to the developer kit carrier board s AVR programming header. The Ember developer kit carrier board provides a programming port (labeled J17 AVR PROGRAMMER) with 0.1-inch pin spacing rather than the 0.3- inch pin spacing found on most ISP connectors. Please contact Ember at support@ember.com to request this adapter. Warning: The Ember developer kit carrier board port with 0.3-inch pin spacings (port J16, labeled AVR JTAG) should be used for JTAG connections only. Although some ISP connectors may fit this port without the use of an adapter, it is not possible to program the microcontroller through this port. Warning: Configuring fuse settings incorrectly may result in an unusable RCM. If the RCM becomes unusable, see Application Note 5001, Bringing Up Custom Nodes for AVR 64/128, for information on restoring it to its proper state. If you are unsure about the proper settings for your RCM, please contact a support engineer at support@ember.com for assistance Connect the ISP (In System Programmer) programmer of your choice to the ISP port (J17) and set the fuses as follows: Fuse Setting BOOTRST: Reset Vector (found under Lockbits & Boot Options) UNSET (Boot Block) EESAVE: EEPROM memory is preserved after Chip Erase SET

Page 3 Fuse Setting JTAGEN: Enable JTAG SET Other fuses, lockbits, and boot options should be set according to the procedures described in Application Note 5001, Bringing Up Custom Nodes for AVR 64/128. Adjusting the build process You must adjust the IAR Workbench build process to obtain a build image that the software for your ICE can use. The following procedure pertains to IAR Workbench version 4.10B and the.eww files in the Ember developer kit for EmberZNet 2.0. However, it should translate easily to any recent build that is using a similar version of the IAR Workbench. For each RCM to be debugged, make the following changes to IAR Workbench: 1. Open the.eww file that applies to the RCM that you want to debug. 2. Select a debug configuration from the drop-down list (for example, Simple- EM2420-Debug Target). 3. Select Project > Options. The Options dialog opens. 4. Select the Assembler category, then click the Output tab. Select Generate debug information. 5. Select the Linker category, then click the Output tab. In the Output file box on this tab, deselect Override default. In the Format box select Other, and in the Output Format drop-down list, select ubrof 8 (forced). 6. Click the #Define tab and change the INTVEC_BASE symbol value from 100 to 0. 7. Click the Extra Options tab (at the far right of all the tabs) and remove the - y(code) string. 8. Click the Build Actions category, and then clear all fields in the category. 9. Click OK to close the Options dialog. 10. Rebuild the image by selecting Project > Rebuild All in the main menu. Setting up and using the JTAG ICE Using the JTAG ICE on an AVR processor requires the AVR Studio software. To set up the AVR Studio 4.11 JTAG ICE environment: 1. Connect the JTAG ICE to a serial port on a PC and to the JTAG header (J16) on the Ember developer kit carrier board. 2. Follow this power-up sequence: Power the target (the carrier board). Power the JTAG ICE.

Page 4 Launch AVR Studio. Load and run the.dbg image. Note: When AVR Studio comes up in the open dialog, be sure to select JTAG ICE, ATmega128, ATmega64, and OPEN PLATFORM OPTIONS. 3. In the JTAG ICE Properties window, click the Debug tab and select Preserve EEPROM contents when reprogramming device. Click Apply, then click OK. The Initialized Data window displays. 4. Select Cancel in the Initialized Data window. Warning: You must cancel the Initialized Data window. If you do not, you will erase the tokens on the RCM. 5. Run the image. Note that you must pause execution to read the device s state. The JTAG ICE does not support execution tracing or realtime debugging. Debugging tips Initially, you are likely to see only the radioreceiveinterrupt() and RX overflows. The cause is radio traffic, in particular, the high interrupt rate on the EM1020 radio and the false SFD detects on packets in the EM2420 radio. When single-stepping or breaking, the node cannot function on the network because these methods interrupt the normal operation of the network stack, and this will negatively affect mesh relay traffic. This means that you cannot run JTAG while having the node participate on the network. To see the application code executing, disable the RX interrupt to keep the network stack from reacting to incoming packets. Do this by opening the EXTERNAL_INTERRUPT- >EIMSK in the 128 I/O tree and deselecting INT4. It is best to set breakpoints in the user application only and avoid the manual break or pause function. Doing this keeps the program flow from being paused within the context of the network stack library, where debugging is not reasonable because the source code for these functions is not provided. During the debugging process, the code sometimes hangs or repeatedly asserts on EEPROM accesses or UART activity. If this happens, repeat the power-up sequence. Restoring the RCM to normal operation You restore the RCM to normal operation by performing two tasks: Restore fuse settings Reload the application bootloader Restore fuse settings When you have finished debugging with the JTAG ICE, reset the fuses to the settings described in Application Note 5001, Bringing Up Custom Nodes for AVR 64/128.

Page 5 Note: Heed the following warning from in the Atmel datasheet: Never ship a product with the OCDEN Fuse programmed regardless of the setting of lockbits and the JTAGEN Fuse. Reload the application bootloader Because the application bootloader was erased from the RCM during setup for JTAG debugging, you must reload it so that you can upload applications to the node. For the procedure to upload the application bootloader, see Application Note 5001, Bringing Up Custom Nodes for MSP430F1612. For more general information on the application bootloader, see Application Note 5022, Programming and Using the Application Bootloader After reading this document If you have questions or require assistance with the procedures described in this document, please contact an Ember support representative at support@ember.com.

Copyright 2002-2008 by Ember Corporation All rights reserved. The information in this document is subject to change without notice. The statements, configurations, technical data, and recommendations in this document are believed to be accurate and reliable but are presented without express or implied warranty. Users must take full responsibility for their applications of any products specified in this document. The information in this document is the property of Ember Corporation. Title, ownership, and all rights in copyrights, patents, trademarks, trade secrets and other intellectual property rights in the Ember Proprietary Products and any copy, portion, or modification thereof, shall not transfer to Purchaser or its customers and shall remain in Ember and its licensors. No source code rights are granted to Purchaser or its customers with respect to all Ember Application Software. Purchaser agrees not to copy, modify, alter, translate, decompile, disassemble, or reverse engineer the Ember Hardware (including without limitation any embedded software) or attempt to disable any security devices or codes incorporated in the Ember Hardware. Purchaser shall not alter, remove, or obscure any printed or displayed legal notices contained on or in the Ember Hardware. Ember, Ember Enabled, EmberNet, EmberZNet, InSight Desktop, and the Ember logo are trademarks of Ember Corporation. All other trademarks are the property of their respective holders.