Summary of Understanding ICSP for PIC Microcontrollers
This article explains the concept of In-Circuit Serial Programming (ICSP) for Microchip PIC microcontrollers, highlighting its advantages over traditional programming methods, especially for surface-mount packages. ICSP allows programming a PIC chip directly on the application board using five essential connections: power (Vdd), ground (Vss), programming voltage (Vpp), clock (PGC), and data (PGD). This eliminates the need for expensive sockets or clips and chip swapping during development. The article also guides readers on how to identify ICSP pins on PIC datasheets and match them with programmer connections.
Parts used in the PIC ICSP Programmer Project:
- Microchip PIC microcontroller (various models)
- 5-pin header for ICSP connection
- Power supply (Vdd)
- Ground connection (Vss)
- Programming voltage source (Vpp, ~13V)
- Clock line (PGC, usually PORTB6)
- Data line (PGD, usually PORTB7)
Programming microcontrollers isn’t hard. Building a programmer makes a great first electronics project. The goal of this instructable is to explain the simple ‘in circuit serial programming’ method used with Microchip PICs.
Step 1: Why ICSP?
Programming a big DIP (through hole) chip is easy. Pop it into a socketed programmer, burn, and return to the application circuit. Test and repeat.
Things get more difficult with smaller (surface mount) chips. There are no standard sockets for QFN, SSOP, QFP, or even the large SOIC .300 packages. There are really expensive ($100s) clips that can attach to, and program, these chips. A different clip is needed for each chip type and pin count you use.
There is an alternative. Its called ICSP.
ICSP means ‘in circuit serial programmer(ing?)’. It is a way of programming a PIC while it is still attached to the application circuit. Thats right, no more chip swapping.
Why ICSP?
1. There are no programming sockets for small package chips. Clips are expensive.
2. Its a pain to move chips in & out of the programmer during development. Impossible for surface mount parts.
Step 2: What is ICSP?
Five connections are needed to program a PIC while attached to an application circuit. I add a 5 pin header to my circuit boards to make this connection quick and easy.
The basics of PIC programming.
Five connections are required to program a PIC. Power, ground, a programming voltage, clock, and data.
+ (Vdd)/-(Vss) These are the power & ground connections (Vdd, Vss). Pretty standard. If you are using a programmer with ‘real’ voltage levels (NOT a JDM2!), your application can run from its own power supply when programmed, eliminating these connections.
Vpp This is the programming voltage. PICs enter programming mode when ~13 volts are placed on the MCLR/Vpp pin (usually pin 1 on modern PICs, more on that below).
Clock/Data or PGC/PGD The clock and data lines are used to write and read the PIC firmware. These are usually the same pins as PORTB6 & PORTB7.
Exercise: Identify the ICSP connection points on the PICs in the pictures below.
If the PIC fits, wear it.
I get a lot of questions about my JDM2 design on instructables. The most frequent is “Will it program PIC X?'”‘ – here is how you can tell:
1) Look at the data sheet. Find the ‘Pin Diagram’ that looks something like the picture below.
2) Identify the location of the pins that must be connected for programming (Vpp, Vdd, Vss, Data, & Clock).
3) Look at the socket connection on the programmer. Can you match the required pins with a socket on the programmer?
For more detail: Understanding ICSP for PIC Microcontrollers