In-System Programming (ISP) is a useful way to get code onto a chip running Arduino. ISP uses the 6 pins found in the 2 by 3 header on most Arduino boards (and many LucidTronix
boards
too :). You will probably want to get an ISP programmer, but if you've got a spare Arduino you can
turn it into one
! If you decide to buy an ISP programmer you have a few options. Three we will mention are:
The nice thing about options 1 and 3 is that they supply power, whereas with MKII you will need the USB plugged in while you program. Once you've got yourself a programmer and a board to program jump down to our
step-by-step instructions
and get started!
So Many ISP Programmers?! Which one is for me?
-
So Many ISP Programmers?! Which one is for me?
There are a plethora of USB to ISP programmers and programming options out there. Everything from hook-up wire into a breadboard to injection molded translucent blue enclosure with status LEDs. In this tutorial, we'll help you find out which way works for you.
-
The MKII
The MKII is a programmer made by atmel (the company that also makes the AVR chips used in every Arduino). The big issue with the MKII is that it doesn't supply power, so you will need a separate power connection for your board during programming.
-
AVR ISP Layout
This image shows th elayout of the 6-pin and 10-pin ISP headers.
-
The USBTiny from Adafruit
The USBTiny from adafruit is a great programmer with an added bonus (or headache, depending on your perspective): You get to solder and assemble it yourself!
-
AVR Pocket Programmer
A nice affordable option from Sparkfun!
-
The ribbon pin out
These are the pin assignments between the ribbon and the different locations on the 3x2 header.
There are a plethora of USB to ISP programmers and programming options out there. Everything from hook-up wire into a breadboard to injection molded translucent blue enclosure with status LEDs. In this tutorial, we'll help you find out which way works for you.
Instructions
instructions
Step-by-Step Instructions
Step0Connect the Ribbon to the 6-pin 3x2 headers on Your Board.
This is the ISP header on an arduino. Make sure the red wire on the ribbon lines up with 5V pin #1 of the ISP.
Step1Notice Orientation of ISP
The ISP Programmer has an orientation with pin #1 being high voltage line found in the corner.
Step2Select the Right Programmer
In the Arduino environment, go to Tools > Programmer and notice the list of programmers. Select the programmer you are going to use. Make sure a little check mark shows up next to name.
Step3Select the Right Board
Even though you may not be using a standard Arduino board, you still have to select the right one, based on which AVR chip you are using. If you are using the ATmega168 select Arduino Diecemilia / Dueminalove w/ ATmega168. If you are using a ATmega328p chip select Arduino Dueminalove w/ ATmega168. If you are using an ATmega32u4 then select Arduino Leonardo.
Step4Upload code Via the Programmer
Now when you upload the code you have to ensure Arduino uploads the code through the programmer. You can do this by either holding shift while clicking the upload button (as shown in the picture) or using the keyboard shortcut of ctrl (command on a mac)-shift-u.
Step5Common Errors
There are lots of places where ISP programming can break down. We will highlight two very common errors and offer some troubleshooting tips. One of the most common errors is to get a message (in big scary error code red) like: "avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)". Or, if you're using the MKII your error message may read "avrdude: usbdev_open(): did not find any USB device ". Okay this means your computer couldn't find the programmer. First is the programmer plugged in? Try unplugging and plugging it back into a different USB port. Also make sure you selected the right programmer under Tools > Programmer. Still not working? Try unplugging the board from the programmer and uploading again. If the error message changes that is progress, if not there may be something wrong with your programmer.
Step6The Dreaded Initialization failed, rc=-1
Oh how we hate this error! The exact error message reads "avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check." Here, the computer was able to talk to the programmer, but the chip was unable to respond to the programmer. As the error message suggests the first thing to check is the wires. Is there power for the chip? Are all the wires in the right places, is the red wire on the ISP ribbon lined up with pin 1 on the 6 pin header? Is there an unexpected short circuit? Are things getting hot? Unplug! Try a different chip if possible, try a different board if necessary.
Comments: