The ICSP (In Circuit Serial Programming) bus constists of six pins in a 2 x 3 box. Arranged like the cans in a six-pack.
The pins are 1 and 2 in the top row, left to right, 3 and 4 in the centre row, left to right and pins 5 and 6 in the bottom row, left to right. As shown in the following table.
The ICSP connections are essentially SPI (serial peripheral interface).
- MISO = Master in, slave out
- MOSI = Master out, slave in
- SCK = Serial clock
- Vcc, GND and Reset are self-explanatory
I have a number of programmers which are compatible with programming Arduinos via the ICSP port.
All of the programmers I have arrived with ribbon cables to connect the programmer to an ICSP port. In all cases pins 1, 3 and 5 were on the side of the plastic plug at each end of the lead which had the little pip standing out from its longer side.
And in all cases, the leads were grey, with pin 1 marked by a red conductor.
But the above might not be true for all examples of leads either supplied with programmers or made separately.
Holding the ribbon cable with the pip on the top, pin 1 is at the right and is marked by a red wire.
Be aware that a cable may either have been made with no regard to this as a standard, or may simply have been made incorrectly.
On all of the Arduino Unoboards I have, the pip on the female connector goes towards the middle of the board.
On all of the Arduino Nano boards I have, the pip is on the edge of the board on the opposite end from the USB connector.
My programmer of choice is the usbtiny. Available from a lot of sellers either in kit form or pre-made. The design of the PCB and the firmware are also Open Source.
Please note that programming an Arduino from the ICSP will over-write the bootloader that allows programming via the USB socket.
Unless you are flashing a new bootloader of course.
Flashing an Arduino via the ICSP bus will mean the lack of a bootloader means more space for your program.
It is a happy fact that in my experience, using the usbtiny programmer and avrdude on the Linux command-line, will not damage either an Arduino Nano or an Arduino Uno if the ICSP lead is plugged in the wrong way round.
Plug it in and use avrdude to read and identify the board.
Of course programming will not work if the lead is the wrong way round.