This is going to seem silly to some of you, but I just beat my head over it for 20 unnecessary minutes, so damnit, I’m making a public note. Here’s how to fix errors trying to use ArduinoISP.
I have a raw manufacturer-fresh ATMega168-20P chip that I need a bootloader on. I followed Sparkfun’s tutorial here to make this happen. But I ran into problems. I hooked everything up as per the image and that tutorial, but upon trying to flash and being unsuccessful, I discovered two problems. They were causing weird errors, such as
avrdude: stk500_recv(): programmer is not responding
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
The fix was two fold. First, on the PROGRAMMER board, the UNO, add a 10uF capacitor between reset (+ side, if polarized) and GND (-). This disables the Uno’s auto reset, necessary for programming. Second, the code that’s included with Arduino 1.0 under File>Examples>ArduinoISP has an error as per this page: you must change
delay(40); at the end of
void heartbeat() to
delay(20);. For some reason, the delay of 40 breaks the timing of programming, and everything fails.
After making those two changes to my setup, my 168 burned just fine. New breadboard Arduino, ho!
ADDITIONAL NOTE: Peder in the comments below makes an important observation that “apparently you can’t have pin 13 connected to ground on the arduino you’re gonna program.” So if you’re still running into issues, verify that pin 13 is disused on your target.