Just a repeat from my blog today.
I couldn't find this well documented anywhere:
Burning a booltloader to an ATmega328 using a Duemilanove and a USBtinyISP
Just wanted to recount some of hair-pulling experiences of the last day.
I built my USBtinyISP when I first got into Arduinos, thinking this was the primary programming route.
It's sat on my shelf for the last 6 months, as this is really the atypical programming route.
Why you'd ever want to burn a bootloader?
ATmega328's come blank from the chip factory,
The Arduino folks load bootloaders onto the 328s to
allow them to accept program over the simpler USB port.
Without a bootloader, the chip will only talk to the more complex ICSP port.
And for that you need a programmer, like the USBtinyIsp.
Kits avaialble at Adafruit:http://http://www.adafruit.com/index.ph ... ucts_id=46
First, a sanity check:
1) To program a Duemilanove, you'll need the 6 pin cable, it's built as shown upper left.
Both males facing up.
2) The 6 pin cable was removed for clairty puposes.
3) Note the power jumper is in place to provide external power.
4) Read the last step of assembly instructions, you want replace R7 & R4 with jumpers for general use.
5) Get your drivers loaded and configured: (http://www.ladyada.net/make/usbtinyisp/use.html
6) Connect programmer, you should have a solid green light.
The red light does not come on until programming begins.
Next, the double-back-flip:
1) The programming cable plugs into the 6-pin ICSP header reversed.
You can confirm this as the PWR led should be lit on the Duemilanove.
Watch it, here' comes the second back flip.
2) Nearly every chip in the world is inserted with its notch to the left, that's pin 1 afterall.
I was also lulled into a false sense of security with the lovely "ATMEGA328" printed across my chip.
So, I popped that one out and popped a blank 328p in, missing that the notch points to the RIGHT.
Didn't kill the CPU, but a full day of debugging why the TinyISP wasn't working.
Flipped the CPU around, and everything worked first shot.
Second back flip? Match the notch!
The rest are commands straight out of LadyAda's manual:
avrdude -c tinyisp -p m8
"Initialization failed, rc=-1" is expected (THAT'S GOOD!) if nothing is connected, or the CPU is in backwards.
"Could not find USB device" means you're not talking at all.
avrdude -c tinyisp -p m328p
"AVR device initialized and ready to accept insructions" is very good.
Means you're ready to program your 328.
Start Arduino Studio,
Select Tools | Board | "Arduino Duemilanove or Nano w/ATmega 328"
Select Tools | Burn Bootloader | w/USBtinyISP
You should observe in the status area:
Burning bootloader to I/O Board (this may take a minute)...
Done burning bootloader.
That should do it.