ISP programming with arduino

Looking for an alternative to get my kkmulticopter blackboard v5.5 flashed with the latest firmware I stumbled upon this arduinoISP project. It’s basically a sketch that turns you arduino board into an ISP programmer. The guide that holds most if the information is here. Some information on how I got this working.

The Arduino I used for this is a Duemilanove. Arduin Uno doesn’t work with this code yet. With a mini solderless breadboard (I really love these things for prototyping!) I linked all the correct pins together. Check the arduino ISP link in the beginning for more details. You have to link digital pins 10, 11, 12 and 13 like this to the ISP programming interface:

  • digital10:ResetTarget Pull this low to reset the target and prepare for programming.
  • digital11:MOSI Master Out/Slave In
  • digital12:MISO
  • digital13:SCK Serial clock to target.

The kkmulticopter blackboard v5.5 has the 6 pin header, first one in this picture:

If you want to have some visual feedback from the programmer you can also add leds to the pins 7, 8 and 9. Check the sketch for info on what these leds do. Don’t forget to add some resistor to these leds so you don’t burn them out right away. You can use an online calculator to get the correct resistor value for your led. When in doubt a 1k Ohm will work in most cases.

Now for this arduino you need to disable the auto reset option. For this link the 5v pin with the reset pin using a 120 ohm resistor. Color code for this resistor is brown, red, brown.

That’s about it for the physical connections. Go ahead and flash your arduino with the arduinoISP sketch from the examples section and you’ll be able to see the heartbeat led when everything works.

I tried this first with the kkflashtool but that didn’t work out of the box. No matter what programmer I selected. I got it working using avrdude directly. Since I’m on OS X I installed crosspack package. It’s a simple disc image (dmg) that holds a package (pkg) to be installed by double clicking it.

The command for flashing looks like this:

$ avrdude -P /dev/cu.usbserial-A800eFOW  -b 19200 -c arduino -p atmega168ap -v -e -U flash:w:/Users/userX/Downloads/QuadControllerV4_5/QuadControllerV4_5_M168_M328.hex

Make sure to adapt the red parameters to match your configuration. By default the atmega168ap programmer doesn’t exist in config. I created that myself by making a copy form atmega168 changing only the programmer name and the device signature. In order to know the device signature you can run the above command with any existing programmer id that isn’t valid for your programmer connected to that port. You then will get a message that looks like this telling you what the ID is you need to put in the usr/local/CrossPack-AVR/etc/avrdude.conf file.

avrdude: Device signature = 0x1e940b
avrdude: Expected signature for ATMEGA168ap is 1E 94 6B
         Double check chip, or use -F to override this check.

And you’re done. This should let you program your kkmulticopter board with an Arduino (or any other programmer supported by AVR).

1 Comment on “ISP programming with arduino

Leave a Reply

Your email address will not be published. Required fields are marked *

Please reload

Please Wait