STK500 ..............................................................................................
Table of Contents Section 1 Introduction ........................................................................................... 1-1 1.1 1.2 Starter Kit Features ...................................................................................1-1 Device Support .........................................................................................1-2 Section 2 Getting Started...................................................................................... 2-1 2.1 2.2 2.
Table of Contents 3.11.3 Main Power LED...............................................................................3-27 3.11.4 Target Power LED ............................................................................3-27 3.11.5 Status LED .......................................................................................3-27 Section 4 Installing AVR Studio ............................................................................ 4-1 Section 5 Using AVR Studio ................................
Section 1 Introduction Congratulations on your purchase of the AVR® STK500 Flash Microcontroller Starter Kit. The STK500 is a complete starter kit and development system for the AVR Flash Microcontroller from Atmel Corporation. It is designed to give designers a quick start to develop code on the AVR and for prototyping and testing of new designs. 1.
Introduction Figure 1-1. STK500 1.2 Device Support The system software currently supports the following devices in all speed grades: n ATtiny11 n AT90S4433 n ATtiny12 n AT90S4434 n ATtiny15 n AT90S8515 n ATtiny22 n AT90S8535 n ATtiny28 n ATmega8 n AT90S1200 n ATmega16 n AT90S2313 n ATmega161 n AT90S2323 n ATmega163 n AT90S2333 n ATmega323 n AT90S2343 n ATmega103(1) n AT90S4414 n ATmega128(1) Note: 1. In external target or in STK501, devices do not fit into the sockets of STK500.
Section 2 Getting Started 2.1 Unpacking the System Kit contents: n STK500 starter kit evaluation board n Cables for STK500: – (2 pcs) 10-wire cables for I/O ports and parallel mode programming – (1 pc) 6-wire cable for In-System Programming – (4 pcs) 2-wire cable for UART and DataFlash connections n 9-pin RS-232 cable n DC power cable n Atmel CD-ROM with datasheets and software n AT90S8515-8PC sample microcontroller 2.
Getting Started 2.3 Quick Start The STK500 starter kit is shipped with an AT90S8515-8PC microcontroller in the socket marked SCKT3000D3. The default jumper settings will allow the microcontroller to execute from the clock source and voltage regulator on the STK500 board. The microcontroller is programmed with a test program that toggles the LEDs. The test program in the AT90S8515 is similar to the example application code described in Section 9.
Getting Started 2.3.1 Connecting the Hardware Figure 2-2. Connection to STK500 10 - 15V DC To Computer (RS-232) To program the AT90S8515, connect the supplied 6-wire cable between the ISP6PIN header and the SPROG3 target ISP header as shown in Figure 2-1. Section 3.7.1 on page 3-9 describes the programming cable connections. Connect a serial cable to the connector marked “RS232 CTRL” on the evaluation board to a COM port on the PC as shown in Figure 2-2. Install AVR Studio software on the PC.
Getting Started Figure 2-3. AVR Studio STK500 Programming Menu Complete descriptions of using the STK500 interface in AVR Studio are given in Section 5 on page 5-1.
Section 3 Hardware Description Figure 3-1. STK500 Components Headers for I/O Ports Sockets for Target AVR Header for Expansion Boards Switches Options Setting Jumpers Target Reset Push Button Power Switch Power Connector Header for Switches Power LED Parallel Programming Headers RS-232 Interface Header RS-232 Port for Programming Master MCU Status LED DataFlash Interface Header RS-232 Port for Communication Socket for Crystal Header for LEDs Program Button LEDs 3.
Hardware Description Figure 3-2. Implementation of LEDs and LED Headers +5V 150R VTG 1 2 LED0 LED2 LED4 LED6 GND 10K LED1 LED3 LED5 LED7 VTG LEDn Note: 3.2 Description of User Switches The AVR can source or sink enough current to drive a LED directly. In the STK500 design, a transistor with two resistors is used to give the same amount of light from the LED, whatever the target voltage (VTG) may be and to turn off the LEDs when VTG is missing.
Hardware Description 3.3 Connection of LEDs and Switches Figure 3-4. Connection of LEDs and Switches to I/O Port Headers Any I/O port of the AVR can be connected to the LEDs and switches using the 10-wire cables. The headers are supplied with VTG (target VCC) and GND lines in addition to the signal lines. 3.4 Port Connectors The pinout for the I/O port headers is explained in Figure 3-5. The square marking indicates pin 1. Figure 3-5.
Hardware Description Figure 3-6. Pinout of PORTE Header 1 2 PE1 RST GND XT2 VTG PE0 PE2 REF XT1 GND PORTE/AUX The special functions of this port are: n PE0 - PE2: Table 3-1. PORTE Connection ATmega161 AT90S4414/AT90S8515 PE0 PE0/ICP/INT2 ICP PE1 PE1/ALE ALE PE2 PE2/OC1B OC1B n REF: Analog reference voltage. This pin is connected to the AREF pin on devices having a separate analog reference pin. n XT1: XTAL 1 pin. The internal main clock signal to all sockets.
Hardware Description 3.5 Description of User RS-232 Interface The STK500 includes two RS-232 ports. One RS-232 port is used for communicating with AVR Studio. The other RS-232 can be used for communicating between the target AVR microcontroller in the socket and a PC serial port connected to the RS-232. To use the RS-232, the UART pins of the AVR need to be physically connected to the RS-232.
Hardware Description 3.6 Description of DataFlash Pins NB! Not valid: AT45D021 2-Mbit DataFlash is included on the STK500 for data storage. A DataFlash is a high-density Flash memory with SPI serial interface. A detailed datasheet of the DataFlash can be obtained from the Flash memory section of the Atmel CD-ROM or from the Atmel web site. The DataFlash can be connected to the I/O pins of the microcontroller sockets.
Hardware Description Figure 3-13. Connection of I/O Pins to DataFlash for AT90S8515 Figure 3-14.
Hardware Description 3.7 Target Socket Section The programming module consists of the eight sockets in the white area in the middle of the starter kit. In these sockets, the target AVR devices can be inserted for programming and are used in the application. Note: Only one AVR device should be inserted in the sockets at a time. The AVR Flash memory is guaranteed to be correct after 1,000 programming operations; the typical lifetime of the Flash memory is much longer.
Hardware Description 3.7.1 ISP Programming In-System Programming uses the AVR internal SPI (Serial Peripheral Interface) to download code into the Flash and EEPROM memory of the AVR. ISP programming requires only V CC , GND, RESET and three signal lines for programming. All AVR devices except AT90C8534, ATtiny11 and ATtiny28 can be ISP programmed. The AVR can be programmed at the normal operating voltage, normally 2.7 - 6.0V. No high-voltage signals are required.
Hardware Description Table 3-2. AVR Sockets AVR Devices STK500 Socket Color Number Target ISP Header AT90S1200 AT90S2313 SCKT3300D3 Red 3 SPROG3 AT90S2323 AT90S2343 ATtiny12 ATtiny22 SCKT3400D1 Blue 1 SPROG1. Connect RST on PORTE to PB5 on PORTB. Connect XTI on PORTE to PB3 (XTAL1 on 2323) on PORTB.
Hardware Description It is not necessary to remove the 6-wire cable from its ISP position while running a program in the AVR. The port pins used for ISP programming can be used for other purposes in your program. 3.7.2 High-voltage Programming For High-voltage Programming, a 12V programming voltage is applied to the RESET pin of the AVR device. All AVR devices can be programmed with High-voltage Programming, and the target device can be programmed while it is mounted in its socket.
Hardware Description 3.7.2.1 Parallel High-voltage Programming To use High-voltage Programming, the programming signal must be routed to the AVR I/O pins. The two 10-wire cables supplied with the STK500 can be used to connect the PROG DATA header to the PORTB header and the PROG CTRL header to the PORTD header, as shown in Figure 3-17. Figure 3-17. Connection for Parallel High-voltage Programming Some of the jumper settings on STK500 must be changed when using High-voltage Programming.
Hardware Description Figure 3-18. Jumper Settings for High-voltage Programming VTARGET AREF RESET Jumpers must be Mounted XTAL1 OSCSEL Devicedependent Jumpers (See Below) BSEL2 PJUMP Hardware setup for parallel High-voltage Programming: 1. Switch power off. 2. Place the device to program in its socket according to Table 3-3 on page 3-11. 3. Connect the headers PROGDATA and PORTB with the 10-wire cable. 4. Connect the headers PROGCTRL and PORTD with the 10-wire cable. 5.
Hardware Description 3.7.2.2 Serial High-voltage Programming The 8-pin AVRs have too few pins to use parallel communication during High-voltage Programming. They use serial communication instead. This means that fewer signals have to be routed. Hardware setup for serial High-voltage Programming is as follows: 1. Switch power off. 2. Place the device to program in its socket according to Table 3-3 on page 3-11. 3. Mount jumper OSCSEL on pins 1 and 2 to select software-controlled clock. 4.
Hardware Description 3.8 Jumper Settings A master microcontroller and the eight jumpers control the hardware settings of the starter kit. During normal operation these jumpers should be mounted in the default position. To configure the starter kit for advanced use, the jumpers can be removed or set to new positions. The jumper settings and usage are explained in the following section. The default setting of the jumpers are shown in Figure 3-20. Figure 3-20.
Hardware Description 3.8.1 Target VCC Settings, VTARGET VTARGET controls the supply voltage to the target AVR microcontroller sockets. It can either be controlled from AVR Studio or supplied from an external source. If the VTARGET jumper is mounted, the on-board supply voltage is connected. The on-board supply voltage can be adjusted to 0 - 6V from AVR Studio. Always verify the respective datasheet for the AVR device operating voltage before adjusting VTARGET voltage.
Hardware Description The internal VTARGET has a short circuit protection. If VTARGET is set to be higher than 0.3V and the master microcontroller measures it to be below 0.3V for a duration of 80 ms, the master microcontroller will shut off the VTARGET and the Internal AREF. When this happens, the status LED will blink quickly. If an external VTARGET is used and the external VTARGET is turned off, this will also be detected by the STK500 as a (false) short circuit.
Hardware Description Figure 3-24. Internal AREF Connection 10 - 15V VIN Voltage regulator 0 - 6V AREF AREF Jumper 1 2 Master Wr PWM MCU Rd ADC PE0 PE2 REF XT1 GND PE1 RST GND XT2 VTG PORTE/AUX The AVR Studio-controlled analog reference voltage can also be used as an input to the analog comparator or for ADC measurements on the AVR. AVR’s AREF signal can then be connected to VTG. The internal AREF has a short circuit protection. If an AREF value is set up to be higher than 0.
Hardware Description Figure 3-25. RESET Jumper Options Jumper Mounted AREF RESET XTAL1 On-board RESET Signal Connected (default) Jumper not Mounted AREF RESET XTAL1 On-board RESET Signal Disconnected The STK500 master microcontroller controls the RESET signal to the target AVR. The RESET signal is accessible on the PORTE/AUX header; this pin can also be used for external RESET signal. Figure 3-26 shows the internal connection of the RESET signal. Figure 3-26.
Hardware Description When connected to an external system, there is often an external pull-up resistor connected to the reset line. A typical reset connection is shown in Figure 3-27. Figure 3-27. External Reset Connection R (4.7 kohm) RESET C (10 nF) If the external pull-up resistor is too low (<4.7 kΩ), STK500 will not be able to pull the RESET line low. 3.8.4 Clock Settings, XTAL1 and OSCSEL STK500 includes several clock options for the target AVR.
Hardware Description When the XTAL1 jumper is mounted, the STK500 internal clock system is used as main clock to the target AVR. The internal clock system can either use a crystal in the on-board crystal socket or a software-generated clock from the master microcontroller. The frequency of the software-generated clock can be set from 0 to 3.68 MHz. The default value is 3.68 MHz. Section 5.3.5.3 on page 5-7 explains how to set the clock frequency from AVR Studio.
Hardware Description Figure 3-30. XTAL1 and OSCSEL Connections Oscillator 5V VTG CRYSTAL OSCSEL XTAL1 3 2 1 Jumper AVR Studio XTAL1 NET Jumper Voltage converter MASTER MCU 1 2 PE0 PE2 REF XT1 GND PE1 RST GND XT2 VTG PORTE 3.8.5 BSEL2 Jumper The BSEL2 jumper connects the Byte Select 2 signal for High-voltage Programming of ATmega8, ATmega16, ATmega161, ATmega163, ATmega128, and ATmega323.
Hardware Description 3.9 Expansion Connectors STK500 has two expansion connectors, one on each side of the programming module. All AVR I/O ports, programming signals and control signals are routed to the expansion connectors. The expansion connectors allow easy prototyping of applications with STK500. The pinout of the expansion connectors is shown in Figure 3-34 and Figure 3-35. Figure 3-33.
Hardware Description Figure 3-34. Expansion Connector 0 Pinout GND AUXI0 CT7 CT5 CT3 CT1 NC RST PE1 GND VTG PC7 PC5 PC3 PC1 PA7 PA5 PA3 PA1 GND 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 GND AUXO0 CT6 CT4 CT2 BSEL2 REF PE2 PE0 GND VTG PC6 PC4 PC2 PC0 PA6 PA4 PA2 PA0 GND 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 GND AUXO1 DATA6 DATA4 DATA2 DATA0 SO CS XT2 VTG GND PB6 PB4 PB2 PB0 PD6 PD4 PD2 PD0 GND Figure 3-35.
Hardware Description 3.9.1 Signal Descriptions The signals AUXI1, AUXI0, AUXO1, and AUXO0 are intended for future use. Do not connect these signals to your application. The DATA[7:0] and CT[7:1] signals are also found on the Prog Data and Prog Ctrl connectors. These signals and connectors are explained in Section 3.10 on page 3-25. The BSEL2 signal is the same as that found on the BSEL2 jumper. This jumper is explained in Section 3.8.5 on page 3-22.
Hardware Description Figure 3-37. Prog Data Header Pinout 1 2 DATA0 DATA2 DATA4 DATA6 GND DATA1 DATA3 DATA5 DATA7 NC The Prog Data signals are used for the data bus when parallel High-voltage Programming an AVR device. During ISP programming, DATA5 is used as MOSI, DATA6 is used as MISO, and DATA7 is used for SCK. Note: 3.11 Miscellaneous All Prog Data signals are based on 5V CMOS logic. No voltage conversion to adapt to VTG is done on these signals.
Hardware Description 3.11.2 PROGRAM Push Button Future versions of AVR Studio may upgrade the master microcontroller on STK500. AVR Studio will then detect old software versions of STK500 and update the Flash program memory of the master microcontroller. To do this, the user is required to push the PROGRAM button when powering on STK500. AVR Studio issues instructions on how to perform the upgrade during the upgrade process. 3.11.
Hardware Description 3-28 1925C–AVR–3/03 AVR STK500 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”.
Installing AVR Studio 4-2 1925C–AVR–3/03 AVR STK500 User Guide
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.
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.
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.
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.
Using AVR Studio Figure 5-5. Advanced 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.
Using AVR Studio Figure 5-6. Board 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.
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.
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.
Using AVR Studio 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.
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).
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 1 2 MISO SCK RST VTG MOSI GND ISP6PIN Figure 6-2.
In-System Programming of an External Target System 6-2 1925C–AVR–3/03 AVR STK500 User Guide
Section 7 Troubleshooting Guide Table 7-1. Troubleshooting Guide Problem Reason Solution The red power LED is not on. The DC power cable is not connected. Connect the DC power cable to the DC jack (page 2-3). Wrong power supply is used. Check that the power supply is of DC type 10 - 15V, min. 500 mA (page 2-3). The power switch is off. Turn on the power switch. There is no AVR device in the socket. Plug the AVR device into the right socket (page 2-3). The LEDs are not connected to the I/O ports.
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Ω. Serial cable is not connected, or power is off.
Section 8 Technical Support For technical support, please contact avr@atmel.com. When requesting technical support for STK500, please include the following information: n Version number of AVR Studio. This can be found in the AVR Studio menu, “Help → About”. n PC processor type and speed n PC operating system and version n What target AVR device is used (complete part number) n Programming voltage n Jumper settings n A detailed description of the problem AVR STK500 User Guide 8-1 Rev.
Technical Support 8-2 1925C–AVR–3/03 AVR STK500 User Guide
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 .
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 c
Section 10 Appendix A Figure 10-1. STK500 Block Diagram RS232 SPARE SPARE UART RS232 CTRL CONTROL UART RS232 SPARE DATAFLASH DATAFLASH TARGET LEDS SELFPROG.
Appendix A 10-2 1925C–AVR–3/03 AVR STK500 User Guide
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.