STRUIX Projects‎ > ‎

5: Building an In Circuit Programmer (ISP) for Atmel microcontrollers

Sophisticated developers agree - Another hardware tool for your Atmel toolbox is to consider building an In Circuit Programmer or ISP.

This one has capabilities similar to the legacy Atmel AVRISP - also known as the 'mature' AVR ISP.
For more information on the AVRISP and the devices it supports, click this link.


An ISP is a device that enables other programs, data and settings to be read from, or uploaded to, the CPU/microcontroller.

It can take the form of dedicated hardware or software.  For example, the bootloader for the Arduino, is nothing more than a software ISP that runs when the microcontroller is powered up and conveniently communicates via the serial port.  Another type of ISP - a hardware ISP, is a tool that physically connects to the CPU, interrupts it's operation and controls interaction to it through a specialized protocol.  The software tool that makes the user interaction with the ISP easier is called a monitor or a loader - in the case of Atmel chips, one such monitor is AVRDUDE.  We'll play with AVRDUDE a bit later.

Don't confuse an ISP with an In Circuit Emulator - or ICE.  They are completely different things.  Although both can transfer data to and from the CPU, an ICE is a hardware debugging tool and outside the scope of this project.  ICEs for the Atmel chips communicate through a JTAG interface.  Suffice it to say, ISP and ICE are not the same thing.


  • You want to explore different aspects of the CPU's configuration.
  • Like a machinist, your are interested in using your existing tools, to build better ones.
  • You are mass programming the production version of your widget.
  • You want to program your existing CPU with a new bootloader to save space or have different capabilities.
  • Building a hardware ISP is a gateway to using more sophisticated programming and development tools.
  • Your application is growing in size.  The bootloader takes up space that could be used by your program.
    An ISP is capable of reading & loading your data without a bootloader.
  • Some CPU's, including the ATTiny chips don't have enough memory to support an application AND a bootloader.
  • Some CPU's, such as the ATtiny10, don't even have hardware to support the familiar serial bootloader, even if they had the memory to support one.


This ISP will program the commonly found ATmega 168, 328  & 2560 CPUs and a host of additional ATmega and ATtiny chips.  You can get a list of the CPU's supported by your Arduino, AVR Studio or WinAVR installation by using the following command from a terminal window.

For WinAVR and Windoze based Arduino installations:
Switch to your installation folder and directory path...
C:\arduino-0021\hardware\tools\avr\bin> avrdude -C ..\etc\avrdude.conf -p ?

For Linux (and possibly Mac) based installations:
user@Speedy-QuadCore ~ $ avrdude -p ?

What you need:

 One Lilypad or STRUIX CPU board & a USB serial adapter
 One STRUIX Protopad One board
 One 8 pin DIP header socket
 One 8 pin DIP ribbon cable header (must be DIP)
 One 6 pin IDE ribbon cable socket (larger sized can be made to work)
 1 or 2 feet of ribbon cable (must have at least 8 conductors)
 Six 12mm x 3mm F/F standoff threaded fasteners (metal)
 One 12mm x 3mm F/F standoff threaded fasteners (plastic)
 Three 12mm x 3mm M/F standoff threaded fasteners (plastic)
 Eleven 3mm Phillips head machine screws (metal)
 Jumper wire (stolen from your breadboard wiring collection!!)

How to do it:

 Prepare your CPU

 If you already have a STRUIX CPU, you can skip this step.

If you are converting a Lilypad, you need to drill out the +,-, 10,11,12,13 & a4 pads with a 3mm drill.  MUST BE 3mm - not 'something close'!

Make the cable   

Strip your ribbon cable down to 8 conductors.

On one end, install the 8pin DIP ribbon cable header using a mini vice.  You can avoid crushing the pins on the header by placing a standoff between them when compressing the connector.  Note the orientation of the "pin 1" wire - in this case, the black one.

From the other end, strip the ribbon cable down to 6 conductors and trim the two you just stripped off close to the DIP header.

Install the 6 pin IDE socket using a mini vice.  Make sure the cable is flat and not twisted.  The IDE socket is installed on the cable side opposite the DIP header, so that when then the ribbon cable is doubled over and strain relief installed, the header and the socket both point the same direction.

 Wire up the daughterboard

 Download the schematic from the attachments section below for details of what is connected to what.

The board should look similar to the photo, but I'm sure you can do a more artful job of wiring.

IMPORTANT:  Keep in mind that the socket on the daughterboard board is wired "mirror image" of the connection through the cable to the CPU being programmed - That is, connections on the "left" side of the CPU programming header are wired to the "right" side of the socket on the daughterboard.

(We are working on a "Fritzing" diagram to better show the connections from the circuit board's point of view.)

Install the standoff threaded fasteners

 The pattern is shown here.

Metal F/F standoffs on +,-, & 10 thru 13.

Plastic F/F standoffs on a4.

Plastic M/F standoffs are used to fasten the F/F ones at -, 11 & a4.  Phillips head machine screws are used to fasten the rest.

 Install the cable

 Really?  Do you need instructions here? :-)

Anyway - install as shown.

 Install the CPU

 The CPU goes on top of the daughterboard assembly and is fastened by Phillips head machine screws.

So that does it for the hardware.  How about the software?

The Arduino IDE comes with an example program called "Arduino ISP".  Find it in File-Examples-ArduinoISP.  In the usual way, you can load it up and compile the program to the CPU using the IDE, or you can be hard-core and compile it independently.  For an example of how to compile and upload applications outside of the Arduino IDE, look here.

That's it for the software. The ISP is ready to use.

We won't dwell on probing & tweaking the inner workings of the CPU being programmed here.  We are just interested in a "proof of life" that the ISP is working and can communicate with the CPU.

 Make sure the USB serial programmer is disconnected from the CPU.  The ISP powers both itself and the CPU being programmed with that.
 Connect the CPU to be programmed.  Pay attention to the cable orientation.  Pin 1 on the cable connected to Pin 1 on the CPU.
 Plug in the USB serial programmer to power up the ISP

From the terminal, issue the following command.  See the notes section.
avrdude -P /dev/ttyUSB0 -b 19200 -c stk500v1 -p m328p -v -v

Windoze: (assuming you have the Arduino IDE Installed) - Arduino comes with WinAVR so something similar should work as well for stand alone WinAvr installations.
/pathtoarduing/hardware/tools/avr/bin/avrdude -C ..\etc\avrdude.conf -P COM9 -b 19200 -c stk500v1 -p m328p -v -v

  • You can replace the chip type in the "-p" with the one you are programming - the in present case m328p = ATmega328p
    The ISP will issue an error message if the type connected is not the same as the one specified in the command line.

  • Replace the -P device with the serial port the ISP is connected to - /dev/USB??? for Linux or COMx for Windoze.

If all goes well, you will see information similar to that below:

user@speedy-QuadCore ~ $ avrdude -P /dev/ttyUSB0 -b 19200 -c stk500v1 -p m328p -v -v

avrdude: Version 5.8, compiled on Jul 20 2009 at 13:58:01
         Copyright (c) 2000-2005 Brian Dean,
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/mdlougheed/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.12s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

That's all folks!

If you want to skip ahead and upload programs through the ISP, refer to the Building Applications Outside the Arduino IDE tutorial.  The 'upload' shell script can be modified to send your application files directly to the CPU - no bootloader required!