Thursday, January 28, 2010

Turning the AVR butterfly into an ISP

First step to building my synthesizer - constructing an AVR programmer. Due to the lack of a parallel port on my laptop, building a parallel programmer was out of the question. Hence I present here a (serial) In System Programmer (ISP).

An ISP comes with one caveat, however - the AVR 910 protocol (used for ISPing AVR devices) is too complex to simply use bitbanging over RS-232. Most programmer designs get around this by using a programmed AVR to translate messages sent over RS-232 (from the host computer) into AVR 910 (sent to the target system). Yep. They use a programmed AVR to build an AVR programmer. Can you spell circular dependency?

So in order to build an ISP, there are a few options
  1. Use a parallel programmer to bitbang the AVR used in the ISP
  2. Buy a commercial AVR programmer
  3. Borrow someone else's AVR programmer
For me, (1) is ruled out due to my lack of parallel port. (2) is ruled out due to the state of my finances. And I don't know anyone who owns an AVR programmer.

There is, however, one further option, which is to turn Atmel's AVR butterfly demonstration board into an ISP. The AVR butterfly comes with several useful features, usefully for this project, a built in RS-232 level converter. Even more interestingly, it is also self programmable, due to its preloaded bootloader.

This basically means that an AVR programmer is not required to program the butterfly. Since I have a spare butterfly lying around the home (they were given out to first year electrical engineering students a couple of years back at my uni) it seems a good candidate for my ISP.

The code for the programmer, as well as the makefile and some basic schematics are here. The design is based on Atmel's AVR 910 application note, though it adds several features, notably support for a wider variety of AVR targets. It should be compatible with the "avrisp" driver in avrdude.

So happy building. Finally, I should note that I do not intend for this to be a permanent programmer - I have ported the above code to the atmega8, and will actually be building a standalone ISP later - but I will be using this butterfly programmer to bootstrap it.

No comments:

Post a Comment