Electronics Microcontrollers "/>

Using your Arduino as an ISP

26 March 2012 at 9:15 pm

Article image for Using your Arduino as an ISP

ISP is short for In-System Programmer and is one of several ways to turn a blank Atmel chip into an Arduino. The basic chip is just a microcontroller, but with the right bootloader, you can load your Arduino-based programs onto it. It all seems so easy, doesn’t it? You just buy this shield from Adafruit and follow the tutorial.

That would be much too easy! The Adafruit shield probably works, but since there’s no real listing of what hardware it’s actually compatible/tested with it’s sort of useless. By browsing the forums I realized that while it can be used to BURN an UNO, it can’t be used with an UNO. I have a Duemilanove 328 but the didn’t work either. I gave up on the shield and I also tried this the official ArduinoISP tutorial to no vain.

Today I tried this tutorial and it’s very much the same, but explains an option to not use a crystal. I had a bunch of problems that I eventually solved, so am posting the results for others to find.

To use the Minimal Circuit setup (without the crystal/capacitors) you’ll try to follow the instructions listed only to get the first problem.

“pins_arduino.h: No such file or directory”

Copy the contents from the downloaded boards.txt in your src/hardware folder to the boards.txt in App folder instead. On OSX: right click the Arduino app and browse Contents/Resources/Java/hardware/arduino/boards.txt.

You may also need to add the line below after the other text you pasted as it’s missing in the downloadable example file:

After this, the ArduinoISP example compiled fine and uploaded to the Duemilanove board that I’m using for burning the bootloader. The next problem I bumped into was that when I selected Tools -> Burn Bootloader, avrdude couldn’t communicate with my board.

stk500_getsync(): not in sync: resp=0x00
You can also get other hex numbers like resp=0x15 and resp=0xf0

Add either a 120 Ohm resistor (didn’t work for me) or a 10uF Capacitor (worked like a charm) between the Reset and 5V Pin:

I had to fiddle a bit to get this right and once it worked I ran straight into the next problem…

Avrdude dislikes your lovely 328-PU chips and says “avrdude: Yikes! Invalid device signature.” or “avrdude: Expected signature for ATMEGA328P is 1E 95 0F”

Unfortunately the 328-pu and 328p-pu are not the the same. They’re very similar though so all you need to do is to tweak a setting in your avrdude.conf file as described here.

Also remember to set this back and then restart the Arduino IDE, or you’ll get the error “avrdude: Expected signature for ATMEGA328P is 1E 95 14” the next time you try to upload. Below is the final setup where I added capacitors and crystal as well (click to view the full size version on Flickr)

Take 2

So while I had this working nicely, it all of a sudden stopped working on my MacBook Pro. Really? yeah! First I got a bunch of “avrdude: Yikes! Invalid device signature” and later the dreaded “avrdude: stk500_recv(): programmer is not responding”. I have absolutely no idea why it stopped working.

What to do… I had come this far and I had 10 chips that needed a bootloader. I had read somewhere that the power supplied via USB varies and that to burn a chip you’re using more juice than normally. I downloaded the Arduino IDE on my gaming PC and plugged the same setup in there and lo and behold - it worked? I tried again and it failed. I then removed the 10uF capacitor that was temporarily inserted between Reset and 5V and now it was burning chips with no problems again. It would work like a charm until I turned off the power to the Arduino. To get it working again I just added the capacitor back in for the first burn cycle and then removed it again.

Is it really as easy as adding a little more USB-power? The MacBook Pro USB ports are spec’ed to deliver to the normal 500mA but maybe they don’t? My gaming PC has a massive 1100watt PSU so it definitely has enough. I really don’t know, but if you get this issue, try using a different machine as well. It did wonders for me and the burnt chips work as intended when programmed with the FTDI Friend!