MPLAB® REAL ICE™ In-Circuit Emulator 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® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Table of Contents Preface ........................................................................................................................... 1 Part 1 – Getting Started Chapter 1. Overview 1.1 Introduction ..................................................................................................... 9 1.2 Emulator Defined ............................................................................................ 9 1.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide Chapter 4. Tutorial 4.1 Introduction ................................................................................................... 31 4.2 Setting Up The Environment ........................................................................ 31 4.3 Creating the Application Code ...................................................................... 32 4.4 Running the Project Wizard ..........................................................................
Table of Contents Part 3 – Reference Chapter 9. Frequently Asked Questions (FAQ) 9.1 Introduction ................................................................................................... 83 9.2 How Does It Work FAQs .............................................................................. 83 9.3 How Does Trace Work – 8 and 16 Bit Devices ............................................ 85 9.4 What’s Wrong ...........................................................................................
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page vi © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR 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® REAL ICE™ In-Circuit Emulator User’s Guide DOCUMENT LAYOUT This document describes how to use the MPLAB REAL ICE in-circuit emulator 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 REAL ICE in-circuit emulator is, and how it can help you develop your application.
Preface CONVENTIONS USED IN THIS GUIDE The following conventions may appear in this documentation: TABLE 1: DOCUMENTATION CONVENTIONS Description Represents Examples Arial font: Italic Initial caps Referenced books MPLAB® IDE User’s Guide Emphasized text ...is the only compiler...
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide RECOMMENDED READING This document describes how to use the MPLAB REAL ICE in-circuit emulator. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. Release Notes for MPLAB REAL ICE In-Circuit Emulator For the latest information on using the MPLAB REAL ICE in-circuit emulator, read the “Readme for MPLAB REAL ICE Emulator.
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® REAL ICE™ In-Circuit Emulator 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® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Part 1 – Getting Started Chapter 1. Overview....................................................................................................... 9 Chapter 2. Operation.................................................................................................... 13 Chapter 3. Installation.................................................................................................. 27 Chapter 4. Tutorial............................................
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 8 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 1. Overview 1.1 INTRODUCTION An overview of the MPLAB REAL ICE in-circuit emulator system is given. • • • • 1.2 Emulator Defined How the Emulator Helps You Emulator Kit Components Device and Feature Support EMULATOR DEFINED The MPLAB REAL ICE in-circuit emulator is an in-circuit emulator that is controlled by a PC running MPLAB IDE software on a Windows® platform.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 1.3 HOW THE EMULATOR HELPS YOU The MPLAB REAL ICE in-circuit emulator system allows you to: • • • • • • • • 1.
Overview 1.5 DEVICE AND FEATURE SUPPORT The following shows the current and future support for devices and device features, depending on your selected device.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide TABLE 1-2: 8-BIT (DATA MEMORY) DEVICES PIC18FXXJ PIC18F, PIC18F Enh, PIC18FXXK 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(3) 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
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 2. Operation 2.1 INTRODUCTION A simplified description of how the MPLAB REAL ICE in-circuit emulator system works is provided here. It is intended to provide enough information so a target board can be designed that is compatible with the emulator 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. • • • • • • • • 2.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.
Operation FIGURE 2-2: STANDARD EMULATOR SYSTEM – DEVICE WITH ON-BOARD ICE CIRCUITRY Emulator Pod ACTIVE Target Device or PIM STATUS FUNCTION RESET Target Board Standard Driver Board FIGURE 2-3: STANDARD EMULATOR SYSTEM – ICE DEVICE Processor Pak Emulator Pod Standard Adapter Header Device-ICE ACTIVE STATUS FUNCTION RESET Transition Socket Standard Driver Board © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.3.2 High-Speed Communication The emulator system can be configured to use high-speed communication for both programming and debugging functions. This connection allows for higher speed operations, a longer distance between the emulator and target, and additional tracing functionality over a standard connection.
Operation 2.4 TARGET COMMUNICATION CONNECTIONS There are two driver boards available to closely match most application requirements. The standard driver board can be used to connect to the myriad of demo boards and applications that contain the RJ11 connector. The high-speed driver/receiver board combination can be used for high-speed applications, for additional trace features, for large (several feet) emulator-to-target distances and for noisy environments. 2.4.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.4.2 High-Speed Communication Connection Using the high-speed driver/receiver board combination, the MPLAB REAL ICE in-circuit emulator is connected to the target device with an 8-pin interface. The pin numbering for the connector is shown from the top of the target PC board in Figure 2-7. Note: Connections from the emulator to the target are shown in Section 12.7 “High-Speed Communication Hardware”.
Operation Not all devices have the AVDD and AVSS lines, but if they are present on the target device, all must be connected to the appropriate levels in order for the emulator to operate. In general, it is recommended per device data sheet that all VDD/AVDD and VSS/AVSS lines be connected to the appropriate levels. Also, devices with a VCAP pin (like PIC18FXXJ devices) should be connected to the appropriate capacitor or other internal regulator device. Note: 2.4.4 The interconnection is very simple.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.5 TRACE CONNECTIONS When the emulator is selected as the debug tool, it has several trace capabilities, depending on the device selected. 2.5.1 Native Trace Connections No additional connections are necessary to use Native trace. The communications connection will carry the trace information using the PGD/PGC/EMUC/EMUD pins. However, the selected device must have this feature. If it does not, one of the other trace methods may be used.
Operation 2.5.3 I/O Port Trace Connections Streaming parallel trace is possible using a device 8-pin I/O port and the emulator logic probe connector. This provides greater trace speed and data quantity, but limits emulator-to-target distance by the length of the logic probe connectors. Figure 2-11 shows these additional connections.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.5.4 PIC32 Instruction Trace Connections PIC32 Instruction Trace is only available for PIC32MX MCU devices, and it is the only type of trace available for these devices. Also, only some PIC32MX MCU devices have the trace feature. Consult your device data sheet for details.
Operation 2.6 DEBUGGING WITH THE EMULATOR There are two steps to using the MPLAB REAL ICE in-circuit emulator 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.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide • 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. 2.7.
Operation 2.7.2 Debugging Details Figure 2-14 illustrates the MPLAB REAL ICE in-circuit emulator system when it is ready for debugging. FIGURE 2-14: MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR READY FOR DEBUGGING VDD +12V 1 +5V VPP/MCLR Internal Circuits 4.7 kΩ 4.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 2.8 PROGRAMMING WITH THE EMULATOR Use the MPLAB REAL ICE in-circuit emulator as a programmer to program an actual (non -ICE/-ICD) device, i.e., a device not on a header board. Select “MPLAB REAL ICE” from Programmer>Select Programmer and compile/assemble your application code with the “Build Configuration” list box on the MPLAB IDE toolbar set to “Release”. Also, it may be set by selecting Project>Build Configuration>Release.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 3. Installation 3.1 INTRODUCTION How to install the MPLAB REAL ICE in-circuit emulator system is discussed. • • • • • • 3.2 Installing the Software Installing the USB Device Drivers Selecting Target Communications Setting Up the Target Connecting the Logic Probes Setting Up MPLAB IDE INSTALLING THE SOFTWARE To install the MPLAB IDE software, first acquire the latest MPLAB IDE installation executable (MPxxxxx.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 3.4 SELECTING TARGET COMMUNICATIONS A driver board is inserted into the pod to select the type of communication with the target, either standard (for header boards and many demo boards) or high speed (for target boards over six inches away from the emulator). See Section 2.3 “Emulator Communications with the PC and Target” for more details.
Installation 3.5 SETTING UP THE TARGET Once the type of communication has been determined by inserting the corresponding driver board into the emulator, the target must be set up to accommodate this, as well as the type of target device to be used, i.e., regular or ICE. Some devices have built-in debug circuitry. These “regular” devices may be used directly by the emulator on the target. Other devices have no built-in debug circuitry.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 3.6 CONNECTING THE LOGIC PROBES The logic probes may be connected into the logic probe connector on the emulator pod. These probes will allow halting the MPLAB REAL ICE in-circuit emulator by external triggers, and will provide output triggers to synchronize external equipment such as oscilloscopes and logic analyzers. See Section 6.3 “External Triggers” for setup information. This connector can also be used for trace. See: • Section 2.5.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 4. Tutorial 4.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® REAL ICE™ In-Circuit Emulator User’s Guide FIGURE 4-1: 4.2.1 MPLAB® IDE DESKTOP Selecting the Device To select the device for this tutorial: 1. Select Configure>Select Device. 2. In the Device Selection dialog, choose “PIC24FJ128GA010” from the Device list box. The light icon next to “MPLAB REAL ICE” in the “Microchip Tool Programmer/Debugger Tool Support” sections should be green. 3. Click OK. 4.2.
Tutorial counter.c /***************************************************************************** * MPLAB REAL ICE In-Circuit Emulator Tutorial * Counting program * ***************************************************************************** * Demo Board: Explorer 16 * Processor: PIC24FJ128GA010 * Compiler: MPLAB C30 * Linker: MPLAB LINK30 * Company: Microchip Technology Incorporated * *****************************************************************************/ #include "p24FJ128GA010.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide *****************************************************************************/ #include "p24FJ128GA010.h" //declare functions extern void TimerInit(void); extern unsigned char TimerIsOverflowEvent(void); /********************************************************************* * Function: TimerInit * * PreCondition: None. * * Input: None. * * Output: None. * * Overview: Initializes Timer1 for use.
Tutorial 4.4 RUNNING THE PROJECT WIZARD The MPLAB C compiler for PIC24 MCUs and dsPIC DSCs (formerly MPLAB C30) will be used in this project. You may either purchase the full compiler or download a free evaluation version from the Microchip website. 1. To set up this project, select Project>Project Wizard. A Welcome screen will appear. 2. Proceed to the second dialog of the wizard. The PIC24FJ128GA010 should be selected. 3. Proceed to the next dialog of the wizard to set up the language tools.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 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 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: 4.6 Although the header file p24FJ128GA010.h and a linker script file are used in the project, you do not need to add them to the project; MPLAB IDE will find them for you.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide FIGURE 4-7: 4.7 WINDOWS EXPLORER – PROJECT FILES 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. 4.7.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 4.7.2 Programming Options To set program options, select Debugger>Settings and click on the Program Memory tab. FIGURE 4-9: EMULATOR PROGRAM MEMORY TAB Here you may allow the emulator 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.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.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). 4.8.1 Demo Board Settings 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.
Tutorial 4.10 RUNNING DEBUG CODE The MPLAB REAL ICE in-circuit emulator 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. Open the source files counter.c and timer.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.11.1 Choosing a Breakpoint Type For the device used in this tutorial, you have the choice of using either hardware or software breakpoints. To set breakpoint options, select Debugger>Settings and click on the Configuration tab. Select the type of breakpoint that best suits your application needs. For this tutorial, we will begin using the default breakpoint type (hardware breakpoints.) 4.11.
Tutorial FIGURE 4-12: PROGRAM HALTED 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.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 1. Select Debugger>Breakpoints to open the Breakpoints dialog. The breakpoint set in the previous section will be displayed in this dialog. Click the Add Breakpoint button to add another breakpoint. 2. On the Program Memory tab of the Set Breakpoint dialog, enter “29E“ as the hex Address and click OK.
Tutorial 4.11.4 Using the Stopwatch with Breakpoints To determine the time between the breakpoints, use the Stopwatch. FIGURE 4-16: STOPWATCH DIALOG 1. Click Stopwatch (on the Breakpoints dialog) to open the Stopwatch dialog. FIGURE 4-17: STOPWATCH DIALOG 2. Under “Start Condition”, click Select Start Condition and choose the first breakpoint. Then uncheck “Start condition will cause the target device to halt”. 3. Under “Stop Condition”, click Select Stop Condition and choose the second breakpoint.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.11.5 Setting Software Breakpoints To change the breakpoint type from hardware to software: • Select Debugger>Settings and click on the Configuration tab. • Click the radio button next to “Use Software Breakpoints”. • Click OK. You will now use software breakpoints instead of the hardware breakpoints used previously. Note: Using software breakpoints for debug impacts device endurance.
Tutorial 4.12 DEBUGGING CODE USING A RUNTIME WATCH Set up a runtime watch to view changes to the counter symbol as the program runs. For more information on runtime watches, see either Section 7.2 “Data Capture and Runtime Watches” or Section 8.2 “Data Capture and Runtime Watches” (PIC32MX devices only). 1. Remove all breakpoints from code. To do this, right click on any line of code and select Breakpoints>Remove All Breakpoints. 2. In the Watch window, click on the counter Symbol Name to select that line.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.13 DEBUGGING CODE USING NATIVE TRACE The trace function can be used to collect information on variables and code and store it in a buffer while the code is executing. In this section, Native trace will be used. For more information about tracing in general using the MPLAB REAL ICE in-circuit emulator, see Chapter 7. “Debug for 8- and 16-Bit Devices”. Note 1: 2: 4.13.1 Trace operation requires 16-bit C compiler v2.04 and above.
Tutorial 2. Highlight the variable counter from the following line of code: counter++; //increment counter Right click on the highlighted variable and select “Log Selected C Value” from the pop-up menu. This causes the following macro line to be inserted above the line containing the variable: __LOG(id,counter); where id is a log number auto-generated during build. 3. Rebuild the project (Project>Build All). 4. After rebuilding, a Warning dialog will ask, “File has been modified. Do you want to reload?”.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.13.2 Tracing a Line of Code To trace a line of code: 1. Remove the log macro line from code, i.e., highlight it and hit . 2. Highlight or click on the following line of code: counter++; //increment counter Right click to select “Insert C Line Trace” from the pop-up menu. This causes the following macro line to be inserted above the selected line: __TRACE(id); where id is a line trace number auto-generated during the build. 3.
Tutorial 4.13.4 Disabling Trace To temporarily disable the trace capability: 1. Select Project>Build Options>Project, Trace tab. Check “Disable Trace Macros”. Click OK. 2. Rebuild the project (Project>Build All). 3. Reprogram the device (Debugger>Program). To permanently disable the trace capability: 1. Remove all trace and log macros from code. 2. Select Project>Build Options>Project, Trace tab. Uncheck “Enable Trace”. Click OK. 3. Rebuild the project (Project>Build All). 4.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4.15 OTHER TRACE METHODS – SPI OR I/O PORT TRACE The Explorer 16 board does not have the connections to perform either SPI or I/O Port trace. Therefore, it must either be modified or a different board must be used that allows access to the required device SPI and Port pins. The PIC24FJ128GA010 device and code from the beginning of this tutorial will be used in this section.
Tutorial 4.15.1.2 MPLAB IDE SETUP To set up MPLAB IDE software to use SPI Trace, do the following: 1. Launch MPLAB IDE and open the project from this tutorial, if it is not already open. 2. If the MPLAB REAL ICE in-circuit emulator is selected as the programmer, disable it by selecting Programmer>Select Programmer>None. 3. Enable the MPLAB REAL ICE in-circuit emulator as the debug tool by selecting Debugger>Select Tool>REAL ICE. 4.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4. After rebuilding, a Warning dialog will ask, “File has been modified. Do you want to reload?”. Click Yes. When you examine your code, you will find that the log id has been replaced with a unique number. Note: To disable this warning and automatically reload, select Configure>Settings, Other tab, and check “Automatically reload files that were modified outside of the IDE”. Then click OK. 5. Reprogram the device (Debugger>Program). 6.
Tutorial 4.15.2.3 TRACE SETUP To log a variable value using I/O Port Trace: 1. Select Project>Build Options>Project, Trace tab. Check “Enable Trace” and uncheck “Disable Trace Macros”. Then select the I/O Port Trace and choose an port from the drop-down list. Click OK. Note: Determining a port that may be dedicated to trace can be a difficult task on complex devices with many functions multiplexed on port pins. One suggestion is to use the MPLAB VDI visual device initializer.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 4. After rebuilding, a Warning dialog will ask, “File has been modified. Do you want to reload?”. Click Yes. When you examine your code, you will find that the log id has been replaced with a unique number. Note: To disable this warning and automatically reload, select Configure>Settings, Other tab, and check “Automatically reload files that were modified outside of the IDE”. Then click OK. 5. Reprogram the device (Debugger>Program). 6.
Tutorial 4.16 OTHER TRACE METHODS – PIC32 INSTRUCTION TRACE PIC32 Instruction Trace is only available for PIC32MX MCU devices, and it is the only type of trace available for these devices. Also, only some PIC32MX MCU devices have the trace feature. Consult the device data sheet for details. For example code and additional supporting hardware, refer to the Microchip website (www.microchip.com).
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide FIGURE 4-25: DS51616B-page 58 PIC32 INSTRUCTION TRACE DATA © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Part 2 – Features Chapter 5. General Setup ............................................................................................ 61 Chapter 6. Basic Debug Functions............................................................................. 65 Chapter 7. Debug for 8- and 16-Bit Devices .............................................................. 67 Chapter 8. Debug for 32-Bit Devices .................................................................
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 60 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 5. General Setup 5.1 INTRODUCTION How to get started using the MPLAB REAL ICE in-circuit emulator is discussed. • • • • • • • 5.2 Starting the MPLAB IDE Software Creating a Project Viewing the Project Building the Project Setting Configuration Bits Setting the Emulator as the Debugger or Programmer Debugger/Programmer Limitations STARTING THE MPLAB IDE SOFTWARE After installing the MPLAB IDE software (Section 3.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 5.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 5.5 BUILDING THE PROJECT After the project is created, the application needs to be built. This will create object (hex) code for the application that can be programmed into the target by the MPLAB REAL ICE in-circuit emulator. To set build options, select Project>Build Options>Project. Note: On the Project Manager toolbar, select “Debug” from the drop-down list. When done, choose Project>Build All to build the project. 5.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 5.8 DEBUGGER/PROGRAMMER LIMITATIONS For a complete list of emulator limitations for your device, please see the on-line help file in MPLAB IDE for the MPLAB REAL ICE in-circuit emulator. DS51616B-page 64 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR Chapter 6. Basic Debug Functions 6.1 INTRODUCTION Basic MPLAB REAL ICE in-circuit emulator debug functions are discussed. • Breakpoints and Stopwatch • External Triggers 6.2 BREAKPOINTS AND STOPWATCH Use breakpoints to halt code execution at specified lines in your code. Use the stopwatch with breakpoints to time code execution. Breakpoints and real-time data capture triggers use the same resources.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 6.3 EXTERNAL TRIGGERS Select Debugger>Triggers to open the Triggers dialog to set up external triggers. See Section 11.3.7 “Triggers Dialog” for more information. Use external triggers to set up hardware triggers using the logic probe port. All pins (whether used or unused) should either be pulled up or grounded. Floating pins may produce false triggers.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR Chapter 7. Debug for 8- and 16-Bit Devices 7.1 INTRODUCTION The following debug functions are specific to 8- and 16-bit devices. • Data Capture and Runtime Watches • Trace 7.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide • Resource Usage Examples • More on Trace/Log ID Numbers • Quick Trace Reference 7.3.1 Requirements for Trace The following is required to use trace: • For 16-bit devices (dsPIC30F/33F, PIC24F/H): MPLAB IDE v7.43 and above, MPLAB C30 v2.04 and above. For these devices, only C code can be traced, not assembly. • For 8-bit devices (PIC18): MPLAB IDE v7.52 and above, MPASM toolsuite v5.10 and above, MPLAB C18 v3.10 and above.
Debug for 8- and 16-Bit Devices FIGURE 7-2: BUILD OPTIONS TRACE TAB – NATIVE TRACE SELECTION The trace and log information transmitted is identical regardless of the trace method used. For TRACE(), a single value in the range of 64-127 is sent. A label generated using this number is automatically inserted into the code so MPLAB IDE can identify in the trace buffer the location which sent the value. For LOG(), a two-byte header is sent followed by the value of the variable being logged.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 7.3.3.1 NATIVE TRACE Native trace can be used with either standard or high-speed communications, with no additional connections - the information is conveyed via the PGD/PGC/EMUC/EMUD pins. This two-wire interface uses the trace macro format (see Section 7.3.5 “Setting Up Trace in MPLAB IDE”). If Native trace is used, then real-time data capture triggers cannot be used because of hardware constraints. However, breakpoints are still available.
Debug for 8- and 16-Bit Devices • To record a PC location, click on or highlight a line of code and then right click to select “Insert Language Line Trace” from the pop-up menu, where Language can be either C or ASM. This causes the following macro line to be inserted above the selected line: __TRACE(id); where id is a line trace number auto-generated during the build. For more information, see Section 7.3.10 “More on Trace/Log ID Numbers”.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide If(var > 5) { __LOG(ID, var) } • Leave __TRACE and __LOG macros in your code for future debugging, if this is allowable. (For Project>Build Options>Project, Trace tab, select “Disable Trace Macros“.) 7.3.8 Disabling Trace To temporarily turn off trace data collection: 1. Select Project>Build Options>Project, Trace tab. Check “Disable Trace Macros”. Click OK. 2. Rebuild the project (Project>Build All). 3. Reprogram the device (Debugger>Program).
Debug for 8- and 16-Bit Devices EXAMPLE 7-3: dsPIC33F DEVICE RUNNING AT 10 MIPS WITH C PROJECT Library Size (in instructions) GPRs Used (in bytes) Native SPI I/O Port 87 + 9 92 + 9 93 + 9 18 14 0 __TRACE(id) instruction cycles 80 53 32 __LOG(id, INT) instruction cycles 212 124 106 EXAMPLE 7-4: dsPIC33F DEVICE RUNNING AT 16 MIPS WITH C PROJECT Native SPI I/O Port __TRACE(id) instruction cycles 88 53 32 __LOG(id, INT) instruction cycles 227 138 106 EXAMPLE 7-5: dsPIC33F DEVICE
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 7.3.11 Quick Trace Reference If you are new to using the MPLAB REAL ICE in-circuit emulator trace feature, it is recommended that you read through the entire trace section for a full understanding. Use this section as a quick reference for trace. 1. Select Project>Build Options>Project, Trace tab. For full trace capability, “Enable Trace” should be checked and “Disable Trace Macros” should be unchecked. Select the type of trace you want.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 8. Debug for 32-Bit Devices 8.1 INTRODUCTION The following debug functions are specific to 32-bit devices: • Data Capture and Runtime Watches • PIC32 Instruction Trace 8.2 DATA CAPTURE AND RUNTIME WATCHES At this time, MPLAB REAL ICE in-circuit emulator does not support data capture for 32-bit devices. Runtime watches, however, are supported.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 8.3.2 Setting Up and Using Trace If a PIC32MX MCU device has trace capability, it will be PIC32 Instruction Trace. 8.3.2.1 HARDWARE SETUP To use the PIC32 Instruction Trace feature do the following: • Plug the PIM into an unpowered target board. • Install communication cable(s) between the emulator and your target board. See Section 2.4 “Target Communication Connections”.
Debug for 32-Bit Devices FIGURE 8-2: 8.3.2.3 PIC32 INSTRUCTION TRACE ENABLE VIEWING TRACE DATA When trace is enabled and code is run, trace data will appear in the Trace window (View>Trace). See Section 4.16 “Other Trace Methods – PIC32 Instruction Trace” for an example of trace data in the Trace window. © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 8.3.3 Trace Hardware Specifications Specifications for hardware that supports PIC32 Instruction Trace are listed below. 8.3.3.1 PIC32MX TRACE INTERFACE KIT (AC244006) The PIC32MX Trace Interface Kit consists of an adapter board and trace cable. Kit component dimensions and a pin connection diagram for the adapter board are shown below. TABLE 8-1: KIT COMPONENT DIMENSIONS IN INCHES Component Length Width Height Adapter Board 0.900 0.800 0.
Debug for 32-Bit Devices FIGURE 8-4: PIC32MX360F512L PIM PIN CONNECTION DIAGRAM Remove resistors to isolate trace pins from target board. 91 97 96 95 92 0 0 0 0 0 J1 22 22 22 22 22 1 3 5 7 9 2 4 6 8 10 Trace Port To PIM Ground 1 2 97 96 95 92 91 85 76 TR D TR 0 D TR 1 D 2 TR TR D3 C L VD K D co re 100 Vss 75 VDD 13 MCLR 15 Vss 16 VDD PIC32MX Vss 65 VDD Max = 3.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 80 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Part 3 – Reference Chapter 9. Frequently Asked Questions (FAQ) ......................................................... 83 Chapter 10. Error Messages........................................................................................ 89 Chapter 11. Emulator Function Summary.................................................................. 97 Chapter 12. Hardware Specification .........................................................................
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 82 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 9. Frequently Asked Questions (FAQ) 9.1 INTRODUCTION Look here for answers to frequently asked questions about the MPLAB REAL ICE in-circuit emulator system. • How Does It Work FAQs • How Does Trace Work – 8 and 16 Bit Devices • What’s Wrong 9.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide • Does the MPLAB REAL ICE in-circuit emulator have complex breakpoints? 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 an AND condition and PASS counts. See Section 11.3.1 “Breakpoints Dialog” for more information. • One of the probe pins is labeled 5V.
Frequently Asked Questions (FAQ) 9.3 HOW DOES TRACE WORK – 8 AND 16 BIT DEVICES • What's in the silicon that allows it to trace with the MPLAB REAL ICE in-circuit emulator? Tracing over the two-wire (ICSP) interface is supported with silicon that contains the Version 2 PIC18F and dsPIC33F/PIC24X in-circuit debugger modules. • When using trace, is this connection electrically isolated in any way, i.e.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 9.4 WHAT’S WRONG • I cannot get trace to work. What’s wrong? Things to consider: - Certain tool versions are required to use trace. Please refer to either Chapter 7. “Debug for 8- and 16-Bit Devices” or Chapter 8. “Debug for 32-Bit Devices”. - For dsPIC30F/33F and PIC24F/H devices, only C code can be used with trace, not assembly. - In-line assembly code (assembly code within C code) cannot be traced.
Frequently Asked Questions (FAQ) } : - Use ASSERTs. • I have finished debugging my code. Now I’ve programmed my part, but it won’t run. What’s wrong? Some things to consider are: - Have you selected the emulator as a programmer and then tried to program a header board? A header board contains an -ICE/-ICD version of the device and may not function like the actual device. Only program regular devices with the emulator as a programmer.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 88 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 10. Error Messages 10.1 INTRODUCTION The MPLAB REAL ICE in-circuit emulator produces many different error messages; some are specific and others can be resolved with general corrective actions. • Specific Error Messages • General Corrective Actions 10.2 SPECIFIC ERROR MESSAGES MPLAB REAL ICE in-circuit emulator error messages are listed below in numeric order. Note: Numbers may not yet appear in displayed messages.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide RIErr0012: Download debug exec failed If you receive this error while attempting to program from the Debugger menu: 1. 2. 3. 4. Deselect the emulator as the debug tool. Close you project and then close MPLAB IDE. Restart MPLAB IDE and re-open your project. Reselect the emulator as your debug tool and attempt to program your target device again. If this does not work, see Section 10.3.4 “Corrupted Installation Actions”.
Error Messages RIErr0030: 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. RIErr0031: Failed to get PC. RIErr0032: Failed to set PC. See Section 10.3.2 “Emulator-to-Target Communication Error Actions”. RIErr0033: %d bytes expected, %d bytes received. See Section 10.3.3 “Emulator-to-PC Communication Error Actions”.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide RIErr0046: An error occurred while trying to read the stopwatch count. The stopwatch count may not be accurate. See Section 10.3.2 “Emulator-to-Target Communication Error Actions”. RIErr0047: Bootloader download failed. RIErr0048: Unable to set trace options. See Section 10.3.3 “Emulator-to-PC Communication Error Actions”. RIErr0049: Unable to open file for streaming data trace. Trace will be turned off. The trace file cannot be opened. 1.
Error Messages RIErr0061: Loopback VDD not detected. Please ensure your RJ-11 cable is connected between the loopback board and the driver board. Unplug the REAL ICE to try again. Try the following: 1. Connect the cable between the loopback board and the Standard driver board. 2. Unplug and then plug in the emulator. If this does not work, try a different cable and repeat the above steps. RIErr0062: Loopback VPP failure. Emulator power supply failure. Contact Microchip technical support.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 10.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. It may be a one time error. 3. Ensure that the target is powered and at the correct voltage levels for the device. See the device data sheet for required device voltage levels. 4. Ensure that the emulator-to-target connection is correct (PGC and PGD are connected.) 5.
Error Messages Top Reasons Why You Can’t Debug 1. The oscillator is not working. Check your Configuration bits setting for the oscillator. 2. The target board is not powered. Check the power cable connection. 3. The MPLAB REAL ICE in-circuit emulator has somehow become physically disconnected from the PC. Check the USB communication cable connection. 4. The emulator has somehow become physically disconnected from the target board. Check the communications cable connection. 5. The device is code-protected.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 10.3.7 Internal Error Actions Internal errors are unexpected and should not happen. They are primarily used for internal Microchip development. The most likely cause is a corrupted installation (Section 10.3.4 “Corrupted Installation Actions”). Another likely cause is exhausted system resources. 1. Try rebooting your system to free up memory. 2. Make sure you have a reasonable amount of free space on your hard drive (and that it is not overly fragmented.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR Chapter 11. Emulator Function Summary 11.1 INTRODUCTION A summary of the MPLAB REAL ICE in-circuit emulator functions on menus, in windows and on dialogs is listed here. • • • • 11.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide Step Into F7 Single step through program code. For assembly code, this command executes one instruction (single or multiple cycle instructions) and then halts. After execution of one instruction, all the windows are updated. 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.
Emulator Function Summary 11.2.2 Right Mouse Button Menu The following will appear on the right mouse menus in code displays, such as program memory and source code files: Log Selected Value Log the value of the highlighted variable in the trace window. See Section 7.3.5 “Setting Up Trace in MPLAB IDE”. Insert Line Trace Log the occurrence of the selected line in the trace window. See Section 7.3.5 “Setting Up Trace in MPLAB IDE”.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 11.3.1 Breakpoints Dialog To set up breakpoints, select Debugger>Breakpoints. Set up different types of breakpoints in this dialog. Click on Add Breakpoint to add breakpoints to the dialog window. Depending on your selected device, there may be other buttons for more advanced breakpoint options. 11.3.1.1 BREAKPOINT DIALOG WINDOW Information about each breakpoint is visible in this window.
Emulator Function Summary 11.3.2 Set Breakpoint Dialog Click Add Breakpoint in the Breakpoints Dialog to display this dialog. Select a breakpoint for the Breakpoints dialog here. 11.3.2.1 PROGRAM MEMORY TAB Set up a program memory breakpoint here. TABLE 11-3: PROGRAM MEMORY BREAKPOINT Control Function Address Location of breakpoint in hex Breakpoint Type The type of program memory breakpoint. See the device data sheet for more information on table reads/writes.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 11.3.3 Stopwatch Dialog Click Stopwatch in the Breakpoints Dialog to display this dialog. The stopwatch allows timing from one breakpoint/trigger condition to the next. The stopwatch value is in decimal. TABLE 11-5: STOPWATCH SETUP Control Function Start Condition Click Select Start Condition to choose an available breakpoint or trigger condition to start the stopwatch.
Emulator Function Summary 11.3.6 AND Dialog Click ANDed Breakpoints in the Breakpoints Dialog to display this dialog. Set up an ANDed condition for breaking, i.e., breakpoint 1 AND breakpoint 2 must occur at the same time before a program halt. This can only be accomplished if a data breakpoint and a program memory breakpoint occur at the same time. To add a breakpoint to the AND condition: • Select a breakpoint from the list of “Available Breakpoints”.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide FIGURE 11-1: WATCH WINDOW WITH UPDATE Data Capture Runtime Watch Click on a diamond in the “Update” column to alternately set/remove data capture or a runtime watch. Right click in the “Update” column to see data capture and runtime watch options, or right click on a diamond to pop up a menu with options for only data capture or a runtime watch.
Emulator Function Summary Data captures use the same resources as breakpoints, so the maximum available number of breakpoints applies to the maximum number of available data captures and breakpoints. As an example, if 4 breakpoints are available, and two breakpoints are set, up to two data captures may be set also. If Native trace is used, then data captures cannot be used because of hardware constraints. However, breakpoints are still available. 11.3.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 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. Go To Trace Line – Go to the trace line specified in the dialog. Go To Source Line – Open a File window and go to the source code line corresponding to the selected trace line. Show Source Show/hide the source code listing on the bottom of the window.
Emulator Function Summary TABLE 11-7: TRACE SETUP (CONTINUED) Control Function Related Section I/O Port Select to use a device I/O port for Section 7.3.3.2 “I/O Port Trace” trace, and then select the port you will be using from the pull-down list. SPI* Select to use device SPI pins for Section 7.3.3.3 “SPI Trace” trace, and then select the SPI port you will be using from the pull-down list.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 11.5 SETTINGS DIALOG Select either Debugger>Settings or Programmer>Settings to open the Settings dialog and set up the MPLAB REAL ICE in-circuit emulator. Note: • • • • • • • • Tabs displayed will depend on the selected device.
Emulator Function Summary 11.5.2 Settings Dialog, Configuration Tab Configure emulator operation on this tab. TABLE 11-9: 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.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 11.5.4 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 emulator.
Emulator Function Summary 11.5.7 Settings Dialog, Secure Segment Tab For CodeGuard™ Security devices, set up secure segment properties on this tab. For more details on CodeGuard Security functionality, please refer to the CodeGuard Security reference manual for 16-bit devices (DS70180) and dsPIC33F/PIC24H and dsPIC30F device programming specifications found on our website. TABLE 11-13: SECURE SEGMENT OPTIONS Full Chip Programming Click to select to program all program memory segments.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 112 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Chapter 12. Hardware Specification 12.1 INTRODUCTION The hardware and electrical specifications of the MPLAB REAL ICE in-circuit emulator system are detailed. 12.2 HIGHLIGHTS This chapter discusses: • • • • • • • 12.3 Declaration of Conformity USB Port/Power Emulator Pod Standard Communication Hardware High-Speed Communication Hardware Loop-Back Test Board Target Board Considerations DECLARATION OF CONFORMITY We Microchip Technology, Inc. 2355 W.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 12.4 USB PORT/POWER The MPLAB REAL ICE in-circuit emulator is connected to the host PC via a Universal Serial Bus (USB) port, version 2.0 compliant. The USB connector is located on the back 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 12.5.3 Indicator Lights (LEDs) The indicator lights have the following significance. LED Color Description Active Blue Lit when power is first applied or when target is connected. Status Green Lit when the emulator is operating normally – standby. 12.5.4 Red Lit when an operation has failed. Orange Lit when the emulator is busy.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide The electrical specifications for logic probes are listed in Table 12-2. TABLE 12-2: Logic Inputs LOGIC PROBE ELECTRICAL SPECIFICATIONS VIH = VDD x 0.7V (min) VIL = VDD x 0.3V (max) Logic Outputs VDD = 5V VDD = 3V VDD = 2.3V VDD = 1.65V VOH = 3.8V min VOH = 2.4V min VOH = 1.9V min VOH = 1.2V min VOL = 0.55V max VOL = 0.55V max VOL = 0.3V max 12.6 VOL = 0.
Hardware Specification FIGURE 12-2: 6-PIN STANDARD PINOUT Pin Standard Socket 2 4 6 Bottom of Target Board 1 12.6.2 3 5 1 2 3 4 5 6 Name Function VPP VDD_TGT GND ICSPDAT ICSPCLK AUX Power Power on target Ground Standard Com Data Standard Com Clock Auxiliary Modular Cable and Connector For standard communications, a modular cable connects the emulator and the target application. The specifications for this cable and its connectors are listed below. 12.6.2.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 12.6.2.3 MODULAR CABLE SPECIFICATION • Manufacturer, Part Number – Microchip Technology, 07-00024 8.00” Pin 1 DS51616B-page 118 Pin 6 © 2008 Microchip Technology Inc.
Hardware Specification 12.7 HIGH-SPEED COMMUNICATION HARDWARE For high-speed emulator communication with a target (Section 2.3.2 “High-Speed Communication”), use the Performance Pak.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 12.7.2 High-Speed Receiver Board A high-speed receiver board assembly is also required when using LVDS connectivity. This board is a counterpart to the high-speed driver board assembly in the pod. When the driver is active on the pod, the receiver is active in the receiver board.
Hardware Specification FIGURE 12-7: RECEIVER BOARD SCHEMATIC – ICSPCLK AHC1G04-SOT5 NCLK_EN 3 1 VCCA 6 VCCB VDD_TAR 4 LVC+ +3.3V CLK_EN 2 4 CLK 5 CLK_EN 2 100 6 1 7 LVC- 3 DIR A B 4 ICSPCLK 4.7K GND SN65MLVD206 74LVC1T45_SOT-6P 3 CLKEN+ 4 2 100 6 1 7 CLKEN- CLK_EN SN65MLVD206 FIGURE 12-8: RECEIVER BOARD SCHEMATIC – DAT & CLK 3 USPID+ +3.3V 4 DAT 2 100 6 1 7 USPID- 10K 10K SN65MLVD206 3 USPIC+ 4 100 USPIC- +3.3V CLK 2 6 7 1 10K 10K POWER 0.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide 12.8 LOOP-BACK TEST BOARD This board can be used to verify that the emulator is functioning properly. To use this board: 1. 2. 3. 4. Disconnect the emulator from the target and the PC. Insert the standard driver board if it is not already installed. Connect the loop-back test board to the emulator using the modular cable.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Appendix A. Revision History Revision A (September 2006) • Initial release of this document. Revision B (May 2008) • Additional chapters: - Tutorial - FAQ - Error Messages • “Debugging and Programming” chapter expanded into several chapters under Part 2 - Features. • “Device and Feature Support” section added to “Overview” chapter. • Updates to most existing chapters. © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 124 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR 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® REAL ICE™ In-Circuit Emulator User’s Guide Asynchronous Stimulus Data generated to simulate external inputs to a simulator device. 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 Breakpoint: An event whose execution will cause a halt.
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® REAL ICE™ In-Circuit Emulator 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 and PICkit 2 (with Debug Express) are Microchip’s in-circuit debuggers. ICE In-Circuit Emulator.
MPLAB® REAL ICE™ In-Circuit Emulator 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 A higher data transfer rate means fewer wires are required, as in UW (Ultra Wide) and UW-2/3 SCSI hard disks, which use only 68 wires. These devices require a high transfer rate over short distances. Using standard I/O transfer, SCSI hard drives would require a lot more than 68 wires. Low voltage means that the standard 5 volts is replaced by either 3.3 volts or 1.5 volts. LVDS uses a dual wire system, running 180 degrees of each other.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide Microprocessor Mode One of the possible program memory configurations of PIC17 and PIC18 microcontrollers. In microprocessor mode, the on-chip program memory is not used. The entire program memory is mapped externally. Mnemonics Text instructions that can be translated directly into machine code. Also referred to as opcodes.
Glossary MPLAB SIM Microchip’s simulator that works with MPLAB IDE in support of PICmicro MCU and dsPIC DSC devices. MPLIB™ Object Librarian Microchip’s librarian that can work with MPLAB IDE. MPLIB librarian is an object librarian for use with COFF object modules created using either MPASM assembler (mpasm or mpasmwin v2.0) or MPLAB C17/C18 C compilers. MPLINK™ Object Linker MPLINK linker is an object linker for the Microchip MPASM assembler and the Microchip MPLAB C17 or C18 C compilers.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide One-to-One Project-Workspace Model The most common configuration for application development in MPLAB IDE to is have one project in one workspace. Select Configure>Settings, Projects tab and check “Use one-to-one project-workspace model”. Opcodes Operational Codes. See Mnemonics. Operators Symbols, like the plus sign ‘+’ and the minus sign ‘-’, that are used when forming well-defined expressions.
Glossary PRO MATE II No longer in Production. See the MPLAB PM3 device programmer. A device programmer from Microchip. Programs most PICmicro microcontrollers as well as most memory and KEELOQ devices. Can be used with MPLAB IDE or stand-alone. Profile For MPLAB SIM simulator, a summary listing of executed stimulus by register. Program Counter The location that contains the address of the instruction that is currently executing. Program Memory The memory area in a device where instructions are stored.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide Recursion The concept that a function or macro, having been defined, can call itself. Great care should be taken when writing recursive macros; it is easy to get caught in an infinite loop where there will be no exit from the recursion. ROM Read Only Memory (Program Memory). Memory that cannot be modified. Run The command that releases the emulator from halt, allowing it to run the application code and change or respond to I/O in real time.
Glossary Source File An ASCII text file containing source code. Special Function Registers The portion of data memory (RAM) dedicated to registers that control I/O processor functions, I/O status, timers or other modes or peripherals. Stack, Hardware Locations in PICmicro microcontroller where the return address is stored when a function call is made. Stack, Software Memory used by an application for storing return addresses, function parameters, and local variables.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide System Window Control The system window control is located in the upper left corner of windows and some dialogs. Clicking on this control usually pops up a menu that has the items “Minimize,” “Maximize,” and “Close.” Target Refers to user hardware. Target Application Software residing on the target board. Target Board The circuitry and programmable device that makes up the target application.
Glossary Warning An alert that is provided to warn you of a situation that would cause physical damage to a device, software file, or equipment. Watch Variable A variable that you may monitor during a debugging session in a Watch window. Watch Window Watch windows contain a list of watch variables that are updated at each breakpoint. Watchdog Timer A timer on a PICmicro microcontroller that resets the processor after a selectable length of time.
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide NOTES: DS51616B-page 140 © 2008 Microchip Technology Inc.
MPLAB® REAL ICE™ IN-CIRCUIT EMULATOR USER’S GUIDE Index Numerics 16-Bit (Data Memory) Devices, Trace...................... 68 32-Bit Devices, Trace............................................... 75 8-Bit (Data Memory) Devices, Trace........................ 68 A Abort Operation........................................................ 98 AC244006 ................................................................ 78 AC244006, Adapter ................................................. 78 Animate ..................
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide J JTAG ........................................................................ 63 K Kit Components........................................................ 10 L LEDs ................................................................ 31, 115 Light Icons ................................................................ 32 Loading Program and Debug Code.......................... 40 Logic Probe Connector ....................................
Index RIErr0060................................................................. 92 RIErr0061................................................................. 93 RIErr0062................................................................. 93 RIErr0063................................................................. 93 RIErr0064................................................................. 93 RIErr0065................................................................. 93 RIErr0066.............................
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.