Step 3: ICSP header pinout
This list is for 2x3 ICSP headers, if you want to use the 2x5 instead, see the image. It works just the same, but be sure to leave NC unconnected. Beware of the orientation!
Before proceeding please read the warning at the bottom of this page.
See the image below with the ICSP header pinout and do the following:
- Connect pin 1 of the ICSP header to the MISO pin of your MCU.
- Connect pin 2 of the ICSP header to your +5V supply on your board. So not necessarily to your Vcc pin on your MCU, simply put +5V on it.
- Connect pin 3 of the ICSP header to the SCK pin of your MCU.
- Connect pin 4 of the ICSP header to the MOSI pin of your MCU.
- Connect pin 5 of the ICSP header to the RESET pin of your MCU (usually pin 1)
- Connect pin 6 of the ICSP header to your ground (GND).
This takes some soldering and can be quite annoying, as the pins are quite near eachother. I'll spare you the sight of my perfboard's back view!
Now mark which is pin 1 near your ICSP header, and connect a cable to it.
Word of warning: if you connect your board to an external programmer through ICSP, 5V is put on pin 2! That means that this pin should directly connect to where-ever your 5V comes from (be it a 7805 or somewhere else). Your external programmer will automatically (usually) power your board through ICSP.
So here is the catch, if you have an external programmer connected and you don't have a protection diode, the 5V from the programmer will flow into the battery or power supply. Be sure to connect either the ICSP - OR - a battery/power supply, and never both. You can prevent electricity flowing back by adding a diode just after your battery/power supply or you can add another 3-pin connector with a jumper so you can swap the power supply. However, that would be something nice for a next Instructable.
As electricity goes two ways, I recommend disconnecting the ICSP cable whenever you have your external programmer switched off. Power would flow into the programmer, and I don't really think that this is healthy for your programmer.