MPLAB® ICD 3 In-Circuit Debugger User’s Guide © 2008 Microchip Technology Inc.
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.
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.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Chapter 5. Tutorial 5.1 Introduction ................................................................................................... 29 5.2 Setting Up the Environment and Selecting the Device ................................. 30 5.3 Creating the Application Code ...................................................................... 30 5.4 Running the Project Wizard .......................................................................... 33 5.
Table of Contents Chapter 10. Hardware Specification 10.1 Introduction ................................................................................................. 79 10.2 Highlights .................................................................................................... 79 10.3 Declaration of Conformity ........................................................................... 79 10.4 USB Port/Power .........................................................................................
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.
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 Messages – 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.
Preface CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Initial caps Quotes Underlined, italic text with right angle bracket Bold characters N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Represents Referenced books Emphasized text A window A dialog A menu selection A field name in a window or dialog A menu path MPLAB® IDE User’s Guide ...is the only compiler...
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.
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.
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.
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 .................................................
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. • • • • 1.2 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 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.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 1.3 HOW THE MPLAB ICD 3 IN-CIRCUIT DEBUGGER HELPS YOU The MPLAB ICD 3 in-circuit debugger system allows you to: • • • • • • • 1.
Overview 1.5 DEVICE AND FEATURE SUPPORT Table 1-1 and Table 1-2 show the current and future support for devices and device features.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide TABLE 1-2: 8-BIT (DATA MEMORY) DEVICES 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 Breakpoints 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 overf
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE 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 User’s Guide 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.
Theory of Operation FIGURE 2-2: STANDARD DEBUGGER SYSTEM – ICE DEVICE MPLAB® ICD 3 Processor Pak Standard Adapter Header Device-ICE OR ICD Header Transition Socket Device-ICE Target Board Power 2.5 COMMUNICATION CONNECTIONS 2.5.1 Standard Communication 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.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide FIGURE 2-4: STANDARD CONNECTION TARGET CIRCUITRY User Reset Application PC Board VDD Device 4.7K-10K VPP/MCLR 1 PGC 5 PGD 4 VSS 3 AVDD AVSS 2.5.3 2 Interface Connector Target Powered In the following descriptions, only three lines are active and relevant to core debugger operation: pins 1 (VPP/MCLR), 5 (PGC) and 4 (PGD). Pins 2 (VDD) and 3 (VSS) are shown on Figure 2-4 for completeness.
Theory of Operation 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-circuit debugger system from functioning. FIGURE 2-5: IMPROPER CIRCUIT COMPONENTS 1 VPP/MCLR No! No! No! 5 PGC 4 PGD No! Interface Connector 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.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide FIGURE 2-6: PROPER CONNECTIONS FOR PROGRAMMING VDD Programming Voltage +5V 1 Internal Circuits 4.7 kΩ 5 4 VPP/MCLR PGC PGD 4.7 kΩ VSS 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 VPP/MCLR, sends clock pulses on PGC and serial data via PGD.
Theory of Operation Configuration>Debug. • When Debugger>Program is selected, the application code is programmed into 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.
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.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 3. Installation 3.1 INTRODUCTION How to install the MPLAB ICD 3 in-circuit debugger system is discussed. • • • • • 3.2 Installing the Software Installing the USB Device Drivers Connecting the Target Setting Up the Target Board Setting Up MPLAB IDE INSTALLING THE SOFTWARE To install the MPLAB IDE software, first acquire the latest MPLAB IDE installation executable (MPxxxxx.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 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 MPLAB® ICD 3 Communications Cable 1 From Target 2 USB/Power From PC 3.
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” (DS51194). Header board layout will be different for headers or processor extension packs. For connection information, see Section 2.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 24 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 4. General Setup 4.1 INTRODUCTION How to get started using the MPLAB ICD 3 in-circuit debugger is discussed. • • • • • • • 4.2 Starting the MPLAB IDE Software Creating a Project Viewing the Project Building the Project Setting Configuration Bits Setting the Debugger as the Debugger or Programmer Debugger/Programmer Limitations STARTING THE MPLAB IDE SOFTWARE After installing the MPLAB IDE software (Section 3.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 4.3 CREATING A PROJECT The easiest way to create a new project is to select Project>Project Wizard. With the help of the Project Wizard, a new project and the language tools for building that project can be created. The wizard will guide you through the process of adding source files, libraries, linker scripts, etc., to the various “nodes” on the project window. See MPLAB IDE documentation for more detail on using this wizard.
General Setup 4.6 SETTING CONFIGURATION BITS Although device Configuration bits may be set in code, they also may be set in the MPLAB IDE Configuration window. Select Configure>Configuration Bits. By clicking on the text in the “Settings” column, these can be changed. Some Configuration bits of interest are: • Watchdog Timer Enable – On most devices, the Watchdog Timer is enabled initially. It is usually a good idea to disable this bit.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 28 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 5. Tutorial 5.1 INTRODUCTION This tutorial walks you through the process of developing a simple project using the sample programs counter.c and timer.c. This is an implementation of the PIC24FJ128GA010 device using the Explorer 16 Demo Board (DM240001). The program counter.c is a simple counting program. The incremental count, delayed by using Timer 1 (timer.c), is displayed via Port A on the demo board’s LEDs.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 5.2 SETTING UP THE ENVIRONMENT AND SELECTING THE DEVICE Before beginning this tutorial, follow the steps in Chapter 3. “Installation” to set up the MPLAB IDE software and MPLAB ICD 3 system hardware. Double click on the MPLAB IDE icon to launch the application. Once launched, the MPLAB IDE desktop should appear. FIGURE 5-1: MPLAB® IDE DESKTOP Selecting the Device To select the device for this tutorial: 1. Select Configure>Select Device. 2.
Tutorial counter.c /***************************************************************************** * MPLAB ICD 3 In-Circuit Debugger Tutorial * Counting program * ***************************************************************************** * Demo Board: Explorer 16 * Processor: PIC24FJ128GA010 * Compiler: MPLAB C30 * Linker: MPLAB LINK30 * Company: Microchip Technology Incorporated * *****************************************************************************/ #include "p24FJ128GA010.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide timer.
Tutorial IFS0bits.T1IF = 0; TMR1 = 0; return(1); } return(0); } /********************************************************************* * EOF ********************************************************************/ 5.4 RUNNING THE PROJECT WIZARD The MPLAB C30 C compiler will be used in this project. You may either purchase the full compiler or download a free student version from the Microchip website. 1. To set up this project, select Project>Project Wizard. A Welcome screen will appear. 2.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide FIGURE 5-3: PROJECT WIZARD – PROJECT NAME 5. Proceed to the next dialog of the wizard where project files can be added. Files can also be added later if something is missed. For this example, browse to your project directory to find both files. Click on counter.c to highlight it and then click on ADD>> to add it to the right pane. Click on timer.c to highlight it and then click on ADD>> to add it to the right pane. Leave the “A” next to the file name.
Tutorial 5.5 VIEWING THE PROJECT After exiting the wizard, the MPLAB IDE desktop will again be visible. If the project window is not open, select View/Project to see the Project window. FIGURE 5-5: PROJECT WINDOW Additional files can be added to the project using the project window. Right click on any line in the project window tree to pop up a menu with additional options for adding and removing files. Note: © 2008 Microchip Technology Inc. Although the header file p24FJ128GA010.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 5.6 VIEWING DEBUG OPTIONS Before you begin debugging your code, review the default settings of several items. In your own projects, you may need to set these items differently. 5.6.1 Configuration Bits In this tutorial, the relevant device Configuration bits are set in the counter.c code using the _CONFIG1 and _CONFIG2 directives.
Tutorial FIGURE 5-7: DEBUGGER PROGRAM MEMORY TAB Here you may allow the debugger to automatically choose the programming ranges (recommended) or you may select ranges manually. • The “Memories” section should have “Program” checked, and “EEPROM” and “ID” unchecked. When using the MPLAB ICD 3 in-circuit debugger as a debugger, Configuration bits will always be programmed and the “Configuration” box will be checked and grayed out.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide DS51766A-page 38 FIGURE 5-8: OUTPUT WINDOW FIGURE 5-9: WINDOWS EXPLORER – PROJECT FILES © 2008 Microchip Technology Inc.
Tutorial 5.8 SETTING UP THE DEMO BOARD Before beginning to debug, make sure the Explorer 16 Demo Board is set up properly. For more information, see the “Explorer 16 Development Board User’s Guide” (DS51589). Settings for this tutorial should be as follows: • PIC24FJ128GA010 PIM (Plug-In Module) plugged into the board. • S2: “PIM” selected; “PIC” selection for devices soldered onto the board.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 5.10 RUNNING DEBUG CODE The MPLAB ICD 3 in-circuit debugger executes in Real Time or in Step mode. • Real Time execution occurs when the device is put in the MPLAB IDE’s Run mode. • Step mode execution can be accessed after the processor is halted. These toolbar buttons can be used for quick access to commonly-used debug operations. Debugger Menu Run Halt Animate Step Into Step Over Step Out Reset Toolbar Buttons Begin in Real-Time mode: 1.
Tutorial 5.11.2 Setting a Single Hardware Breakpoint To set a single breakpoint: 1. Select Debugger>Reset>Processor Reset (or click the Reset toolbar button) to reset the example program. 2. Highlight or place the cursor on the following line of code from counter.c: counter++; //increment counter 3. Double click on the line, or right click on the line and then select Set Breakpoint from the shortcut menu. This line is now marked as a breakpoint (B in red stop sign) as shown in Figure 5-11.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 5. Open a new Watch window to watch the counter variable change value as the program executes. Select View>Watch. The Watch dialog opens with the Watch 1 tab selected. Select “counter” from the list next to Add Symbol, and then click the button. counter is added to the Watch window. Select “PORTA” from the list next to Add SFR, and then click the button. PORTA is added to the Watch window.
Tutorial The additional breakpoint will appear below the previous breakpoint in the Breakpoints dialog and also as a breakpoint symbol next to the following line of code: PORTA = counter; //display on port LEDs The breakpoint symbol is yellow in this case because it was set based on an address. FIGURE 5-15: TWO BREAKPOINTS 3. Run the program to see it halt at the first breakpoint. The values in the Watch window will not change. Then run again to see it stop at the second breakpoint.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 2. Under “Start Condition”, select the first breakpoint from the list. Then uncheck “Start condition will cause the target device to halt”. 3. Under “Stop Condition”, select the second breakpoint from the list. Then check “Stop condition will cause the target device to halt”. 4. Check “Reset stopwatch on run”. 5. Click OK. FIGURE 5-17: STOPWATCH DIALOG 6. Run the program until it halts.
Tutorial 2. To set multiple software breakpoints, follow the instructions in Section 5.11.3 “Setting Multiple Hardware Breakpoints”. - There is no breakpoint skidding with software breakpoints, i.e., the program halts on the breakpoint. This may affect how you see values change in the Watch window. - There is a maximum number of breakpoints with software breakpoints, i.e, although this tutorial only uses two, the number of software breakpoints is 999. 3.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 46 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Part 2 – Troubleshooting Chapter 6. Frequently Asked Questions (FAQs) ....................................................... 49 Chapter 7. Error Messages.......................................................................................... 53 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 48 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 6. Frequently Asked Questions (FAQs) 6.1 INTRODUCTION Look here for answers to frequently asked questions about the MPLAB ICD 3 in-circuit debugger system. • How Does It Work • What’s Wrong 6.2 HOW DOES IT WORK • What's in the silicon that allows it to communicate with the MPLAB ICD 3 in-circuit debugger? MPLAB ICD 3 in-circuit debugger can communicate with Flash silicon via the ICSP interface. It uses the debug executive located in test memory.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide • Does the MPLAB ICD 3 in-circuit debugger have complex breakpoints like MPLAB ICE 2000/4000? Yes. You can break based on a value in a data memory location. You can also do sequenced breakpoints, where several events are happening before it breaks, but you can only do 2 sequences instead of 4, as you can in the MPLAB ICE 2000. You can also do the AND condition and do PASS counts. See Section 9.3.1 “Breakpoints Dialog” for more information.
Frequently Asked Questions (FAQs) • When using a 16-bit device, an unexpected reset occurred. How do I determine what caused it? Some things to consider: - To determine a reset source, check the RCON register. - Handle traps/interrupts in an Interrupt Service Routine (ISR). You should include trap.c style code, i.e.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide • I don’t see my problem here. Now what? Try the following resources: - Chapter 10. “Limitations” - Section 2.9 “Resources Used by the Debugger” - Section 7.2 “Specific Error Messages” - Section 7.3 “General Corrective Actions” DS51766A-page 52 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 7. Error Messages 7.1 INTRODUCTION The MPLAB ICD 3 in-circuit debugger produces many different error messages; some are specific and others can be resolved with general corrective actions. • Specific Error Messages • General Corrective Actions 7.2 SPECIFIC ERROR MESSAGES MPLAB ICD 3 in-circuit debugger error messages are listed below in numeric order. Note: Numbers may not yet appear in displayed messages.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide ICD3Err0012: Download debug exec failed If you receive this error while attempting to program from the Debugger menu: 1. 2. 3. 4. Deselect the debugger as the debug tool. Close your project and then close MPLAB IDE. Restart MPLAB IDE and re-open your project. Reselect the debugger as your debug tool and attempt to program your target device again. If this does not work, see Section 7.3.4 “Corrupted Installation Actions”.
Error Messages ICD3Err0030: Unable to read/find firmware File %s. If the Hex file exists: • Reconnect and try again. • If this does not work, the file may be corrupted. Reinstall MPLAB IDE. If the Hex file does not exist: • Reinstall MPLAB IDE. ICD3Err0031: Failed to get PC. ICD3Err0032: Failed to set PC. See Section 7.3.2 “Debugger-to-Target Communication Error Actions”. ICD3Err0033: %d bytes expected, %d bytes received. See Section 7.3.3 “Debugger-to-PC Communication Error Actions”.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide ICD3Err0046: An error occurred while trying to read the stopwatch count. The stopwatch count may not be accurate. See Section 7.3.2 “Debugger-to-Target Communication Error Actions”. ICD3Err0047: Bootloader download failed. See Section 7.3.3 “Debugger-to-PC Communication Error Actions”. ICD3Err0052: The current ICD 3 hardware version %x, is out of date. This version of MPLAB IDE will support only version %x or higher.
Error Messages 7.3 GENERAL CORRECTIVE ACTIONS These general corrective actions may solve your problem: • • • • • • • Read/Write Error Actions Debugger-to-Target Communication Error Actions Debugger-to-PC Communication Error Actions Corrupted Installation Actions USB Port Communication Error Actions Debug Failure Actions Internal Error Actions 7.3.1 Read/Write Error Actions If you receive a read or write error: 1. Did you hit Abort? This may produce read/write errors. 2. Try the action again.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 7.3.5 USB Port Communication Error Actions The problem is most likely caused by a faulty or non-existent communications port. 1. Reconnect to the MPLAB ICD 3 in-circuit debugger 2. Make sure the debugger is physically connected to the PC on the appropriate USB port. 3. Make sure the appropriate USB port has been selected in the debugger Settings. 4. Make sure the USB port is not in use by another device. 5. If using a USB hub, make sure it is powered. 6.
Error Messages Other Things to Consider 1. It is possible the error was a one time glitch. Try the operation again. 2. There may be a problem programming in general. As a test, switch to programmer mode and program the target with the simplest application possible (e.g., a program to blink an LED.) If the program will not run, then you know that something is wrong with the target setup. 3. It is possible that the target device has been damaged in some way (e.g., over current.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 60 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Part 3 – Reference Chapter 8. Basic Debug Functions............................................................................. 63 Chapter 9. Debugger Function Summary .................................................................. 65 Chapter 10. Hardware Specification ........................................................................... 79 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 62 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 8. Basic Debug Functions 8.1 INTRODUCTION Basic MPLAB ICD 3 in-circuit debugger debug functions of breakpoints and stopwatch are discussed. 8.2 BREAKPOINTS Use breakpoints to halt code execution at specified lines in your code. Breakpoints and triggers use the same resources. Therefore, the available number of breakpoints is actually the available number of combined breakpoints/triggers. To select hardware or software breakpoints: 1.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 64 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 9. Debugger Function Summary 9.1 INTRODUCTION A summary of the MPLAB ICD 3 in-circuit debugger functions on menus, in windows and on dialogs is listed here. • • • • 9.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide For C code, this command executes one line of C code, which may mean the execution of one or more assembly instruction, and then halts. After execution, all the windows are updated. Note: Do not step into a SLEEP instruction. Step Over F8 Execute the instruction at the current program counter location. At a CALL instruction, Step Over executes the called subroutine and halts at the address following the CALL.
Debugger Function Summary 9.2.2 Right Mouse Button Debugger Menu These debugger menu options will appear on the right mouse menus in code displays, such as program memory and source code files. Descriptions of other menu options not listed here can be found in the MPLAB IDE Help or the MPLAB Editor Help. Set Breakpoint Set or remove a breakpoint at the currently selected line. Breakpoints Remove, enable or disable all breakpoints. Run To Cursor Run the program to the current cursor location.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 9.3 DEBUGGING DIALOGS/WINDOWS Open the following debug dialogs and windows using the menu items mentioned in Section 9.2 “Debugging Functions”. • Breakpoints Dialog - Set Breakpoint Dialog - Stopwatch Dialog - Event Breakpoints Dialog - Sequenced Breakpoints Dialog - ANDed Breakpoints Dialog 9.3.1 Breakpoints Dialog To set up breakpoints, select Debugger>Breakpoints. Set up different types of breakpoints in this dialog.
Debugger Function Summary 9.3.1.2 BREAKPOINT DIALOG BUTTONS Use the buttons to add a breakpoint and set up additional break conditions. Also, a stopwatch is available for use with breakpoints and triggers. Note: Buttons displayed will depend on the selected device. TABLE 9-2: BREAKPOINT DIALOG BUTTONS Control Function Related Dialog Add Breakpoint Add a breakpoint Section 9.3.2 “Set Breakpoint Dialog” Stopwatch Set up the stopwatch Section 9.3.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 9.3.2.2 DATA MEMORY TAB Set up a data memory breakpoint here. TABLE 9-4: DATA MEMORY BREAKPOINT Control Function Address Location of breakpoint in hex Breakpoint Type The type of data memory breakpoint. See the device data sheet for more information on X Bus reads/writes.
Debugger Function Summary 9.3.4 Event Breakpoints Dialog Click Event Breakpoints in the Breakpoints Dialog to display this dialog. Select a condition where the program will always break: • Break on Watchdog Timer – Break every time the watchdog timer times out. Make sure the Watchdog Timer is enabled in the Configuration bits. • Break on SLEEP instruction – Break when a SLEEP instruction is encountered in the program. 9.3.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Find Next Find the next instance of Find text. repeats the last Find. + reverses the direction of the last Find. Go To Jump to the specified item: • Trigger – Jump to the location of the trigger. • Top – Jump to the top of the window. • Bottom – Jump to the bottom of the window. Show Source Show/hide the source code listing on the bottom of the window. Refresh Refresh the viewable contents of the window. Properties Set up window properties.
Debugger Function Summary 9.4 PROGRAMMING FUNCTIONS When you select the MPLAB ICD 3 in-circuit debugger from the Programmer menu, program items will be added to the following MPLAB IDE functions: • Programmer Menu • Toolbars/Status Bar 9.4.1 Programmer Menu Program Program specified memory areas: program memory, Configuration bits, ID locations and/or EEPROM data. See the Settings dialog for programming options.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 9.5 SETTINGS DIALOG Select either Debugger>Settings or Programmer>Settings to open the Settings dialog and set up the MPLAB ICD 3 in-circuit debugger. Note: • • • • • • • • Tabs displayed will depend on the selected device.
Debugger Function Summary 9.5.2 Settings Dialog, Configuration Tab Configure debugger operation on this tab. TABLE 9-7: CONFIGURATION ITEMS Download Firmware Set up firmware download options. Auto Download Latest Firmware Check to allow automatic download of the latest version of firmware for the target device (recommended). Manual Download Manually select a firmware file to download to the target device. Breakpoints Depending on your selected device, you may be able to use software breakpoints.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 9.5.3 Settings Dialog, Freeze on Halt Tab Select peripherals to freeze on halt on this tab. PIC18 MCU Devices To freeze/unfreeze all device peripherals on halt, check/uncheck the “Freeze on Halt” checkbox. If this does not halt your desired peripheral, be aware that some peripherals have no freeze on halt capability and cannot be controlled by the debugger.
Debugger Function Summary 9.5.5 Settings Dialog, Clock Tab Enter the run-time clock (instruction) speed on this tab. This does not set the speed, but informs the debugger of its value. TABLE 9-9: CLOCK OPTIONS Target Run-Time Instruction Speed Speed value Enter a value for the “Speed unit” selected. Example 1: For a PIC24 MCU and a target clock oscillator at 32 MHz (HS), instruction speed = 32 MHz/2 = 16 MIPS.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 78 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Chapter 10. Hardware Specification 10.1 INTRODUCTION The hardware and electrical specifications of the MPLAB ICD 3 in-circuit debugger system are detailed. 10.2 HIGHLIGHTS This chapter discusses: • • • • • • 10.3 Declaration of Conformity USB Port/Power MPLAB ICD 3 Debugger Standard Communication Hardware ICD 3 Test Interface Board Target Board Considerations DECLARATION OF CONFORMITY We Microchip Technology, Inc. 2355 W. Chandler Blvd.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 10.4 USB PORT/POWER The MPLAB ICD 3 in-circuit debugger is connected to the host PC via a Universal Serial Bus (USB) port, version 2.0 compliant. The USB connector is located on the side of the pod. The system is capable of reloading the firmware via the USB interface. System power is derived from the USB interface.
Hardware Specification 10.6 STANDARD COMMUNICATION HARDWARE For standard debugger communication with a target (Section 2.4 “Debugger To Target Communication”, “Standard ICSP Device Communication“), use the RJ-11 connector. To use this type of communication with a header board, you may need a device-specific Processor Pak, which includes an 8-pin connector header board containing the desired ICE/ICD device and a standard adapter board.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide 10.6.2 Modular Cable and Connector For standard communications, a modular cable connects the debugger and the target application. The specifications for this cable and its connectors are listed below. 10.6.2.1 MODULAR CONNECTOR SPECIFICATION • Manufacturer, Part Number – AMP Incorporated, 555165-1 • Distributor, Part Number – Digi-Key, A9031ND The following table shows how the modular connector pins on an application correspond to the microcontroller pins.
Hardware Specification 1. Disconnect the debugger from the target and the PC. 2. Connect the ICD 3 test interface board to the debugger using the modular cable. MPLAB® ICD 3 ICD 3 Test Interface Board Modular Cable USB/Power From PC 3. Connect the debugger to the PC. 4. Select the MPLAB ICD 3 in-circuit debugger as either a debugger or programmer in MPLAB IDE. 5. MPLAB IDE will invoke and run the complete self-test and give you a status (pass/fail). 10.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide NOTES: DS51766A-page 84 © 2008 Microchip Technology Inc.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Glossary Absolute Section A section with a fixed (absolute) address that cannot be changed by the linker. Access Memory (PIC18 Only) Special registers on PIC18 devices that allow access regardless of the setting of the Bank Select Register (BSR). Address Value that identifies a location in memory. Alphabetic Character Alphabetic characters are those characters that are letters of the arabic alphabet (a, b, …, z, A, B, …, Z).
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Bookmarks Use bookmarks to easily locate specific lines in a file. Under the Edit menu, select Bookmarks to manage bookmarks. Toggle (enable / disable) a bookmark, move to the next or previous bookmark, or clear all bookmarks. Breakpoint, Hardware An event whose execution will cause a halt. Breakpoint, Software An address where execution of the firmware will halt. Usually achieved by a special break instruction.
Glossary Data Memory On Microchip MCU and DSC devices, data memory (RAM) is comprised of General Purpose Registers (GPRs) and Special Function Registers (SFRs). Some devices also have EEPROM data memory. Debugging Information Compiler and assembler options that, when selected, provide varying degrees of information used to debug application code. See compiler or assembler documentation for details on selecting debug options.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Event A description of a bus cycle which may include address, data, pass count, external input, cycle type (fetch, R/W), and time stamp. Events are used to describe triggers, breakpoints and interrupts. Export Send data out of the MPLAB IDE in a standardized format. Extended Microcontroller Mode In extended microcontroller mode, on-chip program memory as well as external memory is available.
Glossary Hex Code Executable instructions stored in a hexadecimal format code. Hex code is contained in a hex file. Hex File An ASCII file containing hexadecimal addresses and values (hex code) suitable for programming a device. High Level Language A language for writing programs that is further removed from the processor than assembly. ICD In-Circuit Debugger. MPLAB ICD 2 is Microchip’s in-circuit debugger. ICE In-Circuit Debugger.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Interrupt Service Routine User-generated code that is entered when an interrupt occurs. The location of the code in program memory will usually depend on the type of interrupt that has occurred. IRQ See Interrupt Request. ISO See International Organization for Standardization. ISR See Interrupt Service Routine. Librarian See Archiver. Library See Archive.
Glossary Macro Directives Directives that control the execution and data allocation within macro body definitions. Makefile Export to a file the instructions to Make the project. Use this file to Make your project outside of MPLAB IDE, i.e., with a make. Under Project>Build Options>Project, Directories tab, you must have selected “Assemble/Compile/Link in the project directory” under “Build Directory Policy” for this feature to work.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide MPLAB ICD 2 Microchip’s in-circuit debugger that works with MPLAB IDE. The ICD supports Flash devices with built-in debug circuitry. The main component of each ICD is the pod. A complete system consists of a pod, header board (with a device-ICD), target board, cables, and MPLAB IDE software. MPLAB ICE 2000 Microchip’s in-circuit debugger that works with MPLAB IDE. MPLAB ICE 2000 supports 8-bit PIC MCUs. The main component of each ICE is the pod.
Glossary Nesting Depth The maximum level to which macros can include other macros. Node MPLAB IDE project component. Non Real Time Refers to the processor at a breakpoint or executing single-step instructions or MPLAB IDE being run in simulator mode. Non-Volatile Storage A storage device whose contents are preserved when its power is off. NOP No Operation. An instruction that has no effect when executed except to advance the program counter.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide PC Host Any PC running a supported Windows operating system. PIC MCUs PIC microcontrollers (MCUs) refers to all Microchip microcontroller families. PICSTART Plus A developmental device programmer from Microchip. Programs 8-, 14-, 28-, and 40-pin PIC microcontrollers. Must be used with MPLAB IDE software. Plug-ins The MPLAB IDE has both built-in components and plug-in modules to configure the system for a variety of software and hardware tools.
Glossary Radix The number base, hex, or decimal, used in specifying an address. RAM Random Access Memory (Data Memory). Memory in which information can be accessed in any order. Raw Data The binary representation of code or data associated with a section. Read Only Memory Memory hardware that allows fast access to permanently stored data but prevents addition to or modification of the data.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Single Step This command steps though code, one instruction at a time. After each instruction, MPLAB IDE updates register windows, watch variables, and status displays so you can analyze and debug instruction execution. You can also single step C compiler source code, but instead of executing single instructions, MPLAB IDE will execute all assembly level instructions generated by the line of the high level C statement.
Glossary Step Over Step Over allows you to debug code without stepping into subroutines. When stepping over a CALL instruction, the next breakpoint will be set at the instruction after the CALL. If for some reason the subroutine gets into an endless loop or does not return properly, the next breakpoint will never be reached. The Step Over command is the same as Single Step except for its handling of CALL instructions.
MPLAB® ICD 3 In-Circuit Debugger User’s Guide Trigger Output Trigger output refers to an debugger output signal that can be generated at any address or address range, and is independent of the trace and breakpoint settings. Any number of trigger output points can be set. Uninitialized Data Data which is defined without an initial value. In C, int myVar; defines a variable which will reside in an uninitialized data section.
MPLAB® ICD 3 IN-CIRCUIT DEBUGGER USER’S GUIDE Index A E Abort Operation........................................................ 66 Animate .................................................................... 65 AVdd ........................................................................ 16 AVss......................................................................... 16 Erase........................................................................ 73 Erase All Before Programming...........................
MPLAB® ICD 3 In-Circuit Debugger User’s Guide ICD3Err0028 ............................................................ 54 ICD3Err0029 ............................................................ 54 ICD3Err0030 ............................................................ 55 ICD3Err0031 ............................................................ 55 ICD3Err0032 ............................................................ 55 ICD3Err0033 ............................................................
Index U USB.....................................................................80, 98 Cables............................................................... 10 Device Drivers .................................................. 21 Hubs ................................................................. 80 V Vcap ......................................................................... 16 Vdd.......................................................... 15, 16, 17, 18 Verify ........................................
WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.