Updated 25 April 2009
With this notes I’ll show how I configured an Atmel STK500 as an Arduino-based development system.
I used the STK500 instead of a real Arduino PCB because I already had it and the board carries 8 switches, 8 LEDs and a variable, software programmable AREF voltage as well as a variable power supply. Great things to experiment with on a single board.
What follows applies to the STK500 evb equipped with an ATMega168. Please note I made my best to be as accurate as possible, some errors may be present though. Should you find some, please let me know.
AVR Studio 4.14 build 589 is used in the following; newer versions should be hopefully upward compatible.
Things needed :
One Atmel STK500 Evaluation Board with power supply
One Atmel ATMega168
One 16MHz crystal
One serial cable
One PC with AVR Studio 4 and one serial port
The Arduino software development system and the bootloader file for the ATMega168.
In case the PC doesn’t have a serial port but just USBs, a USB to serial adapter is necessary to interface the STK500 to the PC. I haven’t tried but it should work.
RS232 is needed in first instance to interface the STK500 evaluation board with the PC.
First the STK500 was wired and the jumper set as shown in the picture below.Click the picture for a larger version.
The ATMega168 must be on board, any other CPU must be removed.
The ATMega168 must be placed in the green 28pin socket and the 16MHz crystal into the socket as shown. The PC must be connected to the STK500 serial programmin port, the one labelled “RS232 CTRL” on the PCB. Take note what port of the PC you are using (say COM1 or COM2).
Launch AVR Studio and turn on the STK500.
From AVR Studio select “connect” (the “IC” icon below the menus) and select “STK500″ as platform and “COM1″ or “COM2″ ( the one connected before ) as port.
Press “connect” and the following should come up, the “main” tab :
Select ATmega168 for “device and signature bytes” then press the “Read Signature” button and check that the platform recognizes the device (the “Signature matches selected device” label is what you want to see ).
Press the “Erase device” button.
Next, press the “program” tab to display the following:
Check the “Erase device before FLASH programming” and “Verify device after programming”.
Now select the “…” button to the right of the “input HEX file” field and browse to the directory “\arduino-0012\hardware\bootloaders\atmega168″ starting from the place where you exploded the Arduino zip file you downloaded and select the ATmegaBOOT_168_ng.HEX file. Otherwise browse to where you saved the bootloader downloaded from arduino.cc
Press the “Program” button : after a few seconds the bootloader will be FLASHed into the micro and verified automatically. The bottom part of the window shall give some promising “OK !”s
Now click on the “Fuses” tab. Make it look like the following picture: make sure to un-check CKDIV8 and to select the “Ext Crystal Osc. 8.0 – MHz…”.
Changes are reflected in the “EXTENDED”, “HIGH” and “LOW” registers at the bottom: make sure they are the same as below.
Press “Program”.
Now, with the “lock bits” tab, the bootloader must be protected from overwriting :
The “BLB1″ must be changed to what is above and the “LOCKBIT” register should finally be 0xCF as above, press “Program”.
Now you’re done: you can remove the 6-pin ribbon cable necessary to program the micro and move the serial cable to the other serial port connector of the STK500 (the one marked “RS232 SPARE” on the PCB), make sure you leave connected the PD0 and PD1 to RXD and TXD because these pins make the serial port of Arduino !
Now you have and STK500 running Arduino with the added advantage of pushbuttons and LEDs on board plus variable power supply (useful when working with 3.3V external sensors) and variable Analog Reference (AREF).
The AREF short pin must be inserted when the on-board voltage reference is to be used. Remove the short otherwise. The Analog Reference Voltage can be controlled with the “Connect” dialog box. Target Supply voltage can be controlled there also.
The connections of teh ATMega168 are available at connectors J700 & J701 of the STK500.
The pinout is shown below along with the equivalent name to Arduino’s.
Again, the “spare serial port” of the STK500 is the one used to download sketches on the STK500-Arduino: remember to move the serial cable to this port to connect your PC to your Arduino !
The Reset button on the STK500 is now the reset button of the STK500-Arduino: it must be pressed to download sketches on the board as you would with a regular Arduino.
Connecting PB5 to an LED of the ones on the board gives a visual monitor where the LED blinks right after reset to show it is waiting for the code on the serial port.
Update : there’s a bug in AVR studio 4.16 which prevents bootloader from being written correctly into the micro, see comment below from avirdi.
Have fun and write for questions and comments.
Alessandro

m
m
m