Microchip Technology MPLAB® ICD 3 User’s Guide

MPLAB® ICD 3
In-Circuit Debugger
User’s Guide
© 2008 Microchip Technology Inc. DS51766A
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device applications and t he lik e is provided only for your convenience and may be su perseded by upda t es . It is y our responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life supp ort and/or safety ap plications is entir ely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless M icrochip from any and all dama ges, claims, suits, or expenses re sulting from such use. No licens es are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron, dsPIC, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, rfPIC, SmartShunt and UNI/O are registered trademarks of Microchip Tec hnology Incorporated in the U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programmin g , IC SP, ICE P I C , M in d i , MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC
32
logo, PowerCal, PowerInfo, PowerMate, PowerT ool, REAL ICE, rfLAB, Select Mode, Total Endurance, WiperLock and ZENA are trademarks of Microchip Technology In corporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
®
MCUs and dsPIC® DSCs, KEELOQ
®
code hopping
DS51766A-page ii © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE
Table of Contents
Preface ........................................................................................................................... 1
Part 1 –Getting Started Chapter 1. Overview
1.1 Introduction .....................................................................................................9
1.2 MPLAB ICD 3 In-Circuit Debugger Defined ...................................................9
1.3 How the MPLAB ICD 3 In-Cir cuit Debugger Helps You ...............................10
1.4 MPLAB ICD 3 In-Circuit Debugger Kit Components ....................... .. ...........10
1.5 Device and Feature Support ..................... ...................................................11
Chapter 2. Theory of Operation
2.1 Introduction ...................................................................................................13
2.2 MPLAB ICD 3 In-Circuit Debugger vs. MPLAB ICE 2000/4000
In-Circuit Emulators ................................................................................ 13
2.3 MPLAB ICD 3 In-Circuit Debugger vs. MPLAB ICD 2 Debugger ....... ..........13
2.4 Debugger To Target Communication ................................. ...................... ....14
2.5 Communication Connections .......................................................................15
2.6 Debugging with the Debugger ......................................................................17
2.7 Requirem e n t s F o r D e b ugg ing .............. .. ... ............. .. .. .............. .. .................. 18
2.8 Programming with the Debugger ..................................................................20
2.9 Resources Used by the Debugger ...............................................................20
Chapter 3. Installation
3.1 Introduction ...................................................................................................21
3.2 Installing the Software .................................................................................. 21
3.3 Installing th e USB D e vi c e D r iv e rs ............. ............... .................................... 21
3.4 Connecti n g the T a rg e t ............................................ ...................................... 22
3.5 Setting Up the Target Board ......................................................................... 22
3.6 Setting Up MPLAB IDE ................................................................................ 23
Chapter 4. General Setup
4.1 Introduction ...................................................................................................25
4.2 Starting the MPLAB IDE Software ................................................................ 25
4.3 Creating a Project ......................................................................................... 26
4.4 Viewing the Pr o je c t ......... ..................................................................... ......... 26
4.5 Building the Pr o je c t ............. .................................................................... ..... 26
4.6 Setting Con figuration Bits ........ ............. .. ... .......................... .. ... ............. .. .. ... 27
4.7 Setting the Debugger as the Debugger or Programmer ....................... ........27
4.8 Debugger/Programmer Limitations ..............................................................27
© 2008 Microchip Technology Inc. DS51766A-page iii
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
Chapter 5. Tutorial
5.1 Introduction ................................................................... ................................29
5.2 Setting Up th e En v ir o n m e n t an d S e le c tin g th e Dev ice .......... ....................... 30
5.3 Creating the Application Code ......................................................................30
5.4 Running th e P roj e c t Wiz ar d .......................................................................... 33
5.5 Viewing the Pr o je c t .. ....................................................... .............................. 35
5.6 Viewing De bu g Op tions .......... ... .. ................................................................. 3 6
5.7 Creating a Hex Fi le ....................................................................................... 37
5.8 Setting Up the Demo Board ......................................................................... 39
5.9 Loading Program Code For Debugging .......................................................39
5.10 Running Debug Code ................................................................................. 40
5.11 Debugging Code Using Breakpoints ..........................................................40
5.12 Programming the Application ..................................................................... 45
Part 2 –Troubleshooting Chapter 6. Frequently Asked Questions (FAQs)
6.1 Introduction ................................................................... ................................49
6.2 How Does It Work ........................................................................................ 49
6.3 What’s Wrong ............................................................................................... 50
Chapter 7. Error Messages
7.1 Introduction ................................................................... ................................53
7.2 Specific Error Messages ..............................................................................53
7.3 General Co rr e ct iv e Ac t io n s .. ................ ........................................................ 57
Part 3 –Reference Chapter 8. Basic Debug Functions
8.1 Introduction ................................................................... ................................63
8.2 Breakpoin ts ......................................................... ......................................... 63
8.3 Stopwatch ... .................................................................................................. 63
Chapter 9. Debugger Function Summary
9.1 Introduction ................................................................... ................................65
9.2 Debugging Functions ................................................................................... 65
9.3 Debugging Dialogs/Windows .......................................................................68
9.4 Programm in g Fun c tions ..... .. ....................................................... ................. 73
9.5 Settings Dia lo g ............................................................................................. 74
DS51766A-page iv © 2008 Microchip Technology Inc.
Table of Contents
Chapter 10. Hardware Specification
10.1 Introd uc t io n ................................................................................................. 7 9
10.2 Highlig h t s ........... ......................................................................................... 79
10.3 Declar a tion of Conform ity ................................................ .. .. ....................... 79
10.4 USB Por t/Power ............. ... .. ............. .. .. ........................... .. .. .............. .. .. ..... 80
10.5 MPLAB ICD 3 Debugger ........................................... ......................... .. .. ....80
10.6 Standard Communication Hardware ..........................................................81
10.7 ICD 3 Te s t In te r fa c e Boa rd ......................................................................... 82
10.8 Target Board Considerations ..................................................................... 83
Glossary .......................................................................................................................85
Index .............................................................................................................................99
Worldwide Sales and Service ..................................................................................102
© 2008 Microchip Technology Inc. DS51766A-page v
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
NOTES:
DS51766A-page vi © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE

Preface

NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the p age number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document.
For the most up-to-date information on development tools, see the MPLAB Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
®
IDE on-line help.
This chapter contains general information that will be useful to know before using the MPLAB ICD 3 in-circuit debugger. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Revision History
DOCUMENT LAYOUT
This document describes how to use the MPLAB ICD 3 in-circuit debugger as a development tool to emulate and debug firmware on a target board, as well as how to program devices. The document is organized as follows:
Part 1 – Getting Started
Chapter 1. Overview – What the MPLAB ICD 3 in-circuit debugger is, and how it can help you develop your application.
Chapter 2. Theory of Operation – The theory of MPLAB ICD 3 in-circuit debug­ger operation. Explains configuration options.
Chapter 3. Ins tallation – How to install the debugger software and hardware.
Chapter 4. General Setup – How to set up MPLAB IDE to use the debugger.
Chapter 5. Tutorial – A brief tutorial on using the debugger.
© 2008 Microchip Technology Inc. DS51766A-page 1
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
Part 2 – Troubleshooting
Chapter 6. Frequently Asked Questions (FAQs) – A list of frequently asked questions, useful for troubleshooting.
Chapter 7. Error Messa ges – A list of error messages and suggested resolutions.
Part 3 Reference
Chapter 8. Basic Debug Functions – A description of basic debugger features available in MPLAB IDE when the MPLAB ICD 3 in-circuit debugger is chosen as either the debug or programming tool. This includes the debug features breakpoints, stopwatch, triggering and real-time watches.
Chapter 9. Debugger Function Summary – A summary of debugger functions available in MPLAB IDE when the MPLAB ICD 3 debugger is chosen as the debug or program tool.
Chapter 10. Hardware Specification – The hardware and electrical specifications of the debugger system.
DS51766A-page 2 © 2008 Microchip Technology Inc.
CONVENTIONS USED IN THIS GUIDE
This manual uses the following docum entat io n conven tion s:
DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic chara c ters Referenced books MPLAB
Initial caps A window the Output window
Quotes A field name in a window or
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
N‘Rnnnn A number in verilog format,
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Plain Courier New Sample source code #define START
Italic Courier New A variable argument file.o, where file can be
Square brackets [ ] Optional arguments mcc18 [options] file
Curly brackets and pipe character: { | }
Ellipses... Replaces r epeated text var_name [,
Preface
®
IDE User’s Guide
Emphasized text ...is the only compiler...
A dialog the Settings dialog A menu selection select Enable Programmer
“Save project before build”
dialog A menu path File>Save
A tab Click the Power tab
4‘b0010, 2‘hF1 where N is the tota l number of digits, R is th e radi x and n is a digit.
Filenames autoexec.bat File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ‘A’
any valid filename
[options]
Choice of mut ually exclus ive arguments; an OR selection
Represents code supplied by user
errorlevel {0|1}
var_name...]
void main (void)
{ ...
}
© 2008 Microchip Technology Inc. DS51766A-page 3
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in the Warranty Registration Card entitles users to receive new product updates. Interim software releases are available at the Microchip web site.
RECOMMENDED READING
This user's guide describes how to use MPLAB ICD 3 in-circuit debugger. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
Please read this first! This document contains important information about operational issues that should be considered when using the MPLAB ICD 3 with your target design
Release Notes for MPLAB ICD 3 In-Circuit Debugger
For the latest information on using MPLAB ICD 3 in-circuit debugger, read the “Readme for MPLAB ICD 3 Debugger.htm” file (an HTML file) in the Readmes subdirectory of the MPLAB IDE installation directory. The release notes (Readme) contains update information and known issues that may not be included in this user’s guide.
Using MPLAB ICD 3 In-Circuit Debugger Poster (DS51765)
This poster shows you how to hook up the hardware and install the software for the MPLAB ICD 3 in-circuit debugger using standard communications and a target board.
MPLAB ICD 3 In-Circuit Debugger On-line Help File
A comprehensive help file for the debugger is included with MPLAB IDE. Usage, troubleshooting and hardware specifications are covered. This may be more up-to-date than the printed documentation. Also, debugger reserved resources and limitations are listed for various devices.
Header Board Specification (DS51292)
This booklet describes how to install and use MPLAB ICD 3 in-circuit debugger headers. Headers are used to better debug selected devices using special -ICE device versions without the loss of pins or resources.
Transition Socket Specification (DS51194)
Consult this document for information on transition sockets available for use with MPLAB ICE 2000/4000 device adaptors, MPLAB ICD 2 headers and MPLAB ICD 3 in-circuit debugger headers.
DS51766A-page 4 © 2008 Microchip Technology Inc.
Preface
THE MICROCHIP WEB SITE
Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information:
Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software
General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing
Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest.
To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions.
The Development Systems product group categories are:
Compilers – The latest info rmatio n on Microc hip C comp ilers, as semblers , linker s and other language tools. These include all MPLAB C compilers; all MPLAB assemblers (including MPASM™ assembler); all MPLAB linkers (including MPLINK™ object linker); and all MPLAB librarians (including MPLIB™ object librarian).
Emulators – The latest information on Microchip in-circuit emulators.These include the MPLAB REAL ICE™, MPLAB ICE 2000 and MPLAB ICE 4000 in-circuit emulators
In-Circuit Debuggers – The latest information on the Microchip in-circuit debuggers, the MPLAB ICD 2 in-circuit debugger and PICkit™ 2 debug express.
MPLAB Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and MPLAB SIM simulator, as well as general editing and debugging features.
Programmers – The latest information on Microchip programmers. These include the MPLAB PM3 and PRO MATE II device programmers and the PICSTART Plus and PICkit 1 and 2 development programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
© 2008 Microchip Technology Inc. DS51766A-page 5
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com.
REVISION HISTORY
Revision A (September 2008)
This is the initial release of this document.
DS51766A-page 6 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE

Part 1 – Getting Started

Chapter 1. Overview.......................................................................................................9
Chapter 2. Theory of Operation..................................................................................13
Chapter 3. Installation..................................................................................................21
Chapter 4. General Setup......................................... ...................................................25
Chapter 5. Tutorial ........................................................................................................29
© 2008 Microchip Technology Inc. DS51766A-page 7
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
NOTES:
DS51766A-page 8 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE

Chapter 1. Overview

1.1 INTRODUCTION

An overview of the MPLAB ICD 3 in-circuit debugger system is given.
• MPLAB ICD 3 In-Circuit Debugger Defined
• How the MPLAB ICD 3 In-Circuit Debugger Helps You
• MPLAB ICD 3 In-Circuit Debugger Kit Components
• Device and Feature Support

1.2 MPLAB ICD 3 IN-CIRCUIT DEBUGGER DEFINED

The MPLAB ICD 3 in-circuit debugger is an in-circuit debugger that is controlled by a PC running MPLAB IDE (v8.15 or greater) software on a Windows MPLAB ICD 3 in-circuit debugger is an integral part of the development engineer's toolsuite. The application usage can vary from software development to hardware integration.
The MPLAB ICD 3 in-circuit debugger is a complex debugger system used for hardware and software development of Microchip PIC
®
dsPIC Programming™ (ICSP™) and Enhanced In-Circuit Serial Programming 2-wire serial interfaces.
The debugger system will execute code like an actual device because it uses a device with built-in emulation circuitry, instead of a special debugger chip, for emulation. All available features of a given device are accessible interactively, and can be set and modified by the MPLAB IDE interface.
The MPLAB ICD 3 debugger was developed for emulating embedded processors with rich debug facilities which differ from conventional system processors in the following aspects:
• Processors run at maximum speeds
• Capability to incorporate I/O port data input
In addition to debugger functions, the MPLAB ICD 3 in-circuit debugger system also may be used as a development programmer.
Digital Signal Controllers (DSCs) that are based on In-Circuit Serial
®
microcontrollers (MCUs) and
®
platform. The
© 2008 Microchip Technology Inc. DS51766A-page 9
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
MPLAB® ICD 3
Modular Cable to Target Board
USB Cable to PC
Indicator Lights
or Header

1.3 HOW THE MPLAB ICD 3 IN-CIRCUIT DEBUGGER HELPS YOU

The MPLAB ICD 3 in-circuit debugger system allows you to:
• Debug your application on your own hardware in real time
• Debug with hardware breakpoints
• Debug with software breakpoints
• Set breakpoints based on internal events
• Monitor internal file register s
• Emulate full speed
• Program your device

1.4 MPLAB ICD 3 IN-CIRCUIT DEBUGGER KIT COMPONENTS

The components of the MPLAB ICD 3 in-circuit debugger system kit are:
1. MPLAB ICD 3 with indicator lights
2. USB cable to provide communications between the debugger and a PC and to provide power to the debugger
3. Cable (also MPLAB ICD 2 compatible) to connect the MPLAB ICD 3 to a header module or target board
4. MPLAB IDE Quick Start Guide (DS51281)
5. CD-ROM with MPLAB IDE software and on-line documentation
6. ICD 3 Test Interface Board
FIGURE 1-1: BASIC DEBUGGER SYSTEM
Additional hardware that may be ordered separately:
• Transition socket
• ICD headers
• MPLAB processor extension kits
DS51766A-page 10 © 2008 Microchip Technology Inc.

1.5 DEVICE AND FEATURE SUPPORT

Feature PIC32MX
dsPIC33F,
PIC24F/H
dsPIC30F
SMPS
(1)
dsPIC30F
Reset application C C C C Run, Halt
C C C C
Single Step C C C C Animate C C C C Full Speed Emulation
C C C C
Hardware Breakpoints C C C C Advanced Breakpoints C C C C Software Breakpoint s
N C C C
Peripheral Freeze
(2)
C C C C
Break on data fetch or write
C C C C
Break on Stack overflow
C C C C
Stopwatch C C C N Pass Counter C C C C WDT overflow
C C C N
Standard Speed Comm.
C C C C
Processor Pak
N F F N
Legend: C = Current support D = Support dependent on device F = No support now, but planned in the future N = Support Not Available
Note 1: Current Switch Mode Power Supply (SMPS) devices: dsPIC30F1010/2020/2023.
2: This feature operates differently depending on the selected device.
Table 1-1 and Table 1-2 show the current and future support for devices and device features.
TABLE 1-1: 32-BIT AND 16-BIT (DATA MEMORY) DEVICES
Overview
© 2008 Microchip Technology Inc. DS51766A-page 11
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
Feature PIC18FXXJ
PIC18F,
PIC18F Enh,
PIC18FXXK
PIC12F, PIC16F
Reset application C C C Run, Halt C C C Single Step C C C Animate
C C C
Full Speed Emulation C C C Hardware Breakpoints C C C Advanced Breakpoints
C C N
Software Breakpoint s C C N Peripheral Freeze
(1)
C C C
Break on data fetch or write
C C N
Break on Stack overflow
C C N
Stopwatch
C N N
Pass Counter
C C N
WDT overflow C N N Standard Speed Comm. C C C Processor Pak
F F F
Legend: C = Current support F = No support now, but planned in the future N = Support Not Available
Note 1: This feature operates differently depending on the selected device.
TABLE 1-2: 8-BIT (DATA MEMORY) DEVICES
DS51766A-page 12 © 2008 Microchip Technology Inc.

Chapter 2. Theory of Operation

2.1 INTRODUCTION

A simplified description of how the MPLAB ICD 3 in-circuit debugger system works is provided here. It is intended to provide enough information so a target board can be designed that is compatible with the debugger for both emulation and programming operations. The basic theory of in-circuit emulation and programming is described so that problems, if encountered, are quickly resolved.
• MPLAB ICD 3 In-Circuit Debugger vs. MPLAB ICE 2000/4000 In-Circuit
Emulators
• MPLAB ICD 3 In-Circuit Debugger vs. MPLAB ICD 2 Debugger
• Debugger To Target Communication
• Communication Connection s
• Debugging with the Debugger
• Requirements For Debugging
• Programming with the Debugger
• Resources Used by the Debugger
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE

2.2 MPLAB ICD 3 IN-CIRCUIT DEBUGGER VS. MPLAB ICE 2000/4000 IN-CIRCUIT EMULATORS

The MPLAB ICD 3 in-circuit debugger system is a next generation In-Circuit Debugger (ICD) system. It differs from classical in-circuit emulator systems (e.g., MPLAB ICE 2000/4000) in a single, but important way: the production device and emulation device are the same.
This is a great benefit since differences (errata) between the production silicon and emulation silicon are eliminated. Additionally, as devices continue to operate at faster speeds, traditional emulator systems present bottlenecks caused by internal busses that must be carried off-chip to external memories and cannot offer full speed emulation.
Another significant benefit is that there is no lead time between production silicon and emulation silicon. Further, a problem encountered on a production board can be easily debugged without having to install transition sockets and dealing with complicated cabling systems and setups to have access to the application.

2.3 MPLAB ICD 3 IN-CIRCUIT DEBUGGER VS. MPLAB ICD 2 DEBUGGER

The MPLAB ICD 3 in-circuit debugger system is similar in function to the MPLAB ICD 2 in-circuit debugger system, but surpasses it in speed and functionality. The MPLAB ICD 3 also:
• Features USB high speed
• Is USB powered
• Is a hardware accelerator
• Provides a programmable voltage power supply
• Eliminates the RS-232 port
• Includes a diagnostic self-test interface board
© 2008 Microchip Technology Inc. DS51766A-page 13
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
MPLAB® ICD 3
Target Board
Target Device
or PIM
Power

2.4 DEBUGGER TO TARGET COMMUNICATION

The debugger system configurations are discussed in the following sections.
CAUTION
Do not connect the hardware before installing the software and USB drivers. Also, do not change hardware connections when the pod or target is powered.
Standard ICSP Device Communication
The debugger system can be configured to use standard ICSP communication for both programming and debugging functions. This 6-pin connection is the same one used by the MPLAB ICD 2 in-circuit debugger.
The modular cable can be either (1) inserted into a matching socket at the target, where the target device is on the target board (Figure 2-1), or (2) inserted into a standard adapter/header board combo (available as a Processor Pak), which in then plugged into the target board (Figure 2-2).
Note: Older header boards used a 6-pin (RJ-11) connector instead of an 8-pin
connector, so these headers may be connected directly to the debugger.
For more on standard communication, see Chapter 10. “Hardware Specification”.
FIGURE 2-1: STANDARD DEBUGGER SYSTEM – DEVICE WITH
ON-BOARD ICE CIRCUITRY
DS51766A-page 14 © 2008 Microchip Technology Inc.
Theory of Operation
MPLAB® ICD 3
Target Board
Transition Socket
Device-ICE
Processor Pak
Standard
Adapter
Header
Device-ICE
ICD Header
OR
Power
12345
6
Target
Connector
Target Bottom Side
PC Board
VPP/MCLR
Vss
PGC
V
DD
PGD
LVP
FIGURE 2-2: STANDARD DEBUGGER SYSTEM – ICE DEVICE

2.5 COMMUNICATION CONNECTIONS

2.5.1 Standard Communicat ion Target Connection
Using the RJ-11 connector, the MPLAB ICD 3 in-circuit debugger is connected to the target device with the modular interface (six conductor) cable. The pin numbering for the connector is shown from the bottom of the target PC board in Figure 2-3.
Note: Cable connections at the debugger and target are mirror images of each
other, i.e., pin 1 on one end of the cable is connected to pin 6 on the other end of the cable. See Section 10.6.2.3 “Modular Cable Specification”.
FIGURE 2-3: STANDARD CONNECTION AT TARGET
© 2008 Microchip Technology Inc. DS51766A-page 15
2.5.2 Target Connection Circuitry
Figure 2-4 shows the interconnections of the MPLAB ICD 3 in-circuit debugger to the connector on the target board. The diagram also shows the wiring from the connector to a device on the target PC board. A pull-up resistor (usually around 10 kΩ) is recommended to be connected from the V strobed low to reset the device.
PP/MCLR line to VDD so that the line may be
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
V
DD
VPP/MCLR
PGC
PGD
V
SS
AV
DD
AV
SS
2
1 5 4 3
User Reset
4.7K-10K
Interface
Connector
Application
PC Board
Device
FIGURE 2-4: STANDARD CONNECTION TARGET CIRCUITRY
2.5.3 Target Powered
In the following descriptions, only three lines are active and relevant to core debugger operation: pins 1 ( V shown on Figure 2-4 for completeness. MPLAB ICD 3 has two configurations for powering the target device: internal debugger and external target power.
The recommended source of power is external and derived from the target application. In this configuration, target V the target low voltage operation. If the debugger does not sense voltage on its V (pin 2 of the interface connector), it will not operate.
PP/MCLR), 5 (PGC) and 4 (PGD). Pins 2 (VDD) and 3 (VSS) are
DD is sensed by the debugger to allow level translation for
DD line
2.5.4 Debugger Powered
The internal debugger power is limited in two aspects: (1) the voltage range is not as wide (3-5V); and (2) the amount of current it can supply is limited to 100 mA. This may be of benefit for very small applications that have the device V rest of the application circuit for independent programming, but is not recommended for general usage as it imposes more current demands from the USB power system derived from the PC.
Be aware that the target V
DD is sensed by the debugger to allow level translation for
target low-voltage operation. If the debugger does not sense voltage on its V 2 of the interface connector), it will not operate.
Not all devices have the AV
DD and AVSS lines, but if they are present on the target
device, all must be connected to the appropriate levels in order for the debugger to operate.
In general, it is recommended that all V the appropriate levels. Also, devices with a V
DD/AVDD and VSS/AVSS lines be connected to
CAP line (PIC18FXXJ for example) should
be connected to the appropriate capacitor or level.
Note: The interconnection is very simple. Any problems experienced are often
caused by other connections or components on these critical lines that
DS51766A-page 16 © 2008 Microchip Technology Inc.
interfere with the operation of the MPLAB ICD 3 in-circuit debugger system, as discussed in the following section.
DD separated from the
DD line (pin
Theory of Operation
No!
No!
No!
No!
VPP/MCLR
PGC PGD
1
5
4
Interface
Connector
2.5.5 Circuits That Will Prevent the Debugger From Functioning
Figure 2-5 shows the active debugger lines with some components that will prevent the MPLAB ICD 3 in-cir cu it debu gge r sy st em from func tio nin g.
FIGURE 2-5: IMPROPER CIRCUIT COMPONENTS
Specifically, these guidelines must be followed:
• Do not use pull-ups on PGC/PGD – they will disrupt the voltage levels, since these lines have 4.7 kΩ pull-down resistors in the debugger.
• Do not use capacitors on PGC/PGD – they will prevent fast transitions on data and clock lines during programming and debug communications.
• Do not use capacitors on MCLR simple pull-up resistor is generally sufficient.
• Do not use diodes on PGC/PGD – they will prevent bidirectional communication between the debugger and the target device.
– they will prevent fast transitions of VPP. A

2.6 DEBUGGING WITH THE DEBUGGER

There are two steps to using the MPLAB ICD 3 in-circuit debugger system as a debugger. The first requires that an application be programmed into the target device. The second uses the internal in-circuit debug hardware of the target Flash device to run and test the application program. These two steps are directly related to the MPLAB IDE operations:
1. Programming the code into the target and activating special debug functions
(see the next section for details).
2. Using the debugger to set breakpoints and run.
If the target device cannot be programmed correctly, the MPLAB ICD 3 in-circuit debugger will not be able to debug.
Figure 2-6 shows the basic interconnections required for programming. Note that this is the same as Figure 2-4, but for the sake of clarity, the V debugger are not shown.
© 2008 Microchip Technology Inc. DS51766A-page 17
DD and VSS lines from the
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
+5V
Programming
4.7 k
Ω
4.7 k
Ω
VPP/MCLR
PGC
PGD
1
5
4
Internal Circuits
V
SS
V
DD
Voltage
FIGURE 2-6: PROPER CONNECTIONS FOR PROGRAMMING
A simplified diagram of some of the internal interface circuitry of the MPLAB ICD 3 in-circuit debugger is shown. For programming, no clock is needed on the target device, but power must be supplied. When programming, the debugger puts programming levels on V PGD. To verify that the part has been programmed correctly, clocks are sent to PGC and data is read back from PGD. This conforms to the ICSP protocol of the device under development.
PP/MCLR, sends clock pulses on PGC and serial data via

2.7 REQUIREMENTS FOR DEBUGGING

To debug (set breakpoints, see registers, etc.) with the MPLAB ICD 3 in-circuit debugger system, there are critical elements that must be working correctly:
• The debugger must be connected to a PC. It must be powered by the PC via the USB cable, and it must be communicating with the MPLAB IDE software via the USB cable. See Chapter 3. “Installation” for details.
• The debugger must be connected as shown to the V target device with the modular interface cable (or equivalent). V also required to be connected between the debugger and target device.
• The target device must have power and a functional, running oscillator. If the target device does not run, for any reason, the MPLAB ICD 3 in-circuit debugger cannot debug.
• The target device must have its configuration words programmed correctly:
- The oscillator Configuration bits should correspond to RC, XT , etc., depending
upon the target design.
- For some devices, the Watchdog Timer is enabled by default and needs to be
disabled.
- The target device must not have code protection enabled.
- The target device must not have table read protection enabled.
• LVP should be disabled.
Once the above conditions are met, you may proceed to the following:
• Sequence of Operations Leading to Debugging
• Debugging Details
2.7.1 Sequence of Operations Leading to Debugging
Given that the Requirements For Debugging are met, these actions can be performed when the MPLAB ICD 3 in-circuit debugger is set as the current debugger from the MPLAB IDE menu (Debugger>Select Tool>MPLAB ICD 3
• The application code is compiled/assembled by selecting Project>Build
DS51766A-page 18 © 2008 Microchip Technology Inc.
PP, PGC and PGD pins of the
SS and VDD are
):
Theory of Operation
+5V
+12V
4.7 k
Ω
4.7 k
Ω
Internal Circu its
Program
Memory
File
Registers
Internal
Debug
Registers
VPP/MCLR
PGC
PGD
1
5
4
Executive
Debug
Area Used by
Target
be
Running
must
for Debug Executive to Function
Area
VDD
Hardware Stack Shared by Debug Exec
Debug Exec
Reserved for Debug
Executive
Configuration>Debug.
• When Debugger>Program the device’s memory via the ICSP protocol as described above.
• A small “debug executive” program is loaded into the high area of program memory of the target device. Since the debug executive must reside in program memory, the application program must not use this reserved space. Some devices have special memory areas dedicated to the debug executive. Check your device data sheet for details.
• Special “in-circuit debug” registers in the target device are enabled. These allow the debug executive to be activated by the debugger.
• The target device is held in Reset by keeping the V
2.7.2 Debugging Details
Figure 2-7 illustrates the MPLAB ICD 3 in-circuit debugger system when it is ready for debugging.
is selected, the application code is programmed into
PP/MCLR line low.
FIGURE 2-7: MPLAB
®
ICD 3 IN-CIRCUIT DEBUGGER READY FOR
DEBUGGING
Typically , in order to find out if an application program will run correctly, a breakpoint is set early in the program code. When a breakpoint is set from the user interface of MPLAB IDE, the address of the breakpoint is stored in the special internal debug registers of the target device. Commands on PGC and PGD communicate directly to these registers to set the breakpoint address.
Next, the Debugger>Run from MPLAB IDE. The debugger will then tell the debug executive to run. The target will start from the Reset vector and execute until the Program Counter reaches the breakpoint address previously stored in the internal debug registers.
After the instruction at the breakpoint address is executed, the in-circuit debug mechanism of the target device “fires” and transfers the device’s Program Counter to the debug executive (much like an interrupt) and the user’s application is effectively halted. The debugger communicates with the debug executive via PGC and PGD, gets the breakpoint status information and sends it back to MPLAB IDE. MPLAB IDE then sends a series of queries to the debugger to get information about the target device, such as file register contents and the state of the CPU. These queries are ultimately performed by the debug executive.
function or the Run icon (forward arrow) is usually pressed
© 2008 Microchip Technology Inc. DS51766A-page 19
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
The debug executive runs just like an application in program memory. It uses some locations on the stack for its temporary variables. If the device does not run, for whatever reason, such as no oscillator, a faulty power supply connection, shorts on the target board, etc., then the debug executive cannot communicate to the MPLAB ICD 3 in-circuit debugger and MPLAB IDE will issue an error message.
Another way to get a breakpoint is to press the MPLAB IDE’s Halt button (the “pause” symbol to the right of the Run arrow). This toggles the PGC and PGD lines so that the in-circuit debug mechanism of the target device switches the Program Counter from the user’s code in program memory to the debug executive. Again, the target application program is effectively halted, and MPLAB IDE uses the debugger communications with the debug executive to interrogate the state of the target device.

2.8 PROGRAMMING WITH THE DEBUGGER

Use the MPLAB ICD 3 in-circuit debugger as a programmer to program an actual (non
-ICE/-ICD) device, i.e., a device not on a header board. Select “MPLAB ICD 3” from
Programmer>Select Programmer
the “Build Configuration” list box on the MPLAB IDE toolbar set to “Release”. Also, it may be set by se lecting Project>Build Configuration>Release
All debug features are turned off or removed when the debugger is used as a programmer. When using the Programmer>Program MPLAB IDE will disable the in-circuit debug registers so the MPLAB ICD 3 in-circuit debugger will program only the target application code and the Configuration bits (and EEPROM data, if available and selected) into the target device. The debug executive will not be loaded. As a programmer, the debugger can only toggle the MCLR reset and start the target. A breakpoint cannot be set, and register contents cannot be seen or altered.
The MPLAB ICD 3 in-circuit debugger system programs the target using ICSP. V PGC and PGD lines should be connected as described previously. No clock is required while programming, and all modes of the processor can be programmed, including code protect, Watchdog Timer enabled and table read protect.
and compile/assemble your application code with
.
selection to program a device,
line to
PP,

2.9 RESOURCES USED BY THE DEBUGGER

For a complete list of resources used by the debugger for your device, please see the on-line help file in MPLAB IDE for the MPLAB ICD 3 in-circuit debugger.
DS51766A-page 20 © 2008 Microchip Technology Inc.

Chapter 3. Installation

3.1 INTRODUCTION

How to install the MPLAB ICD 3 in-circuit debugger system is discussed.
• Installing the Software
• Installing the USB Device Drivers
• Connecting the Target
• Setting Up the Target Board
• Setting Up MPLAB IDE

3.2 INSTALLING THE SOFTWARE

To install the MPLAB IDE software, first acquire the latest MPLAB IDE installation executable (MPxxxxx.exe, where xxxxx represents the version of MPLAB IDE) from either the Microchip web site (www.microchip.com) or the MPLAB IDE CD-ROM (DS51123). Then run the executable and follow the screens to install MPLAB IDE.
Note: MPLAB IDE v8.15 or greater is required to use the MPLAB ICD 3 in-circuit
debugger.
MPLAB® ICD 3 IN-CIRCUIT
DEBUGGER USER’S GUIDE

3.3 INSTALLING THE USB DEVICE DRIVERS

Installing MPLAB IDE will preinstall the USB device drivers for the MPLAB ICD 3 in-circuit debugger. Therefore, once you have installed MPLAB IDE, connect the debugger to the PC with a USB cable and follow the Windows “New Hardware Wizard” to automatically install the drivers.
Expanded USB device driver installation instructions may found at:
MPLAB IDE installation directory\ICD 3\Drivers\ddri.htm
Note: If a new MPLAB ICD 3 is connected to your PC, you will need to reinstall
the drivers for the new unit.
© 2008 Microchip Technology Inc. DS51766A-page 21
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
USB/Power
From PC
Communications Cable
From Target
2
1
MPLAB® ICD 3

3.4 CONNECTING THE TARGET

A connection is built-in to select the type of communication with the target. See Section 2.4 “Debugger To Target Communication” for more details and a diagram.
1. Plug in the USB/power cable if not already connected.
2. Attach the communication cable(s) between debugger and target.
FIGURE 3-1: INSERT COMMUNICATIONS AND USB/POWER CABLES

3.5 SETTING UP THE TARGET BOARD

The target must be set up for the type of target device to be used.
3.5.1 Using Production Devices
For production devices, the debugger may be connected directly to the target board. The device on the target board must have built-in debug circuitry in order for the MPLAB ICD 3 in-circuit debugger to perform emulation with it. Consult the device data sheet to see if the device has the needed debug circuitry, i.e., it should have a “Background Debugge r Enab le ” Configuration bit.
Note: In the future, devices with circuitry that support ICD may be used.
The target board must have a connector to accommodate the communications chosen for the debugger. For connection information, see Section 2.4 “Debugger To Target
Communication”, “Standard ICSP Device Communication”.
3.5.2 Using ICE Devices
For ICE devices, an ICE header board is required. The header board contains the hardware necessary to emulate a specific device or family of devices. For more information on ICE headers, see the “Header Board Specification” (DS51292).
Note: In the future, ICD header boards with ICD devices (Device-ICD) may be
used.
DS51766A-page 22 © 2008 Microchip Technology Inc.
Installation
A transition socket is used with the ICE header to connect the header to the target board. Transition sockets are available in various styles to allow a common header to be connected to one of the supported surface mount package styles. For more information on transition sockets, see the “Transition Socket Specification” (DS51 194).
Header board layout will be different for headers or processor extension packs. For connection information, see Section 2.4 “Debugger To Target Communication”, “Standard ICSP Device Communication”.
3.5.3 Powering the Target
There are a couple of configurations for powering MPLAB ICD 3 and the target. These are configuration essentials:
• When using the USB connection, MPLAB ICD 3 can be powered from the PC but it can only provide a limited amount of current, up to 100 mA, at V a small target board.
• The desired method is for the target to provide V voltage range from 2-5V. The additional benefit is that plug-and-play target detection facility is inherited, i.e., MPLAB IDE will let you know in the Output window when it has detected the target and has detected the device.
Note: The target voltage is only used for powering up the drivers for the ICSP
interface; the target voltage does not power up the MPLAB ICD 3. The MPLAB ICD 3 system power is derived strictly from the USB port.
DD as it can provide a wider
DD from 3-5V t o
If you have not already done so, connect the MPLAB ICD 3 to the target using the appropriate cables (see Section 3.4 “Connecting the Target”). Then pow er the target. If you are powering the target through the MPLAB ICD 3, see
Section 9.5.8 “Settings Dialog, Power Tab” for instructions.

3.6 SETTING UP MPLAB IDE

Once the hardware is connected and powered, MPLAB IDE may be set up for use with the MPLAB ICD 3 in-circuit debugger.
On some devices, you must select the communications channel in the Configuration bits, e.g., PGC1/EMUC1 and PGD1/EMUD1. Make sure the pins selected here are the same ones physically connected to the device.
For more on setting up a project and getting started with MPLAB ICD 3, see Chapter
4. “General Setup”.
To walk through the process of programming and debugging a device with the MPLAB ICD 3, see Chapter 5. “Tutorial”.
© 2008 Microchip Technology Inc. DS51766A-page 23
MPLAB® ICD 3 In-Circuit Debugger User’s Guide
NOTES:
DS51766A-page 24 © 2008 Microchip Technology Inc.
Loading...
+ 78 hidden pages