Microchip Technology MPLAB REAL ICE User guide

MPLAB® REAL ICE
In-Circuit Emulator
User’s Guide
© 2008 Microchip Technology Inc. DS51616B
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron, dsPIC, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PRO MA TE, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
FilterLab, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programmin g , IC SP, ICEPIC, Mindi, MiW i , MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC
32
logo, PowerCal, PowerInfo, PowerMate, PowerT ool, REAL ICE, rfLAB, Select Mode, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.
© 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
®
MCUs and dsPIC® DSCs, KEELOQ
®
code hopping
DS51616B-page ii © 2008 Microchip Technology Inc.
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.3 How the Emula t o r H e lp s You ....................................................................... 10
1.4 Emulator Kit Components ............................................................................10
1.5 Device and Feature Support ........................................................................11
Chapter 2. Operation
2.1 Introduction ...................................................................................................13
2.2 Tool Compa r is o n s ........ ............................. ................................................... 13
2.3 Emulator Communications with the PC and Target .....................................14
2.4 Target Communication Connections ............................................................17
2.5 Trace Connections .......................................................................................20
2.6 Debugging with the Emulator .......................................................................23
2.7 Requirem e n t s F o r D e b ugg ing .............. .. ... ............. .. .. .............. .. .................. 23
2.8 Programm in g w ith th e Em u la to r ..... .. .. .......................................................... 2 6
2.9 Resource s U sed b y th e E mu la to r ................................................................. 26
Chapter 3. Installation
3.1 Introduction ...................................................................................................27
3.2 Installing the Software .................................................................................. 27
3.3 Installing th e USB D e vi c e D r iv e rs ............. ............... .................................... 27
3.4 Selecting Target Communications .............. ................................................. 28
3.5 Setting Up the Target ...................................................................................29
3.6 Connecti n g the L o gi c Pr o bes ....................................................................... 30
3.7 Setting Up MPLAB IDE ................................................................................ 30
© 2008 Microchip Technology Inc. DS51616B-page iii
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 th e P roj e c t Wiz ar d .......................................................................... 35
4.5 Viewing the Pr o je c t .. ....................................................... .............................. 36
4.6 Creating a Hex Fi le ....................................................................................... 37
4.7 Viewing De bu g Op tions .......... ... .. ................................................................. 3 8
4.8 Setting Up the Demo Board ......................................................................... 40
4.9 Loading Program Code For Debugging .......................................................40
4.10 Running Debug Code ................................................................................. 41
4.11 Debugging Code Using Breakpoints ..........................................................41
4.12 Debugging Code Using A Runtime Watch ................................................. 47
4.13 Debugging Code Using Native Trace .........................................................48
4.14 Programming the Application ..................................................................... 51
4.15 Other Trace Methods – SPI or I/O Port Trace ............................................52
4.16 Other Trace Methods – PIC32 Instruction Trace .... ....................................57
Part 2 – Features Chapter 5. General Setup
5.1 Introduction ................................................................................................... 61
5.2 Starting the MPLAB IDE Software ................................................................ 61
5.3 Creating a Project ......................................................................................... 62
5.4 Viewing the Pr o je c t .. ..................................................................................... 62
5.5 Building the Pr o je c t ................ ...................................................................... 63
5.6 Setting Con figuration Bits ............ .. .. ........................... .. .. ............. ... .. ............ 63
5.7 Setting the Emulator as the Debugger or Programmer ................................63
5.8 Debugger/Programmer Limitations ..............................................................64
Chapter 6. Basic Debug Functions
6.1 Introduction ................................................................................................... 65
6.2 Breakpoints and Stopwatch ..........................................................................65
6.3 External Triggers .......................................................................................... 66
Chapter 7. Debug for 8- and 16-Bit Devices
7.1 Introduction ................................................................................................... 67
7.2 Data Capture and Runtime Watches ............................................................67
7.3 Trace . .. ......................................................................................................... 67
Chapter 8. Debug for 32-Bit Devices
8.1 Introduction ................................................................................................... 75
8.2 Data Capture and Runtime Watches ............................................................75
8.3 PIC32 Instruction Trace ................................................................................ 75
DS51616B-page iv © 2008 Microchip Technology Inc.
Part 3 – Reference Chapter 9. Frequently Asked Questions (FAQ)
9.1 Introduction ...................................................................................................83
9.2 How Does It Work F A Q s ......... .. .......................................... ......................... 83
9.3 How Does Trace Work – 8 and 16 Bit Devices ............................................85
9.4 What’s Wrong ...............................................................................................86
Chapter 10. Error Messages
10.1 Introd uc t io n ................................................................................................. 8 9
10.2 Specific Error Messages ....................................... .....................................89
10.3 Gener a l C o rr ec tive Actions ............ .. .. ........................... .. .. ............. ... .. ....... 93
Chapter 11. Emulator Function Summary
11.1 Introd uc t io n ................................................................................................. 9 7
11.2 Debugging Functions .................................................................................97
11.3 Debugging Dialogs/Windows .....................................................................99
11.4 Progra mming Functio ns ........................................................................... 107
11.5 Settin gs D ia lo g ......................................................................................... 108
Table of Contents
Chapter 12. Hardware Specification
12.1 Introd uc t io n ............................................................................................... 11 3
12.2 Highlig h t s ........... ....................................................................................... 113
12.3 Declar a tion of Conform ity ................................................ .. .. ..................... 113
12.4 USB Por t/Power ............. ... .. ............. .. .. ........................... .. .. .............. .. .. ... 11 4
12.5 Emulato r Pod ................................ ............................................................ 114
12.6 Standard Communication Hardware ........................................................116
12.7 High-Speed Communication Hardware ....................................................119
12.8 Loop-Back Test Board ..............................................................................122
12.9 Target Board Considerations ................................................................... 122
Appendix A. Revision History ..................................................................................123
Glossary .....................................................................................................................125
Index ...........................................................................................................................141
Worldwide Sales and Service ..................................................................................144
© 2008 Microchip Technology Inc. DS51616B-page v
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. This number is located on the bottom of each page, in front of the p age number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document.
For the most up-to-date information on development tools, see the MPLAB Select the Help menu, and then Topics to open a list of available on-line help files.
INTRODUCTION
®
IDE on-line help.
This chapter contains general information that will be helpful to know before using the MPLAB REAL ICE in-circuit emulator. Items discussed include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
© 2008 Microchip Technology Inc. DS51616B-page 1
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.
• Chapter 2: Operation – The theory of MPLAB REAL ICE in-circuit emulator operation. Explains configuration options.
• Chapter 3: Installation – How to install the emulator software and hardware.
• Chapter 4: Tutorial – A brief tutorial on using the emulator.
Part 2 – Features
• Chapter 5: General Setup – How to set up MPLAB IDE to use the emulator.
• Chapter 6: Basic Debug Functions – A description of basic emulator features
available in MPLAB IDE when the MPLAB REAL ICE in-circuit emulator is chosen as the debug tool. This includes the debug features breakpoints, stopwatch, and external triggering.
• Chapter 7: Debug for 8- and 16-Bit Devices – A description of data capture, runtime watches and trace for 8- and 16-bit (data memory) devices. Includes the types of trace available and how to setup and use trace.
• Chapter 8: Debug for 32-Bit Devices – A description of data capture, runtime watches and trace for 32-bit devices. Includes hardware and software setup for use of PIC32 instruction trace.
Part 3 – Reference
• Chapter 9: Frequently Asked Questions – A list of frequently-asked questions,
useful for troubleshooting.
• Chapter 10: Error Messages – A list of error messages and suggested resolutions.
• Chapter 11: Emulator Function Summary – A summary of emulator functions available in MPLAB IDE when the MPLAB REAL ICE emulator is chosen as the debug or program tool.
• Chapter 12: Hardware Specification – The hardware and electrical specifications of the emulator system. Includes a description of how to use the loop-back test board.
DS51616B-page 2 © 2008 Microchip Technology Inc.
CONVENTIONS USED IN THIS GUIDE
The following conventions may appear in this documentation:
TABLE 1: DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic Referenc ed books MPLAB
Initial caps A window the Output window
Quotes A field name in a window or
Underlined, italic text with right angle bracket
Bold A dialog button Click OK
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier font:
Plain Sample source code #define START
Italic A variable argument file.o, where file can be
Square brackets [ ] Optional arguments mpasmwin [options]
Curly brackets and pipe character: { | }
Ellipses... Replaces r epeated text var_name [,
Preface
®
IDE User’s Guide
Emphasized text ...is the only compiler...
A dialog the Settings dialog A menu selection select Enable Programmer
“Save project before build”
dialog A menu path File>Save
A tab Click the Power tab
Filenames autoexec.bat File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1 Constants 0xFF, ’A’
any valid filename
file [options]
Choice of mut ually exclus ive arguments; an OR selection
Represents code supplied by user
errorlevel {0|1}
var_name...]
void main (void) { ... }
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in your Warranty Registration Card entitles you to receive new product updates. Interim software releases are available at the Microchip web site.
© 2008 Microchip Technology Inc. DS51616B-page 3
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.htm” file (an HTML file) in the Readmes subdirectory of the MPLAB IDE installation directory. The release notes (Readme) contains update information and known issues that may not be included in this user’s guide.
MPLAB REAL ICE In-Circuit Emulator Setup (DS51615) MPLAB REAL ICE In-Circuit Emulator Setup - PIC32MX (DS51687)
These posters show you how to hook up the hardware and install the software for the MPLAB REAL ICE in-circuit emulator.
MPLAB REAL ICE In-Circuit Emulator On-line Help File
A comprehensive help file for the emulator is included with MPLAB IDE. Usage, troubleshooting and hardware specifications are covered. This may be more up-to-date than the printed documentation. Also, emulator reserved resources and limitations are listed for various devices.
Header Board Specification (DS51292)
This booklet describes how to install and use MPLAB REAL ICE in-circuit emulator headers. Headers are used to better debug selected devices using special -ICE device versions, without the loss of pins or resources.
Transition Socket Specification (DS51194)
Consult this document for information on transition sockets available for use with MPLAB REAL ICE in-circuit emulator and MPLAB ICD 2 in-circuit debugger headers, as well as MPLAB ICE 2000/4000 device adaptors.
DS51616B-page 4 © 2008 Microchip Technology Inc.
Preface
THE MICROCHIP WEB SITE
Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information:
Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software
General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing
Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest.
To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions.
The Development Systems product group categories are:
Compilers – The latest info rmatio n on Microc hip C comp ilers, as semblers , linker s and other language tools. These include all MPLAB C compilers; all MPLAB assemblers (including MPASM™ assembler); all MPLAB linkers (including MPLINK™ object linker); and all MPLAB librarians (including MPLIB™ object librarian).
Emulators – The latest information on Microchip in-circuit emulators.These include the MPLAB REAL ICE™, MPLAB ICE 2000 and MPLAB ICE 4000 in-circuit emulators
In-Circuit Debuggers – The latest information on Microchip in-circuit debuggers. These include the MPLAB ICD 2 in-circuit debugger and PICkit™ 2 debug express.
MPLAB Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and MPLAB SIM simulator, as well as general editing and debugging features.
Programmers – The latest information on Microchip programmers. These include the MPLAB PM3 and PRO MATE Plus and PICkit 1 and 2 development programmers.
®
IDE – The latest information on Microchip MPLAB IDE, the Windows®
®
II device programmers and the PICSTART®
© 2008 Microchip Technology Inc. DS51616B-page 5
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.
Technical support is available through the web site at: http://support.microchip.com
DS51616B-page 6 © 2008 Microchip Technology Inc.
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........................................................................................................31
© 2008 Microchip Technology Inc. DS51616B-page 7
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
NOTES:
DS51616B-page 8 © 2008 Microchip Technology Inc.

Chapter 1. Overview

1.1 INTRODUCTION

An overview of the MPLAB REAL ICE in-circuit emulator system is given.
• Emulator Defined
• How the Emulator Helps You
• Emulator Kit Components
• Device and Feature Support

1.2 EMULATOR DEFINED

MPLAB® REAL ICE™ IN-CIRCUIT
EMULATOR USER’S GUIDE
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 in-circuit emulator is an integral part of the development engineer's toolsuite. The application usage can vary from software development to hardware integration to manufacturing test to field service.
The MPLAB REAL ICE in-circuit emulator is a modern emulator system that supports hardware and software development for selected Microchip PIC (MCUs) and dsPIC Serial Programming™ (ICSP™) programming capability and Standard DUT Programming (STDP) 2-wire serial interfaces.
The emulator system will execute code in an actual device because these Microchip devices have built-in emulation circuitry, instead of a special emulator chip, for emulation. All available features of a given device are accessible interactively, and can be set and modified by the MPLAB IDE interface.
The MPLAB REAL ICE emulation concept has these features:
• Processors run at maximum speeds
• Debugging can be done with the device in-circuit
• No emulation load on the processor bus
• Simple interconnection
• Capability to incorporate I/O port data input
• Trace (MPLAB IDE and Compiler Assisted) – 8 and 16-bit devices
• Hardware Trace – 32-bit devices
In addition to emulator functions, the MPLAB REAL ICE in-circuit emulator system also may be used as a development programmer.
®
Digital Signal Controllers (DSCs) that are based on In-Circuit
®
platform. The MPLAB REAL ICE
®
microcont rollers
© 2008 Microchip Technology Inc. DS51616B-page 9
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:
• Debug application on hardware in real time
• Debug with hardware breakpoints
• Debug with software breakpoints (device-dependent)
• Set breakpoints based on internal and/or external signals
• Monitor internal file register s
• Emulate full speed
• Program device
• Trace lines of code or log variable/expression values

1.4 EMULATOR KIT COMPONENTS

The components of the MPLAB REAL ICE in-circuit emulator system kit are listed below.
1. CD-ROM with MPLAB IDE software and on-line documentation
2. Emulator pod
3. USB cable to provide communications between the emulator and a PC and to provide power to the emulator
4. Standard driver board (MPLAB ICD 2 compatible) and cable to connect the emulator pod to a header module or target board
5. Logic probes
6. Loop-back test board
Additional hardware that may be ordered separately:
7. Processor Extension Pack: High-speed driver board, ICE header/receiver board and cables to connect the emulator pod to a target board
8. Performance Pack: High-speed driver board, high-speed receiver board and cables to connect the emulator pod to a target board
9. High-speed to standard converter board
10. Transition socket
11. Opto-isolation board
DS51616B-page 10 © 2008 Microchip Technology Inc.

1.5 DEVICE AND FEATURE SUPPORT

Feature PIC32MX
dsPIC33F,
PIC24F/H
dsPIC30F
SMPS
(3)
dsPIC30F
Reset application C C C C Run, Halt
C C C C
Single Step C C C C Animate C C C C Full Speed Emulation
C C C C
Hardware Breakpoints C C C C Advanced Breakpoints C C C C Software Breakpoint s
N C C C
Peripheral Freeze
(4)
C C C C
Break on data fetch or write
C C C C
Break on Stack overflow
C C C C
Stopwatch C C C C Pass Counter C C C C WDT overflow
C C C N
PIC32 Instruction Trace (built-in)
C N N N
Native Trace (built-in)
N C C N
SPI Trace
N C N
(1)
D
(1)
I/O Port Trace N C N
(2)
D
(2)
Trace Macros for C code N C C C Trace Macros for ASM code
N N N N
Runtime Watch C C C N Standard Speed Comm. C C C C High Speed Comm.
C C C C
Processor Pak N F F N Probe trigger C C C C
Legend: C = Current support D = Support dependent on device F = No support now, but planned in the future N = Support Not Available
Note 1: No SPI Trace for devices with SPI port pins multiplexed with PGC/PGD pins.
2: No I/O Port Trace for devices without a port with a full 8 bits available for trace OR devices with pin
counts of 44 or less.
3: Current Switch Mode Power Supply (SMPS) devices: dsPIC30F1010/2020/2023. 4: This feature operates differently depending on the selected device.
The following shows the current and future support for devices and device features, depending on your selected device.
TABLE 1-1: 32-BIT AND 16-BIT (DATA MEMORY) DEVICES
Overview
© 2008 Microchip Technology Inc. DS51616B-page 11
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
Feature 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 Breakpoint s 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 C N N Native Trace (built-in) C N N SPI Trace
C C N
I/O Port Trace C C N Trace Macros for C code C C N Trace Macros for ASM code
C C N
Runtime Watch C N N Standard Speed Comm. C C C High Speed Comm.
C C C
Processor Pak F F F Probe trigger C C C
Legend: C = Current support D = Support dependent on device F = No support now, but planned in the future N = Support Not Available
Note 1: No SPI Trace for devices with SPI port pins multiplexed with PGC/PGD pins.
2: No I/O Port Trace for devices without a port with a full 8 bits available for trace OR devices with pin
counts of 44 or less.
3: This feature operates differently depending on the selected device.
TABLE 1-2: 8-BIT (DATA MEMORY) DEVICES
DS51616B-page 12 © 2008 Microchip Technology Inc.

2.1 INTRODUCTION

A simplifi ed desc ripti on of how t he MPL AB REAL ICE i n-cir cuit em ulator 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.
• Tool Comparisons
• Emulator Communications with the PC and Target
• Ta rget Comm uni ca tio n Conne cti ons
• Trace Connections
• Debugging with the Emulator
• Requirements For Debugging
• Programming with the Emulator
• Resources Used by the Emulator
MPLAB® REAL ICE™ IN-CIRCUIT
EMULATOR USER’S GUIDE

Chapter 2. Operation

2.2 TOOL COMPARISONS

The MPLAB REAL ICE in-circuit emulator system is a next generation In-Circuit Emulator (ICE) system. It differs from classical in-circuit emulator systems in a single, but important way: the production device and emulation device are the same. This means that the actual device/emulated device differences are all but eliminated. For example, speed bottlenecks caused by bringing internal busses off-chip and using external memories on classical emulator systems are eliminated by using the actual device for emulation.
Another significant benefit is that there is no time lag from when the device is released to when an emulator module to support the device can be released. If a header board is required, it can be developed to coincide with the device release, or lag it by a small amount, which is a great improvement over the longer processor module development times.
The MPLAB REAL ICE in-circuit emulator system surpasses in-circuit debugger systems in speed and functionality (e.g., trace).
© 2008 Microchip Technology Inc. DS51616B-page 13
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
USB/Power
Emulator Pod
Logic Probe Connector
Indicator Lights
Push Buttons
ACTIVE STATUS
RESETFUNCTION
Standard or High-Speed Driver Board

2.3 EMULATOR COMMUNICATIONS WITH THE PC AND TARGET

The MPLAB REAL ICE in-circuit emulator system consists of these items:
• Emulator pod with indicator lights, push buttons and a logic probe connector
• USB cable to connect a PC to the emulator pod and power the pod
• Driver board and modular cable(s) to connect the emulator pod to an ICE header
or target board
FIGURE 2-1: BASIC EMULATOR SYSTEM
The emulator communicates with the PC and is powered through the USB cable. The emulator communicates with the target through the configurations 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.
2.3.1 Standard Communication
The emulator system can be configured to use standard communication for both programming and debugging functions. This 6-pin connection is the same one used by other Microchip in-circuit debuggers.
The standard driver board is plugged into the emulator pod to configure the system for communication with the target. The modular cable can be either (1) inserted into a matching socket at the target, where the target device is on the target board (Figure 2-2), or (2) inserted into a standard adapter/header board combo (available as a Processor Pak), which in then plugged into the target board (Figure 2-3).
Note: Older header boards used a 6-pin (RJ-11) connector instead of an 8-pin
connector, so these headers may be connected directly to the emulator.
For more on standard communication, see Chapter 12. “Hardware Specification”.
DS51616B-page 14 © 2008 Microchip Technology Inc.
Operation
Emulator Pod
Target Board
Target Device
ACTIVE STATUS
RESETFUNCTION
Standard Driver Board
or PIM
Emulator Pod
T a rget Board
Transition Socket
ACTIVE STATUS
RESETFUNCTION
Device-ICE
Processor Pak
Standard Adapter
Header
Standard Driver Board
FIGURE 2-2: STANDARD EMULATOR SYSTEM – DEVICE WITH
ON-BOARD ICE CIRCUITRY
FIGURE 2-3: STANDARD EMULATOR SYSTEM – ICE DEVICE
© 2008 Microchip Technology Inc. DS51616B-page 15
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
Emulator Pod
Target Board
High-Speed Driver Board
Target Device
ACTIVE STATUS
RESETFUNCTION
J2
J3
High-Speed Receiver Bo ard
J2
J3
Performance Pak
or PIM
Emulator Pod
ACTIVE STATUS
RESETFUNCTION
J2
J3
Target Board
Transition Socket
J2
J3
Device-ICE
Header from
Processor Pak
Performance Pak
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.
The high-speed driver board (from the Performance Pak) is plugged into the emulator pod to configure the system for this type of communication with the target. The modular cables can be inserted into matching sockets at the high-speed receiver board, which is attached via an 8-pin connector into either (1) the target board, with an on-board target device (Figure 2-4), or (2) the header board (from the Processor Pak), which in then plugged into the target board (Figure 2-5).
For more on high-speed communication, see Chapter 12. “Hardware Specification”.
FIGURE 2-4: HIGH-SPEED EMULATOR SYSTEM – DEVICE WITH
ON-BOARD ICE CIRCUITRY
FIGURE 2-5: HIGH-SPEED EMULATOR SYSTEM – ICE DEVICE
DS51616B-page 16 © 2008 Microchip Technology Inc.

2.4 TARGET COMMUNICATION CONNECTIONS

12345
6
Bottom of Target Board
VPP/MCLR
VSS
PGC
V
DD
PGD
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.1 Standard Communicat ion Connection
Using the standard driver board, the MPLAB REAL ICE in-circuit emulator is connected to the target device with the modular interface (six-conductor) cable. The pin numbering for the connector is shown from the bottom of the target PC board in Figure 2-6.
Note: Cable connections at the emulator and target are mirror images of each
other, i.e., pin 1 on one end of the cable is connected to pin 6 on the other end of the cable. See Section 12.6.2.3 “Modular Cable Specification”.
FIGURE 2-6: STANDARD CONNECTION AT TARGET
Operation
© 2008 Microchip Technology Inc. DS51616B-page 17
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
1 2 3 4 5 6 7 8
J1
Top of Target Board
VPP/MCLR
VSS
PGC
V
DD
PGD
DAT*
CLK*
Used for optional SPI trace capabilit y. See
Section 2.5.2 “SPI Trace Connections (High-Speed Communication Only)”.
*
V
DD
VPP/MCLR PGC PGD
V
SS
AV
DD
AV
SS
2
1 5 4 3
User Reset
4.7K-10K
Interface Connector
Application
PC Board
Device
ACTIVE
STATUS
RESETFUNCTION
Emulator Pod
XTAL
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”.
FIGURE 2-7: HIGH-SPEED CONNECTION AT TARGET
2.4.3 Target Connection Circuitry
Figure 2-8 shows the interconnections of the MPLAB REAL ICE in-circuit emulator to the connector on the target board. The diagram also shows the wiring from the connector to a device on the target PC board. A pull-up resistor (typically 10 kΩ) is recommended to be connected from the V strobed low to reset the device.
FIGURE 2-8: STANDARD CONNECTION TARGET CIRCUITRY
In the following descriptions, only three lines are active and relevant to core emulator operation: pins 1 (V shown on the above diagram for completeness, but are only sensed, not provided or controlled, by the emulator.
Be aware that the target V target low-voltage operation. If the emulator does not sense voltage on its V
DS51616B-page 18 © 2008 Microchip Technology Inc.
2 of the interface connector), it will not operate.
PP/MCLR), 5 (PGC) and 4 (PGD). Pins 2 (VDD) and 3 (VSS) are
DD is sensed by the emulator to allow level translation for
PP/MCLR line to VDD so that the line may be
DD line (pin
Operation
No!
No!
No!
No!
VPP/MCLR
PGC PGD
1
5
4
Interface Connector
ACTIVE
STATUS
RESETFUNCTION
Emulator Pod
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 V lines be connected to the appropriate levels. Also, devices with a V PIC18FXXJ devices) should be connected to the appropriate capacitor or other internal regulator device.
Note: The interconnection is very simple. Any problems experienced are often
caused by other connections or components on these critical lines that interfere with the operation of the MPLAB REAL ICE in-circuit emulator system, as discussed in the next section.
2.4.4 Circuits That Will Prevent the Emulator From Functioning
Figure 2-9 shows the active emulator lines with some components that will prevent the MPLAB REAL ICE in-circuit emulator system from functioning.
FIGURE 2-9: IMPROPER CIRCUIT COMPONENTS
DD/AVDD and VSS/AVSS
CAP pin (like
© 2008 Microchip Technology Inc. DS51616B-page 19
Specifically, these guidelines must be followed:
• Do not use pull-ups on PGC/PGD – they will divide the voltage levels, since these
lines have 4.7 kΩ pull-down resistors in the emulator.
• Do not use capacitors on PGC/PGD – they will prevent fast transitions on data
and clock lines during programming and debug communications.
• Do not use capacitors on MCLR
– they will prevent fast transitions of VPP. A
simple pull-up resistor is generally sufficient.
• Do not use diodes on PGC/PGD – they will prevent bidirectional communication
between the emulator and the target device.
For other operational issues, see:
Chapter 10. “Err or Messa ges”
Chapter 9. “Frequently Asked Questions (FAQ)”
Section 10.3.6 “Debug Failure Actions” (Top Reasons Why You Can’t Debug)
Section 12.8 “Loop-Back Test Board”
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
7
8
Application
PC Board
5
DAT CLK
Device
SPI
SDO SCK
High-Speed Interface Connector
ACTIVE
STATUS
RESETFUNCTION
Emulator Pod

2.5 T RACE 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.
For more on this type of trace, see Section 7.3.3.1 “Native Trace”.
2.5.2 SPI Trace Connections (High-Speed Communication Only)
When using high-speed communications, streaming serial trace is an optional trace available using the device SPI and pins 7 (DA T) and 8 (CLK). Figure 2-10 shows these additional connections. As with pins 4 (PGD) and 5 (PGC) (Section 2.4.4 “Circuits That Will Prevent the Emulator From Functioning”), do not use pull-up resistors, capacitors or diodes.
FIGURE 2-10: SERIAL TRACE CONNECTIONS
DS51616B-page 20 © 2008 Microchip Technology Inc.
The DAT and CLK lines are intended for use with devices that do not have built-in debug logic that allows tracing to use the PGD/PGC/EMUC/EMUD pins. The DAT line connects to either the target device SPI port SDO1 or SDO2. The CLK line connects to SCK1 or SCK2.
When you dedicate these pins to tracing, then any multiplexed function on these pins can no longer be used by the application.
For more on this type of trace, see Section 7.3.3.3 “SPI Trace”.
Operation
Interface Connector
Application
PC Board
5
Device
PORTx
Probe Connector
6:0 7
10KΩ
ACTIVE
STATUS
RESETFUNCTION
Emulator Pod
7
2.5.3 I/O Port T race 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.
FIGURE 2-11: PARALLEL T RACE CONNECTIONS
For this trace configuration, seven (7) lines of data and one (1) line for clock are transmitted. PORTx must be a port with 8 pins that has all 8 pins available for trace. The port must not be multiplexed with the currently-used PGC and PGM pins.
A basic configuration is shown in Table 2-1: “I/O Port Trace Connection Example”.
TABLE 2-1: I/O PORT TRACE CONNECTION EXAMPLE
(2)
(1)
Content
Clock
PORTx pin Logic Probe pin
0 EXT0 Data 1 EXT1 Data 2 EXT2 Data 3 EXT3 Data 4 EXT4 Data 5 EXT5 Data 6 EXT6 Data 7 EXT7
Note 1: For pin descriptions, see Section 12.5.4 “Logic Probe/External Trigger Inter-
face”.
2: Use a 10KΩ pull-down resistor.
As in Section 2.4.4 “Circuits That Will Prevent the Emulator From Functioning”, do not use pull-up resistors, capacitors or diodes on port pins, except as specified.
For more on this type of trace, see Section 7.3.3.2 “I/O Port Trace”.
© 2008 Microchip Technology Inc. DS51616B-page 21
MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide
PIM
Interface Connector
Application
PC Board
5
Device
TRD3:0
Trace Connector
ACTIVE
STATUS
RESETFUNCTION
Emulator Pod
TRCLK
5
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.
To use this trace, you will need the following hardware:
• PIC32MX Plug-In Module (PIM) containing a device that supports trace and a
trace port
• PIC32MX Trace Interface Kit (AC244006) containing a 12-inch trace cable and a
trace adapter board
To use the PIC32 Instruction Trace feature, see Section 8.3 “PIC32 Instruction
Trace”.
FIGURE 2-12: PIC32 TRACE CONNECTION
DS51616B-page 22 © 2008 Microchip Technology Inc.

2.6 DEBUGGING WITH THE EMULATOR

+5V
Programming
4.7 k
Ω
4.7 k
Ω
VPP/MCLR
PGC
PGD
1
5
4
Internal Circuits
V
SS
V
DD
Voltage
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. Programming the code into the target and activating special debug functions
(see the next section for details).
2. Using the emulator to set breakpoints and run. If the target device cannot be programmed correctly, the MPLAB REAL ICE in-circuit
emulator will not be able to debug. Figure 2-13 shows the basic interconnections required for programming. Note that this
is the same as Figure 2-8, but for the sake of clarity, the V emulator are not shown.
FIGURE 2-13: PROPER CONNECTIONS FOR PROGRAMMING
Operation
DD and VSS lines from the
A simplified diagram of some of the internal interface circuitry of the MPLAB REAL ICE in-circuit emulator pod is shown. For programming, no clock is needed on the target device, but power must be supplied. When programming, the emulator puts programming levels on V
PP, sends clock pulses on PGC and serial data via PGD. To
verify that the part has been programmed correctly, clocks are sent to PGC and data is read back from PGD. This conforms to the ICSP protocol of the device under development.

2.7 REQUIREMENTS FOR DEBUGGING

To debug (set breakpoints, see registers, etc.) with the MPLAB REAL ICE in-circuit emulator system, there are critical elements that must be working correctly:
• The emulator must be connected to a PC. It must be powered by the PC via the
USB cable, and it must be communicating with MPLAB IDE software via the USB cable. See Chapter 3. “Installation” for details.
• The emulator must be connected as shown to the V
target device with the modular interface cable (or equivalent). V
© 2008 Microchip Technology Inc. DS51616B-page 23
also required to be connected between the emulator and target device.
• The target device must have power and a functional, running oscillator. If the
target device does not run, for whatever reason, the MPLAB REAL ICE in-circuit emulator cannot debug.
PP, PGC and PGD pi n s of th e
SS and VDD are
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.1 Sequence of Operations Leading to Debugging
Given that the Requirements For Debugging are met, these actions can be performed when the MPLAB REAL ICE in-circuit emulator is set as the current debugger (Debugger>Select Tool
• The application code is compiled/assembled with the “Build Configuration” list box on the MPLAB IDE toolbar set to “Debug”. Also, it may be set by selecting
Project>Build Configuration>Debug
• When Debugger>Program the device’s memory via the ICSP protocol as described above.
• A small “debug executive” program is loaded into the high area of program memory of the target device. Since the debug executive must reside in program memory, the application program must not use this reserved space. Some devices have special memory areas dedicated to the debug executive. Check your device data sheet for details.
• Special “in-circuit debug” registers in the target device are enabled by MPLAB IDE. These allow the debug executive to be activated by the emulator.
• The target device is held in Reset by keeping the V
):
.
is selected, the application code is programmed into
PP/MCLR line low.
DS51616B-page 24 © 2008 Microchip Technology Inc.
Loading...
+ 120 hidden pages