Lead In: ICSP is Microchip’s proprierty protocol for programming their extensive array of microcontrollers. In principle, the interface is shared across all families, with the programming methodology algorithm changing between families to deal with individual devices.
A typical implementation of ICSP is illustrated in the image below: the PICKIT 3 being used to program an ICSP configured target PCB from Microchip.
The advantage of the protocol is that when implemented correctly, it allows for SMD devices to be programmed in circuit. This feature can be invaluable for product deployments which would make removing the device itself both impossible and impractical. Cell phones are perhaps a good illustration, where you click and the update just happens. For a short while your embedded device is unusable, but once complete you have the latest software installed and up and running.
The Interface: The ICSP interface is quite simple with only 5 connections. The first two are power and ground. Then there is the reset line which is connected to MCLR. The final 2 are program clock and program data. In the 16Fxxx and the 18Fxxx families usualy have the ICSP interface on PORT B and this is characteristic of the 18, 28 and 40 PIN device families.
The inteface can be implemented physically using a 5/6 PIN header and with the PINs orientated in the correct way, the PICKIT 2/3 programmers from Microchip can be used to download the HEX file onto the target device.
To isolate the PICKIT ICSP interface form the target device a simple combination of 2 resisters and a jumper can be employed as a mechanical buffer. As seen in the image above, indicated by the labelling “isolation circuit“.
When the device is programmed, power must be disconnected.
The ICSP interface can run in normal programming mode or low voltage programming mode. When low voltage programming voltage mode is not used, then a power supply providing upwards of 13 Vdc is required to erase the program memory. This requirement necessitates a power supply that can deliver this dual supply voltage ie 5Vd/13Vdc; this would usually be a usage consideration if a 3rd party programmer were being used. Microchip’s programmers handle this requirement so that it is transparent to the user.
ICSP: Is the only way to deploy your hex code onto your device. A secondary way is bootloading, but this still requires the initial use of ICSP to install the bootloading software onto the target device.