My latest and greatest side-project is now complete - that is, it's now usable. I've developed the firmware to turn any Atmel USB AVR into an AVRISP-MKII. That's right, native USB!
What is it?
An AVRISP-MKII, obviously. Actually, it's a clone, but using entirely open source firmware rather than just ripping of Atmel's binaries from a real AVRISP-MKII.
Why AVRISP-MKII over AVR910 or other protocols?
Using the official AVRISP-MKII protocol means the programmer will integrate with AVRStudio seamlessly and exposes more features than the simpler AVR910 or similar counterparts.
Why AVRISP-MKII and not an AVRISP-MKI?
The AVRISP-MKII uses native USB drivers, and since I've written the code for my LUFA USB stack, it seemed like the logical thing to do. With later extensions, the native USB will allow for even better features than the real AVRISP-MKII, such as alternate modes of operation (e.g. USB-to-Serial, USB-to-SPI/I2C converter, bitbanger).
The AVRISP-MKII protocol is slightly better than the original's in that it requires less packet massaging and has more features like short-circuit and reversed-connector warnings. Unfortunately, neither of these are currently in the firmware, but I'll add them in the future. PDI and TPI programming is supported in addition to ISP programming.
What's the benefit?
Cheaper, if you go for the bare-bones approach or build it entirely yourself. Free if you've already got a USB AVR board around and want to re-use it as a second programmer.
Many people also are starting out with cheap ~$20 USB AVR boards, and want to try out other AVRs later. This gives their initial purpose some extra value outside its use as a general development board.
In the future, new firmware updates will give added functionality to the device. Adventurous programmers could also hack the firmware themselves to add features that they desire.
Since you build it yourself, you make it as cheap as you like. The simplest form would be something like the $20 Teensy, AVROpendous or Bumble-B boards, with no extra circuitry. Adding level converters, etc. would obviously add to the cost of the unit.
Currently, ISP programming modes below 125KHz aren't supported, since I'm using the hardware SPI unit at this time. In theory, it can program with a SCK frequency of up to 4MHz for a USB AVR running at 8MHz, or 8MHz for a USB AVR running at 16MHz.
As mentioned above, currently there's no short circuit or reversed target detection, so be careful when hooking it up.
If used on an AVR with no ADC subsystem, VTARGET detection is disabled and the device will always report 5V.
How do I build it?
First, you need to download the latest LUFA package from here, and edit the Projects/AVRISP-MKII/ directory makefile to suit your chosen USB AVR target. In the makefile, you can set the pins used for VTARGET detection and target RESET. Build the project by running a "make all" from the command line.
Program the HEX file into your chosen USB AVR. For this you can use another programmer that you have, or you can load it with Atmel's FLIP software via the USB bootloader which comes preloaded into every USB AVR.
See the AVRISP-MKII project's text file for target connection information. Ideally, you should build the project documentation using Doxygen, but it's still readable in its unprocessed form.
This is a first revision project, and is only a very minor part of my much larger LUFA USB stack for the USB AVRs. From the next official release, this side-project will be included to show off a practical application built with the library.
Please give feedback here, so I can improve the code!
EDIT: Outdated HEX file removed - please download latest LUFA source code here for latest source.
- Dean :twisted: