Atmel STK500 user guide: Section 4: Installing AVR Studio

Published by Atmel · pages 39–61 of 61 · Original PDF

79 discussions about the Atmel STK500

All 2 parts of the user guide

Section 4

Installing AVR Studio

AVR Studio, with its Integrated Development Environment (IDE), is the ideal software for all AVR development. It has an editor, an assembler and a debugger and is front-end for all AVR emulators and the STK500 starter kit.

To install AVR Studio, insert the supplied Atmel CD-ROM databook in the computer and navigate to “Products → AVR 8-bit RISC → Software”. Right-click with the mouse on the “AVRstudio.exe” file and select “save link as”. Select an empty directory and save the file.

Execute the “AVRstudio.exe” file; this is a self-extracting file that will extract all required files to the current directory. Execute the “Setup.exe” file; this will guide you through the setup process.

Note: AVR Studio, version 3.2 or higher, is required for STK500 support.

Rev. 1925C–AVR–3/03

Figure from the manual

Installing AVR Studio

4-2

Section 5

Using AVR Studio

5.1 Windows Software

In this section, the supporting software for STK500 will be presented and an in-depth description of the available programming options is given.

5.2 Starting the Windows Software

The software used for communicating with the STK500 development board is included in AVR Studio, version 3.2 and higher. For information on how to install this software, please see Section 4 on page 4-1. Once installed, AVR Studio can be started by double-clicking on the AVR Studio icon. If default install options are used, the program is located in the Windows “Start menu → Programs → Atmel AVR Tools” folder.

5.2.1 Starting STK500

Pressing the “AVR” button on the AVR Studio toolbar will start the STK500 user interface as shown in Figure 5-1.

Figure 5-1. AVR Studio with STK500 User Interface

Figure from the manual

Rev. 1925C–AVR–3/03

Figure from the manual

Using AVR Studio

5.3 STK500 User Interface The STK500 user interface includes powerful features for the STK500 development board. The available settings are divided into six groups, each selectable by clicking on the appropriate tab. Since different devices have different features, the available options and selections will depend on which device is selected. Unavailable features are grayed out.

5.3.1 “Program” Settings The program settings are divided into four different subgroups.

5.3.1.1 Device A device is selected by selecting the correct device from the pull-down menu. This group also includes a button that performs a chip erase on the selected device, erasing both the Flash and EEPROM memories.

5.3.1.2 Programming Mode This group selects programming mode. For devices only supporting High-voltage Programming, the ISP option will be grayed out. If both modes are available, select a mode by clicking on the correct method. Checking “Erase Device Before Programming” will force STK500 to perform a chip erase before programming code to the program memory (Flash). Checking “Verify Device After Programming” will force STK500 to perform a verification of the memory after programming it (both Flash and EEPROM).

5.3.1.3 Flash If the STK500 user interface is opened without a project loaded in AVR Studio, the “Use Current Simulator/Emulator FLASH Memory” option will be grayed out. When a project is open, this option allows programming of the Flash memory content currently present in the Flash Memory view of AVR Studio. For more information about AVR Studio memory views, please take a look in the AVR Studio Help file.

If no project is running, or the source code is stored in a separate hex file, select the “Input HEX File” option. Browse to the correct file by pressing the ... button or type the complete path and filename in the text field. The selected file must be in “Intel-hex” format or “extended Intel-hex” format.

Figure 5-2. Program

Figure from the manual

ATMEL

Using AVR Studio

5.3.1.4 EEPROM If the STK500 user interface is opened without a project loaded in AVR Studio, the “Use Current Simulator/Emulator EEPROM Memory” option will be grayed out. When a project is open, this option allows programming of the EEPROM memory content currently present in the EEPROM Memory view. For more information about AVR Studio memory views, please take a look in the AVR Studio Help file.

If no project is running, or the source code is stored in a separate hex file, select the “Input HEX File” option. Browse to the correct file by pressing the ... button or type the complete path and filename in the text field. The selected file must be in “Intel-hex” format or “extended Intel-hex” format.

5.3.2 “Fuses” Settings In the “Fuses” tab an overview of accessible fuses are presented. Some fuses are only available during High-voltage Programming. These will be displayed but not accessible if operating in ISP programming mode. Press the “Read” button to read the current value of the fuses, and the “Write” button to write the current fuse setting to the device. Checking one of these check boxes indicates that this fuse should be enabled/programmed, which means writing a “0” to the fuse location in the actual device. Note that the selected fuse setting is not affected by erasing the device with a chip-erase cycle (i.e., pressing “Chip Erase” button in the “Program” settings).

Detailed information on what fuses are available in the different programming modes and their functions can be found in the appropriate device datasheet.

Figure 5-3. Fuses

Figure from the manual

ATMEL®

Using AVR Studio

5.3.3 “LockBits” Settings

Similar to the “Fuses” tab, the “LockBits” tab shows which lock modes are applicable to the selected device. All lock bits are accessible in both ISP and High-voltage Programming. A lock mode may consist of a combination of setting multiple Lock bits. This is handled by the STK500 user interface, and the correct lock bits are programmed automatically for the selected lock mode. Once a Lock mode protection level is enabled, it is not possible to lower the protection level by selecting a “lower” degree of protection or by setting a different Lock mode. The only way to remove a programmed Lock bit is to perform a complete chip erase, erasing both program and data memories. One exception exists: If the target device has a programmed “EESAVE” fuse, the contents of the EEPROM will be saved even though a complete chip erase on the device is performed.

Figure 5-4. LockBits

Figure from the manual

5.3.4 “Advanced” Settings

The “Advanced” tab is currently divided into two subgroups.

5.3.4.1 Signature Bytes

By pressing the “Read Signature” button, the signature bytes are read from the target device. The signature bytes act like an identifier for the part. After reading the signature, the software will check if it is the correct signature according to the chosen device. Please refer to the AVR datasheets to read more about signature bytes.

ATMEL

Using AVR Studio

Figure 5-5. Advanced

Figure from the manual

5.3.4.2 Oscillator Calibration Byte The oscillator calibration byte is written to the device during manufacturing, and cannot be erased or altered by the user. The calibration byte is a tuning value that should be written to the OSCCAL register in order to tune the internal RC oscillator.

5.3.4.3 Reading Oscillator Calibration Byte By pressing the “Read Cal. Byte” button, the calibration value is read from the device and is shown in the “Value” text box. Note that the calibration byte is not directly accessible during program execution and must be written to a memory location during programming if it shall be used by the program. If this option is grayed out, the selected device does not have a tunable internal RC oscillator.

5.3.4.4 Writing Oscillator Calibration Byte Since the calibration byte is not directly accessible during program execution, the user should write the calibration byte into a known location in Flash or EEPROM memory. Do this by writing the desired memory address in the “Write Address” text box and then press the “Write to Memory” button. The calibration byte is then written to the memory indicated by the “Flash” and “Eeprom” radio buttons.

5.3.5 “Board” Settings The “Board” tab allows the changing of operating conditions on the STK500 development board. The following properties can be modified: VTARGET, AREF and oscillator frequency.

The interface is very flexible and it is possible to force the operating conditions beyond the recommended specifications for the device. Doing this is not recommended, and may damage the target device. The recommended operating conditions for the part are stated in the device datasheet.

Using AVR Studio

Figure 5-6. Board

Figure from the manual

5.3.5.1 VTARGET VTARGET controls the operating voltage for the target board. Through the use of the slide bar or the text box, this voltage can be regulated between 0 and 6.0V in 0.1V increments. Please refer to the device datasheet to find the specified voltage range for the selected device. Both voltages are read by pressing the “Read Voltages” button, and written by pressing the “Write Voltages” button.

The physical connection of the VTARGET voltage is shown in Figure 3-22 on page 3-16.

5.3.5.2 AREF AREF controls the analog reference voltage for the ADC converter. This setting only apply to devices with AD converter. Through the use of the slide bar or the text box, this voltage can be regulated between 0 and 6.0V in 0.1V increments. Please refer to the device datasheet to find the valid voltage range for the selected device. Both VTARGET and AREF are read by pressing the “Read Voltages” button, and written by pressing the “Write Voltages” button.

It is not possible to set AREF to a higher voltage than VTARGET because this will permanently damage the AVR.

The physical connection of the AREF voltage is shown in Figure 3-24 on page 3-18.

ATMEL®

Using AVR Studio

5.3.5.3 Oscillator The STK500 development board uses a programmable oscillator circuit that offers a wide range of frequencies for the target device.

Since it is not possible to generate an unlimited number of frequencies, the STK500 user interface will calculate the value closest to the value written to the oscillator text box. The calculated value is then presented in the oscillator text box, overwriting the previously written number.

5.3.6 “Auto” Settings When programming multiple devices with the same code, the “Auto” tab offers a powerful method of automatically going through a user-defined sequence of commands. The commands are listed in the order they are executed (if selected). To enable a command, the appropriate check box should be checked. For example, if only “Program FLASH” is checked when the “Start” button is pressed, the Flash memory will be programmed with the hex file specified in the “Program” settings. All commands depend on and use the settings given in the STK500 user interface.

Figure 5-7. Auto

Figure from the manual

It is possible to log the command execution to a text file by checking the “Log to file” check box.

Using AVR Studio

5.3.6.1 Setting Up the System for Auto-programming Click on the check boxes for the commands that you want the STK500 user interface to perform. A typical sequence where the device is erased and then programmed is shown in Figure 5-7. The chip is erased, both memories programmed and verified, and finally, fuses and lock bits are programmed.

Once configured, the same programming sequence is executed every time the "Start" button is pressed. This reduces both work and possibilities for errors due to operational errors.

5.3.6.2 Logging the Auto-programming to a File By clicking on the "Log to file" check box, all output from the commands are written to a text file. Select or create the file by pressing the "Browse" button and navigate to the location where the file is placed or should be created. The output is directed to this file, and can be viewed and edited using a text editor.

5.3.7 History Window The History window is located at the bottom of the STK500 view. In this window the dialog between AVR Studio and STK500 is shown. For every new command performed, the old dialog is replaced with the new one.

Figure 5-8. History Window

Figure from the manual

1925C-AVR-3/03 ATMEL

5.4 Command Line Software

The DOS command line version of the STK500 software is useful for programming STK500 from external editors or for use in production programmers. Simple batch files can be made for automatic programming. Type “STK500 -?” for help.

The program returns ERRORCODE 0 if the operation was successful, and ERRORCODE 1 if the operation failed.

Command Line Switches:

[-d device name] [-m slp] [-if infile] [-ie infile] [-of outfile] [-oe outfile] [-s] [-O] [-Sf addr] [-Seaddr] [-e] [-p fileb] [-r fileb] [-v fileb] [-l value] [-L value] [-y] [-f value] [-E value] [-F value] [-G value] [-q] [-x value] [-af start,stop] [-ae start,stop] [-c port] [-ut value] [-ua value] [-wt] [-wa] [-b hls] [-! freq] [-t] [-g] [-z] [-hl?]

5.5 Parameters

Parameter Description
d Device name. Must be applied when programming the device. See list below.
m Select programming mode; serial (s) or parallel/High-voltage (p). Serial programming mode is the default, and is used if this parameter not applied.
if Name of FLASH input file. Required for programming or verification of the FLASH memory. The file format is Intel Extended HEX.
ie Name of EEPROM input file. Required for programming or verification of the EEPROM memory. The file format is Intel Extended HEX.
of Name of flash output file. Required for readout of the FLASH memory. The file format is Intel Extended HEX.
oe Name of EEPROM output file. Required for readout of the EEPROM memory. The file format is Intel Extended HEX.
s Read signature bytes.
O Read oscillator calibration byte.
Sf Write oscillator call. byte to FLASH memory. “addr” is byte address
Se Write oscillator call. byte to EEPROM memory. “addr” is byte address
e Erase device. If applied with another programming parameter, the device will be erased before any other programming takes place.
p Program device; FLASH (f), EEPROM (e) or both (b). Corresponding input files are required.
r Read out device; FLASH (f), EEPROM (e) or both (b). Corresponding output files are required
v Verify device; FLASH (f), EEPROM (e) or both (b). Can be used with -p or stand alone. Corresponding input files are required.
l Set lock byte. “value' is an 8-bit hex. value.
L Verify lock byte. “value” is an 8-bit hex. value to verify against.
y Read back lock byte.

Using AVR Studio

f Set fuse bytes. “value” is a 16-bit hex. value describing the settings for the upper and lower fuse. E Set extended fuse byte. “value” is an 8-bit hex. value describing the extend fuse settings. F Verify fuse bytes. “value” is a 16-bit hex. value to verify against. G Verify extended fuse byte. “value” is an 8-bit hex. value describing the extend fuse settings. q Read back fuse bytes. x Fill unspecified locations with a value (0x00-0xff). The default is to not program locations not specified in the input files. af FLASH address range. Specifies the address range of operations. The default is the entire FLASH. Byte addresses. ae EEPROM address range. Specifies the address range of operations. The default is the entire EEPROM. Byte addresses. c Select communication port; “com1” to “com8”. If this parameter is omitted the program will scan the comm. ports for the STK500 ut Set target voltage VTARGET in Volts. “value” is a floating point value between 0.0 and 6.0, describing the new voltage. ua Set adjustable voltage AREF in Volts. “value” is a floating point value between 0.0 and 6.0, describing the new voltage. wt Get current target voltage VTARGET. wa Get current adjustable voltage AREF. b Get revisions; hardware revision (h) and software revision (s). ! Set oscillator frequency; “freq” is the frequency in Hz. t Get oscillator frequency. g Silent operation. z No progress indicator. For example, if piping to a file for log purposes, use this option to avoid the non-ascii characters used for the indicator. hl? Help information (overrides all other settings)

Figure 5-9. Sample Usage

Figure from the manual

1925C-AVR-3/03 ATMEL

Figure from the manual

Section 6

In-System Programming of an External Target System

The STK500 can be used as a programmer to program AVR devices in other applications. There are two different ISP connector pinouts available: a 6-pin and a 10-pin version. Both are supported by STK500.

Figure 6-1. 6-pin ISP Connector Pinout

Figure from the manual

Figure 6-2. 10-pin ISP Connector Pinout

Figure from the manual

Select the device to be programmed in the same way as programming a device on the STK500. The VCC of the target application is detected by STK500 and signals are converted into voltage levels suitable for the target system.

Note: If the other application has its own power supply to VTG, the jumper VTARGET must be removed before connecting STK500 to the other application. STK500 may be damaged if the VTARGET jumper is not removed.

Figure from the manual

In-System Programming of an External Target System

Section 7

Troubleshooting Guide

Table 7-1. Troubleshooting Guide

Figure from the manual

Troubleshooting Guide

Table 7-1. Troubleshooting Guide (Continued)

Problem Reason Solution
The AVR device cannot be programmed (continued). Reset disable fuse is set. Check reset disable fuse.
Programming too fast Check oscillator settings and make sure it is not set higher than actual clock.
External pull-up resistor on reset line too low. Ensure that external pull-up resistor is ≥ 4.7 kΩ.
AVR Studio does not detect STK500. Serial cable is not connected, or power is off. Connect serial cable to RS232 PROG and check power connections.
PC COM port is in use. Disable other programs that are using PC COM port.
Change PC COM port.
AVR Studio does not detect COM port. Disable COM port auto-detection in AVR Studio file menu. Force COM port to correct COM port.
STK500 cannot be switched off. Positive center power connector is used. Use negative center power connector.
Turn off STK500 by removing power connector.
The status LED is blinking slowly There is a short circuit on AREF Resolve the short circuit.
The status LED is blinking quickly. There is a short circuit on VTARGET. Resolve the short circuit.
An external VTARGET is being used and has been turned off. Set VTARGET to a value below 0.3V in AVR Studio.
The LEDs don’t work (running from external VTARGET). STK500 must be powered for LEDs to work. Supply poser to STK500 and turn it on.

Section 8 Technical Support

For technical support, please contact avr@atmel.com. When requesting technical support for STK500, please include the following information:

■ Version number of AVR Studio. This can be found in the AVR Studio menu, “Help → About”.

■ PC processor type and speed

■ PC operating system and version

■ What target AVR device is used (complete part number)

■ Programming voltage

■ Jumper settings

■ A detailed description of the problem

AVR STK500 User Guide 8-1 Rev. 1925C–AVR–3/03

Figure from the manual

Technical Support

1925C-AVR-3/03

Section 9

Example Applications

9.1 Using LEDs and Switches

Connect PORTB to LEDS and PORTD to SWITCHES. LEDS will operate differently depending on what switch is pressed. Tip: Copy the code from this document into AVR Studio.

;***** STK500 LEDS and SWITCH demonstration

.include "8515def.inc"

.def Temp =r16 ; Temporary register .def Delay =r17 ; Delay variable 1 .def Delay2 =r18 ; Delay variable 2

;***** Initialization

RESET:

ser   Temp
out   DDRB,Temp           ; Set PORTB to output

;**** Test input/output

LOOP: out PORTB,temp ; Update LEDS

sbis  PIND,0x00           ; If (Port D, pin0 == 0)
inc   Temp                ; then count LEDS one down
sbis  PIND,0x01           ; If (Port D, pin1 == 0)

Figure from the manual

Example Applications

dec Temp ; then count LEDS one up sbis PIND,0x02 ; If (Port D, pin2 == 0) ror Temp ; then rotate LEDS one right sbis PIND,0x03 ; If (Port D, pin3 == 0) rol Temp ; then rotate LEDS one left sbis PIND,0x04 ; If (Port D, pin4 == 0) com Temp ; then invert all LEDS sbis PIND,0x05 ; If (Port D, pin5 == 0) neg Temp ; then invert all LEDS and add 1 sbis PIND,0x06 ; If (Port D, pin6 == 0) swap Temp ; then swap nibbles of LEDS

;**** Now wait a while to make LED changes visible.

DLY: dec Delay brne DLY dec Delay2 brne DLY

rjmp LOOP ; Repeat loop forever

ATMEL® 1925C-AVR-3/03

ATMEL®

Section 10

Appendix A

Figure 10-1. STK500 Block Diagram

Figure from the manual

Rev. 1925C–AVR–3/03

Figure from the manual

Appendix A

Atmel Corporation

2325 Orchard Parkway
San Jose, CA 95131
Tel: 1(408) 441-0311
Fax: 1(408) 487-2600

Regional Headquarters

Europe

Atmel Sarl
Route des Arsenaux 41
Case Postale 80
CH-1705 Fribourg
Switzerland
Tel: (41) 26-426-5555
Fax: (41) 26-426-5500

Asia

Room 1219
Chinachem Golden Plaza
77 Mody Road Tsimshatsui
East Kowloon
Hong Kong
Tel: (852) 2721-9778
Fax: (852) 2722-1369

Japan

9F, Tonetsu Shinkawa Bldg.
1-24-8 Shinkawa
Chuo-ku, Tokyo 104-0033
Japan
Tel: (81) 3-3523-3551
Fax: (81) 3-3523-7581

Atmel Operations

Memory

2325 Orchard Parkway
San Jose, CA 95131
Tel: 1(408) 441-0311
Fax: 1(408) 436-4314

Microcontrollers

2325 Orchard Parkway
San Jose, CA 95131
Tel: 1(408) 441-0311
Fax: 1(408) 436-4314

La Chantrerie
BP 70602
44306 Nantes Cedex 3, France
Tel: (33) 2-40-18-18-18
Fax: (33) 2-40-18-19-60

ASIC/ASSP/Smart Cards

Zone Industrielle
13106 Rousset Cedex, France
Tel: (33) 4-42-53-60-00
Fax: (33) 4-42-53-60-01

1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
Tel: 1(719) 576-3300
Fax: 1(719) 540-1759

Scottish Enterprise Technology Park
Maxwell Building
East Kilbride G75 0QR, Scotland
Tel: (44) 1355-803-000
Fax: (44) 1355-242-743

RF/Automotive

Theresienstrasse 2
Postfach 3535
74025 Heilbronn, Germany
Tel: (49) 71-31-67-0
Fax: (49) 71-31-67-2340

1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
Tel: 1(719) 576-3300
Fax: 1(719) 540-1759

Biometrics/Imaging/Hi-Rel MPU/High Speed Converters/RF Datacom

Avenue de Rochepleine
BP 123
38521 Saint-Egreve Cedex, France
Tel: (33) 4-76-58-30-00
Fax: (33) 4-76-58-34-80


e-mail
literature@atmel.com

Web Site
http://www.atmel.com


Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use as critical components in life support devices or systems.


© Atmel Corporation 2003. All rights reserved. Atmel® and combinations thereof, AVR®, AVR Studio®, and DataFlash® are the registered trademarks of Atmel Corporation or its subsidiaries. Pentium® is a registered trademarks of Intel Corporation. Windows® 95/98/2000/me and Windows NT® are registered trademarks of Microsoft Corporation. Other terms and product names may be the trademarks of others.

Printed on recycled paper.

1925C–AVR–□/□□ /2M

Figure from the manual

Text converted from the manufacturer's document. A □ marks a character that could not be read in the original. Back to the Atmel STK500 discussions