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.

Step 1: Making the Hardware

To make the hardware you need:

  • About 1 meter cable with 5 wires or more
  • DB9 female connector
  • Pin header
  • 3x 4.7K resistors
  • 3x 5.1V zener diodes
  • Soldering tools

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 connected to +5V via a 10K resistor in your circuit.

<p>I tried this project on an ATMEGA328PU, and keeping getting:</p><p>Severity:ERROR</p><p>ComponentId:20100</p><p>StatusCode:1</p><p>ModuleName:TCF (TCF command: Tool:connect failed.)</p><p>Failed to open \\.\COM1. Error 0x5.</p>
Read step 4 again. Atmel Studio must connect to CNCA0 and WinSTK must connect to CNCB0 and COM1. It seems you are confirugring Atmel Studio to connect to COM1, that is not right.

About This Instructable



Bio: I'm a mechanical engineer, and I like computer programming, mechanics, electronics and specially the robotics.
More by vahidyou:Serial Port over WiFi Cheap Logic Analyzer Cheap STK500 AVR programmer for Atmel Studio 
Add instructable to: