Issue
143 June 2002
Still
Swimming With the STK500
Onto
the JTAG ICE
by
Fred Eady
USING
THE JTAG ICE
The
JTAG ICE comes with everything you need to get you coding
and debugging quickly. Most of the JTAG ICE installation
process was a no-brainer. But, the person or machine
that assembled the 10-pin JTAG interface ribbon cable
had me swinging at a slider. Because the Atmel engineers
went to the trouble of color coding the JTAG-to-STK500
development board ribbon cable and meticulously detailing
the JTAG ICE JTAG header, it would have been easy to
just trust the colors and connect the JTAG ICE to the
STK500 development board with the brown lead being pin
1, the red lead pin 2, and so forth.
If this isn’t your first time reading my words in Circuit
Cellar, you know that I have an affinity for smoking
things. To avoid letting the magic out of the little
plastic boxes, I’ve started checking everything and
trusting nothing. As it turns out, the ribbon cable
was assembled in the reverse order with the brown lead
representing pin 10 of the JTAG connector and the black
lead posing as pin 1. I scratched my head, gathered
my thoughts, hooked the suspect JTAG cable to a VOM,
and shot the leads. I wasn’t losing it; the cable was
indeed assembled backwards.
I continued on with the installation process and connected
the JTAG ribbon cable “backwards” and was able to use
the JTAG ICE without melting it. I really don’t think
I would have harmed anything if I had not been attentive.
It just wouldn’t have worked until I corrected the wiring.
That’s really the only problem I had during the JTAG
ICE install. I was able to obtain all of the latest
firmware and front-end software from the Atmel web site
and from there I was off to the races. My AVR development
system hardware is shown naked in Photo 3.
|

(Click
here to enlarge)
|
Photo
3—At first I thought the STK500 development board
was a bit busy, but as I got more comfortable with
it, all the bells, whistles, and jumper blocks became
part of my development process. |
I develop with a dual-head monitor system. This allows
me to put the ICCAVR application on the right monitor
and AVR Studio on the left monitor. The ImageCraft AVR
C compiler IDE is excellent. I am able to segregate
my code using projects. I created a separate test project
to actually code and debug my AVR C code one module
or line at a time. In the same ImageCraft IDE window
structure, I opened another window of C source that
would eventually be the completed working code that
would be loaded into the ATmega16. The final working
code window code is not included in the test project.
I debugged code snippets in the test project and moved
the working routines over to the final code window as
I finished them. All of the code writing and compilation
was performed on the ImageCraft screen.
The left display is where all of the JTAG ICE programming
and debugging took place. The STK500 development board
has an on-board ISP programming header to allow the
socketed AVR to easily be programmed using AVRStudio.
The JTAG ICE is a good AVR programmer as well. I’ve
included a 10-pin ISP header on the AVR Internet device.
This will allow me (and you) to program the ATmega16
in socket using any device that supports AVR ISP, like
the Kanda dongle.
I found myself going from datasheet to user’s guide
to application notes often during the development process.
I was pleased to discover the Info feature of AVRStudio
4. With this feature, I could simply point at an AVR
subsystem in the Workspace window and get a short description
of what the subsystem was made of and how it worked.
Also, being able to see the bit structure for a register
or I/O location helped keep the manuals closed. Photo
4 is a doublewide shot of the result of executing a
write to the USCRB USART register, while Photo 5 is
a panorama of the various windows available to you during
code development.
|

(Click
here to enlarge)
|
Photo
4—I really found the Info feature handy while debugging
my code. All of the registers and their bits are
available in an easy-to-read format. I saved a lot
of production time by not having to look up registers
and bits in the datasheets. |
|

(Click here to enlarge)
|
Photo
5—For inquiring minds, here’s the whole enchilada.
If you don’t have a dual-head setup, the various
windows automatically interlock when you place them
on the desktop. You can also compact and expand
each window, so it is possible to have them all
staged on the desktop. |