Wednesday, October 8, 2008

How to set up the Atmel AVR STK500 programmer for use with ATTiny85-20PU (or ATTiny45 / ATTiny25)

Introduction:

There are 2 ways of programming an ATTiny85 microcontroller using the Atmel AVR STK500 programmer. The first one is In-System Programming (ISP); The most common way of programming AVR’s.
The other way of programming the ATTiny85 is High Voltage Serial Programming (HVSP). This is the only way of programming that can be used after the ‘reset disable’ fuse is set on the ATTiny85.

In-System Programming:

Before being able to program the ATTiny85-20PU with the STK500 you need to add 2 jumper wires on the STK500:

• One wire to connect the PB3 pin (pin 4) on the PORTB header to the XT1 pin (pin 7) on the PORTE / AUX header. This is to connect the clock system to the AVR device.

• The second wire to connect the PB5 pin (pin 6) on the PORTB header to the RST pin (pin 4) on the PORTE / AUX header. This is to connect the reset system to the AVR device.

• Place the 6-pin programmer cable so that it connects ISP6PIN to SPROG1

Jumper settings:

VTAGET: Enabled
AREF: Enabled
RESET: Enabled
XTAL1: Enabled
OSCSEL: pin 1-2 Enabled
BSEL2: Enabled
All other jumpers: Disabled

Place the ATTiny85-20PU in the SCKT3400D1 socket

Connect the (12V) power supply and a (usb-to-)serial cable to connect the programmer to your computer to the RS232 CTRL port and power on the STK500

See the complete setup for ISP in the picture below



isp_stk500.jpg




High Voltage Serial Programming:

source: STK500 user guide

1. Switch power off.
2. Place the ATTiny85 in the SCKT3400D1 socket and make sure all other sockets are empty!
3. Mount jumper OSCSEL on pins 1 and 2 to select software-controlled clock.
4. Mount jumper XTAL1 to route the oscillator signal to the device.
5. Mount jumpers VTARGET and RESET.
6. Use one 2-wire cable to connect the PB3 pin (pin 4) on the PORTB header to the XT1 pin (pin 7) on the PORTE/AUX header. This will connect the clock system to the AVR device.
7. Use another 2-wire cable to connect the PB5 pin (pin 6) on the PORTB header to the RST pin (pin 4) on the PORTE/AUX header. This will connect the reset system to the AVR device.
8. Use a third 2-wire cable to connect the PB0 and PB2 pins (pins 4 and 3) on the SPROG1 header to the DATA0 and DATA2 pins (pins 1 and 3) on the PROG DATA header.
9. Use the last 2-wire cable to connect the PB1 pin (pin 1) on the SPROG1 header to the DATA1 pin (pin 2) on the PROG DATA header.
10. Switch power on and you are ready to program.

See the complete setup for HVSP in the picture below



hvsp_stk500.jpg