Vous êtes sur la page 1sur 6

9/21/2010 Usage | Aquaticus ROV

Search

Projects Technical articles Unfinished Links Shop

Home » Aquaticus AVR JTAG

Expert Cache Programming Professional Cache Software Design, Conversions and Consulting Services www.cacheexperts.com

Xeon 5500 v alidation/test QPI and PCIe signal integrity and processor-controlled board test www.Asset-intertech.com

CodeVisionAVR C Compiler The premier development tool with IDE,auto-program generator and ISP. www.codevision.be

Usage

When you successfully passed the test stage, you can start using JTAG.

Target unit
It is assumed you have target board with Atmel microcontroller that supports JTAG interface e.g. Control Unit or any
development board. You can build simple test unit, here is an example ATmega16 based test device:

AVR Studio
First you need a compiled C program for AVR that you want to debug. AVR Studio with GCC compiler usage is described here
as it is popular tool available for free from Atmel. As alternative you can use one of the commercial packages that supports
JTAG or under Linux programs avarice , avr-insight or AVR Eclipse Plugin .
Usage for BASCOM programs is described in JTAG with BASCOM article.

Create project
Use AVR Studio to create GCC type project. In fact programming language does not matter. You can create assembler
project as well, but for this example C is used.

Select Project/New Project from main menu. Dialog box appears

http://aquaticus.info/jtag-usage 1/6
9/21/2010 Usage | Aquaticus ROV

Type the name of your project and select AVR GCC. To see AVR GCC option you must install AVR GCC environment e.g.
WinAVR. For assembler programs select Atmel AVR assembler.

Click Next, a new dialog box appears.

Select AVR JTAG as debug platform. In Device panel select the type of your microcontroller in the target device. Note that
only microcontrollers with JTAG interface are visible.
In addition, you can select Port if you do not trust Auto mode.

Now it is time to type some example code. You can use the code below or any other program of your choice.

int pow(int y);

void main()
{
int x;
int a;

/* Loop */
for(x=0; x<10; x++)
{
a = pow(x);
}

/* Infinite loop */
while(1);
}
http://aquaticus.info/jtag-usage 2/6
9/21/2010 Usage | Aquaticus ROV

/* Simple subroutine */
int pow(int y)
{
int result;

/* result = y^2*/
result = y * y;

return result;
}

Compile the program Build/Build.

Now, to start debugging your program you must select Debug/Start Debugging from menu.

AVR Studio programs flash memory on the target device and jumps to the first line of your program. In debug mode you can
run your program, execute step by step and so on, see Debug menu for all the commands. Alternatively you can use push
buttons on tool bar.
Yellow arrow indicates current program line. Remember always compile C programs with debug info enabled. Thanks to this
option AVR Studio will show you C source code instead of assembler code.

http://aquaticus.info/jtag-usage 3/6
9/21/2010 Usage | Aquaticus ROV

If you want to alter the source code, stop the program execution Debug/Stop debugging first. Then modify the code,
compile it and start debugging.

Tips
It is good to disable compiler optimization. Optimized code gives you an impression some lines of the code are not executed.
Select Project/Configuration Options, then General settings and Optimization box. Choose -O1 or -O0. The last option is
a bit dangerous – all delay() functions from GCC lib won’t work!

Use reset while debugging to start from the begging without programming flash memory.

If you think some lines of code are not executed (typically thanks to optimization) you can switch to assembly view.

Programming microcontroller
JTAG interface not only allows you to debug program code but it can work as typical programmer. You can
program/read/verify FLASH and EEPROM memories, set fuse bits and some other things.

From Tools/Program AVR select Connect or Auto Connect (alternatively you can use CON and AVR icons on tool bar). If
AVR Studio successfully connects with the JTAG interface a new window should appear.

http://aquaticus.info/jtag-usage 4/6
9/21/2010 Usage | Aquaticus ROV

There are several tabs in the window. Here is the short description:

Main – gives you basic information about microcontroller in the target board;
Program – program, read and verify FLASH, EEPROM memories;
Fuses – set fuse bits; this allows you to select clock source, brown-out detection an so on. Never disable JTAGEN bit
(JTAG interface enable/disable);
LockBits – set lock bits;
Advanced – calibrate internal RC oscillator;
HW Settings – various JTAG interface related setting, option to upgrade firmware;
HW Info – Hardware and software revisions;
Auto – set automatic operations.

Firmware upgrade
From time to time Atmel publishes a new firmware for JTAG. Firmware is usually shipped with new version of AVR Studio or
you can download it from Atmel website. You can use original Atmel upgrade files for Aquaticus JTAG.

JTAG interface should be turned on and connected with computer with serial cable. Set BOOT jumper in position PROG. This
is very important, otherwise there w ill be a message informing that no avrboot interface was detected.

Choose Tools and AVR Prog menu. A new window should appear.

http://aquaticus.info/jtag-usage 5/6
9/21/2010 Usage | Aquaticus ROV

Click Browse and locate file upgrade.ebn. In standard installation it is located: C:\Program Files\Atmel\AVR
Tools\JTAGICE\Upgrade.ebn. This file contains ciphered version of JTAG ICE control program. AVRStudio takes care of
everything, it thinks that Aquaticus JTAG interface is the original one. Click Program in section Flash and wait a moment for
Flash memory to be programmed.

At the end, place BOOT jumper in position NORM, so that bootloader will no longer be invoked and you can use interface in
JTAG mode.

‹ Testing up JTAG with BASCOM ›

Add new comment

Singapore F1 Join Your Singapore in Watching Action-Packed F1 Race! www.YourSingapore.com

Xeon 5500 v alidation/test QPI and PCIe signal integrity and processor-controlled board test www.Asset-intertech.com

PIC & AVR C Compilers Compile, Simulate, Program! IDE's, Programmers & Development www.fored.co.uk

© 2006, 2010 Aquaticus.info


Terms of use Contact Shop

http://aquaticus.info/jtag-usage 6/6

Vous aimerez peut-être aussi