Atmel studio is a powerful tool for making AVR programs, but writing a program is the first step. To use your program, you must make a circuit and transfer your code into microcontroller. You can program your AVR from Atmel Studio by the use of STK500 hardware. Why you cannot program MCU directly from computer by a cheap hardware like PIC microcontrollers? The answer is that to transfer your program to IC you must use SPI connection, but there is no SPI port on the PC. There are several software that use RS232 port as SPI, but you cannot program your AVR directly from Atmel Studio like them. Here I introduce you a software that simulates STK500 hardware on the PC and sends data to microcontroller using RS232 via a simple and cheap hardware. Note that using PC RS232 as SPI port is slow and programming the chip will take more time than a STK500 device.
To make the hardware you need:
- About 1 meter cable with 5 wires or more;
- 1x DB9 female connector;
- 3x 4.7K resistors;
- 3x 5.1V zener diodes;
- Female pin header (5 holes).
Solder resistors to pins 3, 4, 6 and 7 of DB9 connector, solder N pin of diodes to the other end of resistors and solder the other leg of diodes to the pin 5 of DB9 connector. Solder cable wires between resistors and diodes and pins 4 and 5 of DB9 connector. Solder other end of cable wires to female part of Pin header. Looking at the circuit diagram will help you a lot while making the hardware. Note that RESET pin of microcontroller must be pulled up (connected to +5V via a 10K resistor) in your circuit.
Before using WinSTK500 software you need a pair of virtual serial ports. There are a lot of virtual serial port emulator software like com0com
. After installing com0com, create a pair of virtual serial ports. Download WinSTK500 from this page, and install it on your PC. Connect your MCU to the hardware and connect it to RS232 serial port. Run Atmel studio, run WinSTK500 software, select CNCB0 as STK port, select your computer serial port (usually COM1) as SPI port and click Start button. Click on Add target… from Tools menu and add a STK500 tool at CNCA0 port. Choose Device Programming from Tools menu, select STK500 CNCA0 from Tool drop down menu, choose your microcontroller and use ISP interface, then click Apply button. The Atmel Studio will be connected to WinSTK500. After connecting to WinSTK500, you can change SPI clock frequency on the Interface settings, but note that WinSTK500 is a slow device and only supports 10-25 KHz, the default frequency is about 16 KHz that is recommended not to change it.
There are also two options on the WinSTK500 window:
- Command Failure Reset defines the behavior of the WinSTK500 when the command does not execute and is usually set to SCK Pin. If you tried programming several times and you faced timeout error and all connections are OK, try changing this option. You can also find some info about this option on your microcontroller datasheet.
- If after connecting to WinSTK500, Atmel Studio said that the STK firmware must be upgraded, increase the Software Version to avoid this message.
After connecting your microcontroller to Atmel Studio via WinSTK500 you can program it from Device Programming window.
Last Update: July 2015
Latest Software Version: 1.0
Tested on: Windows 8, Atmel Studio 6.2
Download WinSTK500 for Windows (2.21 MB)
The software is made by Delphi. If you want to buy the source code, click the below link to add it to your shopping cart. After making the payment the source code will be sent to your email address in 2 days.
Buy WinSTK500 Software Source Code (27.72 USD)