AVR MKII (AVR ISP2) Programmer Tutorial

The AVR MKII Programmer , otherwise known as the AVR ISP2 Programmer is a great tool for programming your AVR microcontroller from your computer. Its rather cheap for a tool of its caliber ( $34 USD) and can be purchased from Digikey - http://jp.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=ATAVRISP2-ND or from Mouser - http://mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMv256HIxPBQcA8%252bsNH3cLLR .

This tutorial will only cover Windows XP users and not Windows Vista users nor Mac nor Linux users. Windows Vista users have reported problems with the AVR MKII, so if you have Vista you have two options : Install XP or Download and Install a Free Virtual Machine that runs Windows XP. This tutorial also assumes that you have AVRstudio installed - http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 .

The first step to programming with your AVR microcontroller is to connect your AVR programming connector to the AVR microcontroller . Connect MOSI of the connector to MOSI of the microcontroller, MISO to MISO, VCC to VCC , etc.

Many microcontroller boards already have ISP programming sockets so you can just plug in the ISP connector into that. My Axon and Roboduino already have ISP programming sockets built in.

Once you have your programmer, plug the programmer into your computer's USB Port.

A few seconds after you plug it in you should see a windows pop up which asks if you want to locate

drivers automatically. Choose to install software automatically and wait a few minutes until it installs.

Now that your drivers are installed just open up your AVRstudio project. Press build to Build your current project.

Turn on your microcontroller board, the light inside the AVR programmer should turn green. Then click the Programmer Button in the toolbar -

A window should pop up. Select AVR MKII Programmer and select USB.

Click "Connect" and now another window should pop up.

Now verify that the device selected is indeed your device. Click the "Settings" button right above ISP Frequency, and set your ISP frequency to 125 kHz.

Now select the Program tab and verify that the file in the Input Hex File textbox is indeed your hex file that was generated from your code.

Press the Program button directly underneath the Input Hex File .Your microcontroller should program now.

Now if this is your first time programming with your AVR MKII programmer , chances are that its not working properly.

Servos Jittering While Programming: This happens sometimes because the programmer applies some power to pins while its programming. Don't worry about it.

Debugging Techniques

  1. Read Signature Check - this makes sure that ISP frequency is correct and wiring is correct
  2. Flashing Orange Light - Bad circuit
  3. Red Light - No power, bad circuit
  4. Green Light - Good voltage, but possible to not program b/c of ISP frequency
  5. Use a multimeter to verify connections
  6. Check to see if you plugged in the connector correctly, the arrow symbol on the connector designates where pin 1 is.

Common Problems and Solutions

  1. Wrong ISP Frequency : This is probably the most common issue. When you bring up the little programming dialog box, go to the Board tab and set the frequency to 125.0kHz. See it if works now . It should be set to less than 1/4 of the Microcontroller's frequency , but I've found that around 1/8 of the microcontroller's frequency works best. One symptom of bad frequency is Success for Programming but Failure by Verification.
  2. Bad Wiring - Double check and triple check, use a multimeter to check
  3. Mixed up MISO-MOSI : For some reason the AVR people decided to use the acronyms MOSI and MISO, and they look almost exactly the same. Make sure you didn't mix up MOSI and MISO in your circuit.
  4. Make sure proper voltage and powered up when programming - Should be getting around 5V from a regulator, in truth even up to 6V will work fine but not recommended
  5. Selected the Wrong Programmer - In the Connection dialog make sure you picked AVR MKII and NOT AVR ISP Programmer.