Back

ICSP

Loading views...

ICSP

Category: Debug/Programming

Overview

ICSP (In-Circuit Serial Programming) is Microchip's proprietary 2-wire programming interface for PIC and dsPIC microcontrollers. It uses PGC (clock), PGD (data), VPP (programming voltage), VDD, and GND to program the device while mounted on the board.


1. Theory & Fundamentals

  • Pins: PGC (clock), PGD (data), VPP/MCLR (programming enable), VDD, GND
  • Programming voltage: VPP = 8.5โ€“13.5V on MCLR/VPP pin for high-voltage ICSP
  • Low-voltage ICSP (LVP): Programs at VDD; requires LVP fuse bit set
  • Interface: Microchip PICkit 3/4/5, MPLAB SNAP, ICD 4
  • Protocol: Proprietary Microchip; 2-wire serial with command set
  • JTAG variant: dsPIC33 supports JTAG in addition to ICSP

2. Frame / Packet Structure

Protocol-specific to ICSP.
See official documentation for complete frame formats.

3. Protocol Mechanics

  • Standard Debug/Programming mechanics apply
  • See hardware implementation for specific protocol flow

4. Hardware Implementation

  • Dedicated hardware probe/interface required
  • Standard MCU/embedded connection

5. Register-Level / Configuration

// ICSP requires Microchip MPLAB IPE or PICkit tool

// Typical production ICSP flow:

// 1. Assert VPP on MCLR (enter programming mode)

// 2. Load configuration: LOAD CONFIG command + config word

// 3. Bulk erase: BULK ERASE command

// 4. Write program memory: LOAD DATA + INCREMENT ADDRESS

// 5. Verify: READ DATA and compare

// 6. Release MCLR (exit programming mode)

// Tools: PICkit5, MPLAB IPE, pk3cmd CLI


6. Driver / Software Development

  • Implement send/receive based on protocol specification
  • Use official SDK or library where available

7. Debugging & Testing

  • Use official debug tools for analysis
  • Logic analyzer for signal verification
  • Common issues: Timing, voltage levels, clock configuration

8. Real-World Applications

  1. MCU programming in production
  2. In-system firmware updates
  3. Debug during development
  4. Post-mortem fault analysis
  5. Test automation

9. Advanced Topics & Edge Cases

  • Advanced features depend on specific MCU family
  • Security lock bits and read protection
  • Production programming automation

10. Standards & Variants

Interface MCU Family
ICSP See overview

๐Ÿ’ก Practical Examples

Ex 1: Basic usage โ€” connect probe and program device.

Ex 2: Read memory contents during debug session.

Ex 3: Set breakpoint and inspect register state.


๐Ÿงช Practice Questions

Beginner: 1) What MCUs use ICSP? 2) Pin count? 3) Programming vs debugging? 4) Required tools? 5) Entry sequence?

Intermediate: 1) Protocol timing. 2) Read/write commands. 3) Breakpoint types. 4) Security bypass? 5) Production programming flow.

Advanced: 1) Custom programmer implementation. 2) Automated test via ICSP. 3) Unlock locked device. 4) CI/CD integration. 5) Multi-device programming.


Checklist

  • [ ] Connect ICSP probe correctly
  • [ ] Program flash via ICSP
  • [ ] Set hardware breakpoint
  • [ ] Step through code
  • [ ] Read/write memory
  • [ ] Configure fuses/config bits
  • [ ] Automate with CLI tool
  • [ ] Handle security/lock bits