Datasheet

Operation
2013 Microchip Technology Inc. DS52085A-page 39
3.8 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 5. “Common Debug Functions” for details.
The emulator must be connected as shown to the V
PP, PGC and PGD pins of the
target device with the modular interface cable (or equivalent). V
SS and VDD are
also required to be connected between the emulator and target device.
The target device must have power and a functional, running oscillator, either
internal or external. If the target device will not run, for whatever reason, the
MPLAB REAL ICE in-circuit emulator cannot debug.
The target device must have its configuration words programmed correctly:
- The oscillator Configuration bits should correspond to RC, XT, etc., depending
upon the target design.
- For some devices, the Watchdog Timer is enabled by default and needs to be
disabled.
- The target device must not have code protection enabled.
- The target device must not have table read protection enabled.
- For some devices with more than one PGC/PGD pair, the correct pair needs
to be configured. This is only needed for debugging since programming will
work over any PGC/PGD pair.
3.8.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 tool (File>Project
Properties, Embedded category):
When Debug>Debug Project
is selected, the application code is programmed into
the device’s memory via the ICSP protocol as described earlier.
A small “debug executive” program is loaded into the high area of program mem-
ory of the target device. Since the debug executive must reside in program mem-
ory, 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. For more
on device reserved resources, see the online help file.
The target device is run in debug mode.