With a little more research I decided to hack together an ISP programming cable using a computer parallel port to toggle the BOOTRST (Select Reset Vector) fuse on my AVR Butterfly, rather than send it to someone to fix it or back to Mouser. Schematic shown below,
NOTE: the 1K resistor going from pin 11 of the DB25 to the MISO is too high of resistance. When I tried to use this cable with AVRdude I got the following error,
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
I just removed that MISO resistor entirely and got it working correctly. A lower value might be good to avoid accidentally damaging your LPT port; some schematics said 300 ohms. If you still get the above error without the resistor, check all your wires. Also, be careful and DO NOT plug in and turn on the AVR when the computer is off. This will possibly damage your LPT port from what I’ve read.
To get my male DB25 I cut off an end from an old printer cable, which also works well because it is shielded. The plans on the Internet recommended you keep the cable below 70cm in length to avoid interference problems. I forgot how many wires are in these things… If I ever make a bomb, I shall construct it with DB25 connectors.
“Cut the orange wire!”
“but.. WHICH ONE?!”
As far as I can tell there is no standard for the wire colors inside, so you just have to strip each one and test it with a meter. If you’re following along with this, I hope you have a good pair of wire strippers. Either that, or I’ve found for this small of wire you can put an old tip on your soldering iron, crank the heat up all the way, and then just let it sit on the bit of exposed wire on the end. The insulation should peel enough to test it with a meter easily.
AVRdude is a command line utility that can easily toggle the fuse bits using this cable and the butterfly, and it comes with WinAVR. There is a great tutorial for how to set fuse bits here. The following is just a quick summary.
First, read the current configuration of the high fuse byte.
avrdude -c dapa -p m169 -U hfuse:r:hfuse.txt:b
This will create a file called hfuse.txt containing something like,
The #1 (last, LSB) bit of the high fuse byte is the BOOTRST bit which needs to be programmed to activate the bootloader. In Atmel jargon, a bit is “programmed” if it is 0 and not programmed if it is 1. In my case, flipping (programming) the last bit will result in 0b10011000, or 0x98 hex. To write that to the fuse byte,
avrdude -c dapa -p m169 -U hfuse:w:0x98:m
Success! Going back to AVR Studio and writing a simple program to blink some LEDs in a Cylon eye pattern to the AVR worked fine.
RISE MY CYLON BRETHREN! Er.. maybe I’ve been sniffing the solder fumes a bit much.