Search This Blog

Friday, September 14, 2012

ISP Programming an Atmel AVR

Bought an Atmel AVR programmer from Digikey.  I'm working on a project where I need to be able to directly program the Microcontroller in situ that is embedded in a project.   In the past I've always used the Arduino IDE and USB programming, but the developer of this machine is using WinAVR and the ISP setting.  This post is just my notes on how to set it up.

This is what I bought:


Manufacturer Part Number




WinAVR and Eclipse was recommended to me over the Atmel provided suite.  Since I use eclipse for Java programing, I'm game.

Downloaded here:
Looks like this hasn't been updated since 2010.   Picked the latest version

Double click on win avr install.   Run it from start menu.  Something comes up.  No idea what to do with it.

Also downloaded the AVR plugin

I will need Eclipse on this machine, it is new and I haven't used it on this machine

Downloaded Eclipse for C programming from here:
Unzipped and clicked on eclipse.  Tool comes up just fine.  Hmmm.  Now what.

Opened the AVR plugin I previously unzipeed and downloaded from here:

Maybe the manual will help.  No idea how to install it
OK I should have used Eclipse->Help->Install New Software.  I guess I knew that, learned that here:
Point to this site and click add in the install new software menu in eclipse
Select and hit next a couple times

It says:
If the installation was successful you should see the entries AVR Cross Target Application and AVR Cross Target Static Library in the "New C Project" wizard.
Turns out you have to go one click into creating the C project before you see these choices.  On the first project creation you just see C project.  Pick it and the next screen you see the AVR options.
AVR->Upload to target device is also now on the menu across the top

I'll publish my notes at this point, and update the post again when I've succeeded in programming the AVR

Without using all this software, I tried using the AVR ISP Mk2 to program an Arduino, using the supplied Arduino software, version 1.0.

It worked perfectly.     You hook up the MK2 via usb,  hook the 6 pin connector to the Arduino ISP header.  Leave the USB off the Arduiono.   The bump on the ISP header goes towards the inside of the Arduino board.  Power the Arduino from an external 12V supply since it can't get power from the USB.     You hit shift before clicking on the upload button and the function changes to upload from programmer.  There are also menu buttons to do it in the pulldowns, as well as an options menu to pick which programmer you have.    Now that you are set up this way, you can also reburn the bootloader as well as program sketches a little faster than the USB method.  This is no harder than the USB method.

I had to install drivers for the MK2, which turned out to be nothing more than the standard libusb0.dll file.

I was able to rescue two old Arduino boards that wouldn't talk to the USB by reburning their bootloaders.  This worked on an Uno and an older Duelmanove.  

1 comment: