Issue
142 May 2002
Taking
a Swim with Atmel's STK500
Start
The Atmel STK500 Imagecraft
AVR C Compiler
Sources
& PDF
THE
ATMEL STK500
The
meat of my Atmel STK500 starter kit is shown in Photo
1. The AVR-supporting electronics are physically and
logically separated into three distinct areas on the
printed circuit board. The most colorful area is where
the target AVRs reside. You can program a variety of
AVRs in these color-coded sockets and then run the freshly
programmed application without having to move the target
AVR.
|

(Click
here to enlarge)
|
Photo
1—The color-coding scheme on the Atmel STK500 starter
kit assumes you were present the day your kindergarten
teacher taught the basic colors. Color coding the
numerous sockets and programming headers eliminates
some of the confusion, as the STK500 is one busy
piece of electronic equipment. |
Each
family of AVRs has a different set of programming pins
and possibly a different programming algorithm. To accommodate
the program mode differences, the Atmel STK500 development
board associates a color-coded set of programming header
pins with a similarly colored set of target AVR sockets.
The STK500 board has provisions for in-circuit serial
programming (ISP), high-voltage serial programming,
and high-voltage parallel programming.
High-voltage
serial programming is used on the smaller devices that
don’t have enough pins to be programmed with the parallel
method. The "high voltage" is actually 12 VDC and is
usually applied to the RESET pin of the AVR. In addition
to the target AVR sockets, jumpers to include or exclude
target AVR operating and reference voltages, oscillators,
and crystals are also found in the color-coded area.
All of the AVR socket signals are brought out to expansion
headers in case you have bigger plans than the STK500
development board can handle on its own.
A
set of eight LEDs and corresponding push-button switches
are located at the end of the board opposite the 9-pin
D shell connectors. There are also headers for target
AVR I/O ports, the spare RS-232 port, and the AT45D021
2-Mb Data-Flash. A collection of interconnect cables
is included to patch in the AVR ports and peripherals.
Two 10-pin jumpers are used to connect I/O ports to
the LED/push-button bank, and the 10-pin cables are
also used in high-voltage programming mode. A 6-pin
jumper cable is included to patch the 6-pin ISP programming
header into the AVR socket farm. The AT45D021 communicates
using SPI and there are three sets of two-conductor
patch cables to make that connection. The spare RS-232
channel is also a two-conductor patch.
The
peripherals and the master microcontroller (an AT90S8535)
can be found at the end of the board that sports the
DE9 shell connectors. This section of the STK500 development
board is well populated. Without going into component-by-component
detail, I can tell you that the master microcontroller
is responsible for generating the VTARGET and AREF voltage
levels using PWM outputs that are passed through low-pass
filters to the adjust pins of a couple of LM317 linear
voltage regulators. A master clock for the AVR targets
also originates in this area of the board.
The
DE9 shell connectors imply serial communications capability,
and a MAX202 does the RS-232 voltage level conversion
that allows the STK500 development board to attach to
a desktop PC running AVR Studio. Atmel likes to call
AVR Studio the front-end software.
Although
I’m primarily interested in getting the ATmega16 online,
I decided to keep the AT90S8515 socketed and run the
LED test. I pressed each of the eight push buttons and
with each push got a different light pattern on the
LEDs. On my second run through the push buttons, I noticed
that the seventh push button did nothing. When there’s
potential trouble, it’s time to go against the grain
and read the User Guide. The final pages of the guide
hold the code for the LED demo, and there I found out
that push button number seven is not included in the
LED algorithm. Satisfied that my STK500 development
board was in good working order, I went to Atmel’s web
site and downloaded the latest version of AVR Studio.
AVR
STUDIO
As
of this writing, the latest version of AVR Studio is
V.3.53. The AVR Studio is an integrated development
environment (IDE) that consists of an editor, a project
manager, an assembler and compiler interface, a simulator,
and a debugger. The AVR Studio editor is capable of
being coupled with almost any AVR compiler and C or
assembler source code can be edited in the debugger
source window.
If
AVR Studio recognizes anything that is hanging off the
PC’s serial port, the program automatically puts itself
in a mode to accommodate the serially attached peripheral.
For instance, AVR Studio can sense the presence of my
Atmel STK500 development board or an emulator and act
accordingly.
To
keep things simple, the interface for the AVR Studio
simulator is identical to the hardware emulator interface.
AVR Studio V.3.53 is designed to enable the Atmel STK500
board without the need for any additional software.
AVR Studio also includes firmware to update the development
board and AVR in-circuit emulators when necessary. AVR
Studio checks the attached device’s firmware level and
prompts the user if a firmware upgrade is required.
I’ll
use some available resources to bring AVR Studio to
life and demonstrate some of the concepts I’ve discussed.
The larger AVR Studio panel you see in Photo 2 is the
first thing you see when you invoke the AVR Studio program.
At this point, my Atmel STK500 development board is
connected to a PC via the RS-232 CTRL connector on the
board. As you can see in Photo 3, I have also strapped
the ISP6PIN header to the red SPROG3 header because
the AT90S8515 resides in a red socket in the AVR target
area.
|

(Click
here enlarge)
|
Photo
2—The AVR Studio panel looks barren when there are
no files or projects open. However, its ability
to interface and control the target AVR is demonstrated
by its invocation of the STK500 programming window.
As we go further, the importance and power of the
AVR Studio will become obvious. |
|

(Click
here to enlarge)
|
Photo
3—The two larger ribbon cables are connecting the
LEDs and push-button switches to the AT90S8515’s
I/O ports B and D. The smaller ribbon cable enables
ISP programming using the AT90S8515’s internal SPI
interface. |
A
mouse click on the AVR IC icon in the AVR Studio tool
bar invokes the STK500 programming window. As you can
see, I’ve chosen the AVR target to be the AT90S8515.
I’ve strapped the STK500 development board for ISP Programming
mode and have selected that mode in the STK500 programming
mode panel as well. I’m not going to program the AT90S8515.
Instead, I’m going to read the demo code it contains
into a file called blinky.hex.
The
final uploaded file location is specified in the Flash
panel of the STK500 programming window. A click on the
Read button in the Flash panel turns the green STK500
board status LED yellow while the contents of the ’8515
are read. The debug window containing the hex and disassembled
code from the ’8515 in Photo 4 confirms that push button
number seven does nothing in the blinky demo code.
|

(Click
here to enlarge)
|
Photo
4—All I needed to do was load a live file and almost
all of the AVR Studio lights came on. The AVR Studio
did not sense a hardware emulator or STK and automatically
reverted to Simulator mode. |
AVR
Studio opens up memory, processor cycles, I/O states,
registers, and even a terminal I/O window. Now that
you have a basic idea of how the AVR Studio and STK500
board work together, let’s move beyond blinking LEDs
and assembler mnemonics and swim toward deeper water.