Microchip MPLAB PICkit 5 In-Circuit Debugger Instrukcja użytkownika

MPLAB® PICkit™ 5 In-Circuit Debugger User's Guide
Noce to Development Tools Customers
Important: 
All documentation becomes dated, and Development Tools manuals are no exception. Our tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may dier from those in this document. Please refer to our website (www.microchip.com/) to obtain the latest version of the PDF document.
Documents are identied with a DS number located on the bottom of each page. The DS format is DS<DocumentNumber><Version>, where <DocumentNumber> is an 8-digit number and <Version> is an uppercase letter.
For the most up-to-date information, nd help for your tool at onlinedocs.microchip.com/.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 1
Table of Contents
Notice to Development Tools Customers.......................................................................................................................... 1
1. Preface............................................................................................................................................................................ 4
1.1. Conventions Used in This Guide...................................................................................................................... 4
1.2. Recommended Reading.................................................................................................................................... 4
2. About the Debugger......................................................................................................................................................6
2.1. Debugger Advantages....................................................................................................................................... 6
2.2. Debugger Components..................................................................................................................................... 7
2.3. Debugger Block Diagram.................................................................................................................................. 8
2.4. Using MPLAB® PICkit™ 5 with MPLAB X IDE and MPLAB IPE..........................................................................8
3. Connections................................................................................................................................................................. 10
3.1. Power Connections..........................................................................................................................................10
3.2. PC and Smartphone Connections..................................................................................................................12
3.3. Target Connections..........................................................................................................................................13
4. Operation..................................................................................................................................................................... 27
4.1. Quick Debug/Program Reference..................................................................................................................27
4.2. Operational Overview......................................................................................................................................27
4.3. What is High Voltage? ..................................................................................................................................... 28
4.4. SAM and PIC32C Arm Devices - On-Chip Debugging...................................................................................29
4.5. AVR Devices - On-Chip Debugging (OCD)......................................................................................................29
4.6. PIC32M MCU - On-Chip Debugging............................................................................................................... 38
4.7. PIC MCU/dsPIC DSC - On-Chip Debugging....................................................................................................38
5. Programmer-To-Go..................................................................................................................................................... 46
5.1. Power Requirements for Programmer-To-Go.............................................................................................. 47
5.2. Limitations for Programmer-To-Go................................................................................................................47
5.3. Setting up PICkit 5 for Programmer-To-Go Mode........................................................................................48
5.4. Using Programmer-To-Go...............................................................................................................................52
5.5. Exiting Programmer-To-Go Mode.................................................................................................................. 53
5.6. Using the PTG Application on a BLE Device..................................................................................................53
6. Troubleshooting.......................................................................................................................................................... 58
6.1. Some Questions to Answer First....................................................................................................................58
6.2. Top Reasons Why You Can't Debug...............................................................................................................58
6.3. General..............................................................................................................................................................59
6.4. How to Invoke the Bootload Mode................................................................................................................59
6.5. How to Use the Hardware Tool Emergency Boot Firmware Recovery Utility........................................... 60
7. Frequently Asked Questions......................................................................................................................................62
7.1. How Does it Work?...........................................................................................................................................62
7.2. What's Wrong?..................................................................................................................................................62
8. Error Messages............................................................................................................................................................64
8.1. Types of Error Messages.................................................................................................................................64
8.2. General Corrective Actions............................................................................................................................. 71
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 2
9. Debugger Function Summary....................................................................................................................................73
9.1. Debugger Selection and Switching................................................................................................................ 73
9.2. Debugger Options Selection...........................................................................................................................73
10. Hardware Specication...............................................................................................................................................79
10.1. USB Connector Specications........................................................................................................................ 79
10.2. MPLAB PICkit 5 In-Circuit Debugger.............................................................................................................. 79
10.3. Communication Hardware............................................................................................................................. 81
10.4. Target Board Considerations..........................................................................................................................83
11. Revision History........................................................................................................................................................... 84
12. Support......................................................................................................................................................................... 85
12.1. Warranty Registration......................................................................................................................................85
12.2. myMicrochip Personalized Notication Service...........................................................................................85
13. Glossary........................................................................................................................................................................ 86
Microchip Information..................................................................................................................................................... 103
The Microchip Website............................................................................................................................................. 103
Product Change Notication Service...................................................................................................................... 103
Customer Support.................................................................................................................................................... 103
Product Identication System................................................................................................................................. 104
Microchip Devices Code Protection Feature..........................................................................................................104
Legal Notice............................................................................................................................................................... 104
Trademarks................................................................................................................................................................105
Quality Management System.................................................................................................................................. 106
Worldwide Sales and Service...................................................................................................................................107
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 3
1. Preface
This chapter contains general information that will be useful to know before using the MPLAB PICkit™ 5 In-Circuit Debugger.
1.1 Convenons Used in This Guide
The following conventions may appear in this documentation:
Table 1-1. Documentaon Convenons
Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB® PICkit™ 5 In-Circuit Debugger User’s Guide
Emphasized text ...is the only compiler...
Initial caps A window the Output window
A dialog the Settings dialog
A menu selection Select File and then Save.
Quotes A eld name in a window or dialog “Save project before build”
Underlined, italic text with right angle bracket
Bold characters A dialog button Click OK
N‘Rnnnn A number in verilog format, where N is
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Plain Courier New Sample source code
Italic Courier New A variable argument file.o, where file can be any valid lename
Square brackets [ ] Optional arguments
Curly brackets and pipe character: { | }
Ellipses... Replaces repeated text
A menu path File>Save
A tab Click the Power tab
the total number of digits, R is the radix and n is a digit.
Filenames
File paths
Keywords static, auto, extern
Command-line options
Bit values
Constants
Choice of mutually exclusive arguments; an OR selection
Represents code supplied by user
Preface
®
4‘b0010, 2‘hF1
#define START
autoexec.bat
C:\Users\User1\Projects
-Opa+, -Opa-
0, 1
0xFF, ‘A’
xc8 [options] files
errorlevel {0|1}
var_name [, var_name...]
void main (void) { ...
}
1.2 Recommended Reading
This user's guide describes how to use MPLAB PICkit 5 In-Circuit Debugger. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
Multi-Tool Design Advisory (DS51764)
Please read this rst! This document contains important information about operational issues that
should be considered when using the MPLAB PICkit 5 In-Circuit Debugger with your target design.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 4
Preface
MPLAB X IDE Online Help
This is an essential document to be used with any Microchip hardware tool.
This is an extensive help le for the MPLAB X IDE. It includes an overview of embedded systems, installation requirements, tutorials, details on creating new projects, setting build properties, debugging code, setting conguration bits, setting breakpoints, programming a device, etc. This help le is generally more up-to-date than the printable PDF of the user’s guide (DS-50002027) available as a free download at the MPLAB X IDE webpage.
Release Notes for MPLAB PICkit 5
For the latest information on using MPLAB PICkit 5 In-Circuit Debugger, nd the release notes in MPLAB X IDE under Help>Release Notes. The release notes contain update information and known issues that may not be included in this user’s guide.
MPLAB PICkit 5 In-Circuit Debugger Quick Start Guide (DS-50003478)
This reference material shows you how to connect hardware and install software for the MPLAB PICkit 5 In-Circuit Debugger.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 5
2. About the Debugger
The MPLAB PICkit 5 In-Circuit Debugger (PG164150) allows fast and easy debugging and programming of Microchip devices using the powerful graphical user interface of MPLAB X IDE Integrated Development Environment or MPLAB IPE (Integrated Programming Environment). Supported devices include:
• PIC® and AVR® microcontrollers (MCUs)
• dsPIC® digital signal controllers (DSCs)
• SAM (Arm® Cortex®-based) MCUs and microprocessors (MPUs)
• CEC (Arm® Cortex®-based) MCUs,
See the Device Support List for specic PICkit 5 device support.
The MPLAB PICkit 5 is connected to the design engineer's computer using a USB Type-C® interface and can be connected to the target via a Microchip debug 8-pin Single In-Line (SIL) connector. The connector uses two device I/O pins and the reset line to implement in-circuit debugging and In-Circuit Serial Programming™ (ICSP™). An additional microSDHC card slot and the ability to be self-powered from the target means you can take your code with you and program on the go.
Along with a wider target voltage, the MPLAB PICkit 5 supports advanced interfaces such as 4-wire JTAG, Serial Wire Debug (SWD), and streaming Data Gateway, while being backward compatible for demo boards and target systems using 2-wire JTAG and ICSP. The MPLAB PICkit 5 also has a Programmer-To-Go function with the addition of a microSDHC card slot to hold project code and the ability to be powered by the target board. Additionally, an MPLAB PTG app may be used to select and manage code on the microSDHC card and program code into the target.
About the Debugger
The debugger system executes code like an actual device because it uses a device with built-in emulation circuitry, instead of a special debugger chip. All available features of a given device are accessible interactively and can be set and modied by theMPLAB X IDE interface.
The MPLAB PICkit 5 In-Circuit Debugger is compatible with any of these platforms:
• Microsoft Windows® OS
• Linux® OS
• macOS
®
See the release notes for versions supported.
The MPLAB PICkit 5 In-Circuit Debugger was developed for debugging embedded processors with rich debug facilities which are dierent from conventional system processors in the following aspects:
• Processors run at maximum speeds.
• Capability to incorporate I/O port data input.
• Advanced host communication interfaces (Windows, macOS and Linux).
• Advanced communication mediums and protocols.
In addition to debugger functions, the MPLAB PICkit 5 In-Circuit Debugger system also may be used as a device production programmer.
2.1 Debugger Advantages
The MPLAB PICkit 5 In-Circuit Debugger system provides the following advantages:
Features/Capabilies:
• Connects to computer via a USB Type-C cable.
• Powered through USB cable or target and can optionally power target (up to 150 mA).
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 6
About the Debugger
• An 8-pin SIL programming connector and the option to use various interfaces.
• Programs devices using MPLAB X IDE or MPLAB IPE.
• Supports Programmer-To-Go (PTG) to eld program devices.
• Supports the MPLAB® PTG iOS/Android app used to select and manage PTG program images via Bluetooth.
• Supports Virtual Comm Port (VCOM).
• Supports multiple hardware and software breakpoints, stopwatch, and source code le debugging.
• Debugs your application on your own hardware in real time.
• Debugs at full device operational speeds.
• Sets breakpoints based on internal events.
• Monitors internal le registers.
Congures pin drivers.
• Supports new devices and features through new/updated packs in MPLAB X IDE or MPLAB IPE.
• Indicates debugger status via the indicator light strip.
• Operates within a temperature range of 0-70 degrees Celsius.
Performance/Speed:
• A Real-Time Operating System (RTOS).
• No rmware download delays incurred when switching devices.
• A 32-bit MCU running at 300 MHz.
Safety:
• Receive feedback from debugger when external power supply is needed for target.
• Supports target supply voltages for low voltage program mode entry from 1.2 to 5.0V and for high voltage program mode entry from 1.8 to 5.0V.
• Protection circuitries are added to the probe drivers to guard from power surges from the target.
• VDD and VPP voltage monitors protect against overvoltage conditions/all lines have over-current protection.
• Programming/debugging pins with a programmable range of resistor values, plus direction (pull­up, pull-down, or nonexistent).
• Controlled programming speed provides exibility to overcome target board design issues.
• CE and RoHS compliant – conforms to industry standards.
2.2 Debugger Components
The components of the MPLAB PICkit 5 In-Circuit Debugger system are:
• A rectangular-shaped MPLAB PICkit 5 unit housed in a durable, black plastic case with a brushed metal top which is accented with an indicator light strip. Other unit features are:
– A USB Type-C connector.
– An 8-pin single inline (SIL) connector.
– A MicroSD card slot.
– An Emergency recovery button.
– A Lanyard connector.
• A USB Type-C cable to provide communications between the debugger and a computer, as well as providing power to the debugger.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 7
• Bluetooth 5.0 Certied Module for communication between the MPLAB PTG application and MPLAB PICkit 5.
Additional hardware and accessories may be ordered separately from Microchip Purchasing Portal (www.microchipdirect.com), such as:
• Debugger Adapter Board (Part Number AC002015) - a connectivity board that supports JTAG, SWD and ICSP protocols, useful for debugging legacy AVR® microcontrollers with MPLAB PICkit 5.
2.3 Debugger Block Diagram
About the Debugger
2.4 Using MPLAB® PICkit™ 5 with MPLAB X IDE and MPLAB IPE
Download and install the latest version of MPLAB X IDE from the MPLAB X IDE webpage. The MPLAB X IDE installer will install MPLAB X IDE and/or MPLAB IPE.
Using MPLAB® PICkit™ 5 with MPLAB X IDE
The MPLAB® PICkit™ 5 In-Circuit Debugger works with MPLAB X IDE to develop target applications. The user’s guide and other documentation may be found on the MPLAB X IDE webpage.
Table 2-1. MPLAB X IDE Overview
Use the desktop icon to launch the IDE.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 8
About the Debugger
Create a new project or open an existing project. Select MPLAB PICkit 5 as the hardware tool.
Open the Project Properties window by right clicking on the project name and selecting “Properties.” This window is used to set up options for debugging, programming and other features. See MPLAB PICkit 5 option descriptions.
Using MPLAB® PICkit™ 5 with MPLAB IPE
The MPLAB® PICkit™ 5 In-Circuit Debugger works with MPLAB IPE as a production programmer. The user’s guide and other documentation may be found on the MPLAB IPE webpage.
Table 2-2. MPLAB IPE Overview
Use the desktop icon to launch the IPE.
Select a device to program and then select MPLAB PICkit 5 as the tool.
Select on a button to Program, Erase, Read, Verify or Blank Check. For more on MPLAB IPE, including Advanced mode, see the MPLAB IPE User’s Guide.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 9
3. Connecons
The MPLAB® PICkit™ 5 In-Circuit Debugger hardware setup begins by connecting power, communications, and targets to the debugger. See the following sections for details.
3.1 Power Connecons
The MPLAB PICkit 5 In-Circuit Debugger is powered through its USB Type-C® connector. See also
10.1. USB Connector Specications.
Alternately, MPLAB PICkit 5 can be powered through the target for PTG. See 5.1. Power
Requirements for Programmer-To-Go.
Figure 3-1. Connector on Top of Unit
Connecons
Figure 3-2. USB Power and Communicaon
The target board is powered from its own supply. Alternatively, the debugger can power the target board if (1) the debugger is connected through an externally powered hub and (2) the target consumes no more than 150 mA. In the Project Properties window, check “Power target from PICkit 5” (see gure below). When selecting the Voltage Level, do not exceed the device VDD rating. See
3.1.2. Target is Powered by the Debugger.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 10
Figure 3-3. Select Power Target
Connecons
3.1.1 Target is Powered by External Supply
If the target is powered by an external supply (see gure below), the debugger will sense target V to allow level translation for the target low voltage operation. If the debugger does not sense voltage on its VDD line (pin 2 of the interface connector), it will not operate.
Figure 3-4. Target Powered from External Source
Note: A target powered by an external supply may power the debugger during Programmer-To-Go operation.
Related Links
3.3. Target Connections
DD
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 11
3.1.2 Target is Powered by the Debugger
If the target is powered through the debugger, an externally powered hub must be used as shown below. The maximum current available to the target is limited to 150 mA.
Figure 3-5. Target Powered Through Self-Powered Hub
When providing power to the target device, ensure that the target is not exposed to voltages higher than the device VDD rating. Absolute maximum ratings for the device VDD must not be exceeded. Exposure to the maximum rating conditions for any length of time may aect device reliability. Functional operation of the device at conditions above the parameters indicated in the device data sheets specication is not recommended. See the device data sheet for required device voltage levels and maximum ratings.
Connecons
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 debugger to operate. They cannot be left
oating.
Also, devices with a V
line (PIC18FXXJ for example) should be connected to the appropriate
CAP
capacitor or level.
Related Links
3.3. Target Connections
3.2 PC and Smartphone Connecons
MPLAB® PICkit™ 5 In-Circuit Debugger can connect with the PC (and MPLAB X IDE or MPLAB IPE) using a USB Type-C cable (see gure). It is recommended that you use the cable that comes with the kit to avoid communication issues.
MPLAB PICkit 5 can also be connected to a BLE Android/iOS smartphone or tablet with an application to support PTG.
Figure 3-6. USB Power and Communicaon
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 12
Connection Type Connection Details Programming
USB Type-C HS USB 2.0 Yes Yes Yes
Bluetooth
1. For speed information, see 10.2.1. Board Specications.
2. Smartphone/tablet connection.
®
Related Links
5.6. Using the PTG Application on a BLE Device
3.3 Target Connecons
MPLAB® PICkit™ 5 In-Circuit Debugger connects to a target via an 8-pin single inline (SIL) connector. Make sure to align the Pin 1 on the debugger ( ) to Pin 1 on the target (see gures below.) For
other target connections, an optional adapter board is available for sale. Connector and adapter board pin-outs are shown in the following sections.
Figure 3-7. Connector on Boom of Unit
Wireless Yes
Connecons
1
2
Debugging
No No
1
MPLAB Data Visualizer Support
Figure 3-8. 8-pin Single Inline Connector
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 13
Figure 3-9. Connecon to Target
3.3.1 Target Connecon Pinout
The programming connector pin functions are dierent for various devices and interfaces. Refer to the following pinout tables for debug and data stream interfaces. Note: Refer to the data sheet for the device you are using as well as the application notes for the specic interface for additional information and diagrams.
Connecons
Table 3-1. Pinouts for Debug Interfaces
MPLAB PICkit 5
Connector
8-Pin SIL
Pin # Pin
1
2
3 GND GND GND GND GND GND GND GND GND GND 3 3
4 PGD DAT TDO SWO
5 PGC CLK TCK SWCLK TCK SCK CLK 5 5
6
7 TTDI TDI TDI MOSI 7
8 TTMS TMS SWDIO2TMS 8
1. Use of a 6-pin header will result in the loss of functions on Pins 7 and 8 aecting EJTAG, JTAG, SWD and ISP.
2. SWO is used for trace. SWDIO is used for debug.
3. dW = debugWIRE
4. Pin may be used for High-Voltage Pulse reactivation of UPDI function depending on device. See device data sheet for
5. These are example target connectors that are assumed similar to the debugger unit (SIL).
1
Name
TVPP MCLR/VPPMCLR RESET RESET
TVDD VDD VDD/
TAUX RESET RESET/d
details.
ICSP (MCHP)
MIPS EJTAG
VDDIO
Cortex SWD
VDD VTG VTG VTG VTG VTG VTG 2 2
2
DEBUG INTERFACE Target
®
®
AVR JTAG
TDO DAT
AVR dW3AVR
UPDI
W
AVR PDI
4
4
DAT MISO DAT 4 4
CLK RESET RESET 6 6
AVR ISP AVR TPI 8-Pin
5
Connector
SIL
Pin # Pin #
1 1
6-Pin SIL
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 14
Table 3-2. Pinouts for Data Stream Interfaces
MPLAB® PICkit™ 5 Connector DATA STREAM Target3 Connector
8-Pin SIL
1. Use of an 8-pin connector is required for data streaming. A 6-pin connector will result in the loss of functions on Pins 7 and 8.
2. RX and TX pins need to move to accommodate wiring for other devices.
3. This is an example target connector that is assumed similar to the debugger unit (SIL).
1
Pin # DGI UART / CDC DGI UART / CDC Pin #
1 1
2 VTG VTG 2
3 GND GND 3
4 TX (target) 4
5 5
6 6
7 TX (target) RX (target) 7
8 RX (target) 8
3.3.2 Debugger Adapter Board
For legacy connections, the Debugger Adapter Board (AC102015) is available.
PIC and AVR Devices SAM Devices
Connecons
2
8-Pin SIL
The MPLAB PICkit 5 can be connected to the Debugger Adapter Board as shown in the sections below. Then the various connections on the adapter board can be used to connect to specic targets (see the following topic).
Using the 8-pin Inline Connector
Using the Single In-Line (SIL) connector, the tool is connected directly to the adapter board (ensure pin 1 on the tool lines up with pin 1 on the adapter board). If a 6-pin SIL header is used, connections 7 (TMS) and 8 (TDI) will not be available.
Figure 3-10. SIL Connecon at Adapter Board
Using the 8-pin Modular Connector
For the MPLAB PICkit 5 it is recommended that you use the 8-pin inline connector described above.
Using the AC164110 - RJ-11 to ICSP Adapter, the debugger can be connected to the modular connector using a 6-pin modular cable resulting in the loss of connection to pins 8 (TMS) and 1 (TDI) at the adapter board.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 15
Figure 3-11. RJ-45 at the Debugger Adapter Board
3.3.2.1 Adapter Board Pinout
This is a connectivity board that supports JTAG, SWD, ICSP and AVR protocols.
Connecons
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 16
Figure 3-12. MPLAB® PICkit™ 5 Adapter Board (AC102015) Pinouts
Connecons
3.3.3 SAM/PIC32C MCUs - JTAG/SWD Connecons
All SAM/PIC32C Arm®-based devices feature the Serial Wire Debug (SWD) interface for programming and debugging. In addition, some devices feature a JTAG interface with identical functionality. Check the device data sheet for supported interfaces of that device.
3.3.3.1 JTAG Physical Interface
The JTAG interface consists of a four-wire Test Access Port (TAP) controller that is compliant with the IEEE® 1149.1 standard. The IEEE standard was developed to provide an industry-standard way to eciently test circuit board connectivity (Boundary Scan). Microchip AVR and SAM devices have extended this functionality to include full Programming and On-chip Debugging support.
To use this target interface with MPLAB X IDE, open the Project Properties window, “PICkit 5” category, “Communications” option category, and select either “2-wire JTAG” or “4-wire JTAG.”
© 2023 Microchip Technology Inc. and its subsidiaries
User Guide
DS-50003525A - 17
Figure 3-13. JTAG Interface Basics
Connecons
Vcc
Programmer/ debugger
TCK TMS TDI TDO
3.3.3.1.1 Connecng to a SAM/PIC32C JTAG Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection as well as a legacy 20-pin 100-mil JTAG connection using the adapter board.
Related Links
3.3.2.1. Adapter Board Pinout
3.3.3.1.2 SAM/PIC32C JTAG Pinout (Cortex®-M debug connector)
SAM/PIC32C JTAG pin names and descriptions are shown in the table below. Pin numbers are shown for MPLAB PICkit 5 direct connection and Debugger Adapter Board 10-pin and 20-pin connections.
Table 3-3. SAM/PIC32C JTAG Pins and Descripons
MPLAB
PICkit 5 Pin
8 2 7 TMS Test Mode Select (control signal from the MPLAB
6 7 2,3,9,11,17,19 NC/AUX Recommended as not connected.
5 4 9 TCK Test Clock (clock signal from the MPLAB PICkit 5 into
4 8 5 TDO Test Data Out (data transmitted from the target
3 3, 5, 9 4,6,8,10,12,14,16,18,20 GND Ground. All must be connected to ensure that the
2 1 1 VDD\VTG* VDD: MPLAB PICkit 5 providing power to target
1 10 15 MCLR Reset (optional). Used to reset the target device.
7 6 13 TDI Test Data In (data transmitted from the MPLAB PICkit
* Remember to include a decoupling capacitor between this pin and GND. See AN4451: SAMA5D2 Hardware Design
Considerations.
Adapter
Board (10-Pin)
Pin
Adapter Board (20-Pin) Pin Name Description
Target device
PICkit 5 into the target device).
the target device).
device into the MPLAB PICkit 5).
MPLAB PICkit 5 and the target device share the same ground reference.
(optional) or target providing power to MPLAB PICkit 5 (PTG) VTG: Voltage target reference. The MPLAB PICkit 5 samples the target voltage on this pin in order to power the level converters correctly. The MPLAB PICkit 5 draws less than 3mA from this pin in this mode.
Connecting this pin is recommended since it allows the MPLAB PICkit 5 to hold the target device in a reset state, which can be essential to debugging in certain scenarios.
5 into the target device).
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 18
3.3.3.2 SAM/PIC32C SWD Interface
The Arm® SWD interface is a subset of the JTAG interface, making use of TCK and TMS pins.
3.3.3.2.1 Connecng to a SAM/PIC32C SWD Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil SWD connection as well as a legacy 20-pin 100-mil SWD connection using the adapter board.
Related Links
3.3.2.1. Adapter Board Pinout
3.3.3.2.2 SAM/PIC32C SWD Pinout
SAM/PIC32C SWD pin names and descriptions are shown in the table below. Pin numbers are shown for MPLAB PICkit 5 direct connection and Debugger Adapter Board 10-pin and 20-pin connections.
Table 3-4. SAM/PIC32C SWD Pins and Descripons
MPLAB PICkit 5 Pin
8 2 7 SWDIO Serial Wire Debug Data Input/Output.
5 4 9 SWDCLK Serial Wire Debug Clock.
4 8 5 SWO Serial Wire Output (used with ITM - not
3 3, 5, 9 4,6,8,10,12,14,16,18,20 GND Ground
2 1 1 VDD\VTG* VDD: MPLAB PICkit 5 providing power to target
1 10 15 MCLR Reset (optional). Used to reset the target device.
* Remember to include a decoupling capacitor between this pin and GND. See AN4451: SAMA5D2 Hardware Design
Considerations.
Adapter Board (10-Pin) Pin
Adapter Board (20-Pin) Pin Name Description
Connecons
implemented on all devices).
(optional) or target providing power to MPLAB PICkit 5 (PTG) VTG: Target voltage reference. The MPLAB PICkit 5 samples the target voltage on this pin in order to power the level converters correctly. The MPLAB PICkit 5 draws less than 1mA from this pin in this mode.
Connecting this pin is recommended since it allows the MPLAB PICkit 5 to hold the target device in a reset state, which can be essential to debugging in certain scenarios.
3.3.4 AVR MCUs - Various Connecons
AVR devices feature various programming and debugging interfaces. Check the device data sheet for supported interfaces of that device.
3.3.4.1 AVR MCUs - JTAG Connecons
Some AVR devices feature a JTAG interface for programming and debugging. Check the device data sheet for supported interfaces of that device.
3.3.4.1.1 JTAG Physical Interface
The JTAG interface consists of a four-wire Test Access Port (TAP) controller that is compliant with the IEEE® 1149.1 standard. The IEEE standard was developed to provide an industry-standard way to eciently test circuit board connectivity (Boundary Scan). Microchip AVR and SAM devices have extended this functionality to include full Programming and On-chip Debugging support.
To use this target interface with MPLAB X IDE, open the Project Properties window, “PICkit 5” category, “Communications” option category, and select either “2-wire JTAG” or “4-wire JTAG.”
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 19
Figure 3-14. JTAG Interface Basics
Connecons
Vcc
Programmer/ debugger
TCK TMS TDI
Target device
TDO
Connecng to an AVR JTAG Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection using the adapter board.
Related Links
3.3.2.1. Adapter Board Pinout
AVR JTAG Pinout
AVR JTAG pin names and descriptions are shown in the table below. Pin numbers are shown for MPLAB PICkit 5 direct connection and Debugger Adapter Board 10-pin connection.
Table 3-5. AVR JTAG Pins and Descripons
MPLAB PICkit 5 Pin
1 7, 8 NC/AUX Not Connected.
2 4 VDD\VTG* VDD: MPLAB PICkit 5 providing power to target (optional) or target
3 2, 10 GND Ground. All must be connected to ensure that the MPLAB PICkit 5 and the
4 3 TDO Test Data Out (data transmitted from the target device into the MPLAB
5 1 TCK Test Clock (clock signal from the MPLAB PICkit 5 into the target device).
6 6 MCLR Reset (optional). Used to reset the target device. Connecting this pin is
7 9 TDI Test Data In (data transmitted from the MPLAB PICkit 5 into the target
8 5 TMS Test Mode Select (control signal from the MPLAB PICkit 5 into the target
* Remember to include a decoupling capacitor between this pin and GND. See AVR042: AVR Hardware Design
Considerations.
Adapter Board AVR JTAG Pin
Name Description
providing power to MPLAB PICkit 5 (PTG) VTG: Target voltage reference. The MPLAB PICkit 5 samples the target voltage on this pin in order to power the level converters correctly. The MPLAB PICkit 5 draws less than 3mA from this pin in this mode.
target device share the same ground reference.
PICkit 5).
recommended since it allows the MPLAB PICkit 5 to hold the target device in a reset state, which can be essential to debugging in certain scenarios.
device).
device).
3.3.4.2 AVR SPI Interface
In-system programming uses the target AVR’s internal SPI (Serial Peripheral Interface) to download code into the Flash and EEPROM memories. It is not a debugging interface.
3.3.4.2.1 Connecng to an AVR SPI Target
The MPLAB PICkit 5 provides a direct connection for new designs (DGI SPI) or a legacy 10-pin 50-mil JTAG connection for the 6-pin SPI interface using the adapter board.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 20
Related Links
3.3.2.1. Adapter Board Pinout
3.3.4.2.2 AVR SPI Pinout
For a legacy application PCB which includes an AVR with the SPI interface, the pinout as shown in the gure below may have been used.
Connecons
Important: 
The SPI interface is eectively disabled when the debugWIRE Enable (DWEN) fuse is programmed, even if the SPIEN fuse is also programmed. To re-enable the SPI interface, the ‘disable debugWIRE’ command must be issued while in a debugWIRE debugging session. Disabling debugWIRE in this manner requires that the SPIEN fuse is already programmed. If MPLAB X IDE fails to disable debugWIRE, it is probably because the SPIEN fuse is NOT programmed. If this is the case, it is necessary to use a High-Voltage Programming interface to program the SPIEN fuse.
Info: 
The SPI interface is often referred to as “ISP” since it was the rst in-system programming interface on Microchip AVR products. Other interfaces are now available for in-system programming.
Figure 3-15. Legacy SPI Header Pinout
Table 3-6. SPI Pin Mapping
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy SPI Pin Name Description
1 7 or 8 (NC)
2 4 (VDD/VTG) 2 VCC/VTG Target voltage (reference voltage)
3 2 or 10 (GND) 6 GND Ground
4 3 (TDO) 1 MISO Host In Client Out (Main In Secondary Out)
5 1 (TCK) 3 SCK SPI clock
6 6 (MCLR) 5 RESET
7 9 (TDI) 4 MOSI Host Out Client In (Main Out Secondary In)
8 5 (TMS)
3.3.4.3 AVR UPDI Interface
The Unied Program and Debug Interface (UPDI) is a Microchip proprietary interface for external programming and on-chip debugging of a device. It is a successor to the PDI two-wire physical interface, which is found on all AVR XMEGA devices. UPDI is a one-wire interface providing a bidirectional half-duplex asynchronous communication with the target device for purposes of programming and debugging.
PDO/MISO
SCK
/RESET
1 2
VCC PDI/MOSI GND
SPI
Currently there are three congurations for UPDI:
1. The UPDI function is on a shared pin that can also be used for RESET or GPIO. If RESET or GPIO has been selected and UPDI is now desired, an HV pulse is required on that pin to reactivate the UPDI functionality.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 21
This conguration is found on older AVR devices (ATtiny) and requires an HV pulse of 12V.
2. The UPDI function is on a dedicated pin so UPDI is always available. RESET and GPIO share a pin. This conguration is found on newer AVR devices (ATmega0, AVR DA/DB etc.) and does not
require an HV pulse.
3. The UPDI function is on a shared pin that can also be used for GPIO. RESET is on a dedicated pin. If GPIO has been selected and UPDI is now desired, an HV pulse is required on the RESET pin to reactivate the UPDI functionality.
This conguration is found on newer AVR devices (AVR DD) and requires an HV pulse of approximately VDD + 2 volts. See the device data sheet for the actual value range.
Consult your device data sheet for the conguration your device uses.
3.3.4.3.1 Connecng to an AVR UPDI Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection for the 6-pin UPDI interface using the adapter board.
Related Links
3.3.2.1. Adapter Board Pinout
3.3.4.3.2 AVR UPDI Pinouts
For a legacy application PCB which includes an AVR with UPDI interfaces, the pinouts as shown in the gures below may have been used for all congurations.
Connecons
Figure 3-16. Legacy UPDI Header Pinout
Table 3-7. Legacy UPDI Pin Mapping
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy UPDI Pin Name Description
1 7 or 8 (NC)
2 4 (VDD/VTG) 2 VCC/VTG Target voltage (reference voltage).
3 2 or 10 (GND) 6 GND Ground
4 3 (TDO) 1 UPDI_DATA* UPDI data. Other pin functions are
possible depending on the device.
5 1 (TCK)
6 6 (MCLR)
7 9 (TDI)
8 5 (TMS)
* A High-Voltage (HV) pulse on this pin may be necessary to use the UPDI function. See your device data sheet for UPDI
conguration.
3.3.4.4 AVR PDI Interface
The Program and Debug Interface (PDI) is a Microchip proprietary interface for external programming and on-chip debugging of a device. PDI Physical is a 2-pin interface providing a bidirectional half-duplex synchronous communication with the target device.
3.3.4.4.1 Connecng to an AVR PDI Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection for the 6-pin PDI interface using the adapter board.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 22
Related Links
3.3.2.1. Adapter Board Pinout
3.3.4.4.2 AVR PDI Pinout
For a legacy application PCB which includes an AVR with the PDI interface, the pinout as shown in the gure below may have been used.
Figure 3-17. Legacy PDI Header Pinout
Connecons
Table 3-8. PDI Pin Mapping
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy PDI Pin Name Description
1 7 or 8 (NC)
2 4 (VDD/VTG) 2 VCC/VTG Target voltage (reference voltage).
3 2 or 10 (GND) 6 GND Ground
4 3 (TDO) 1 PDI_DATA PDI Data
5 1 (TCK)
6 6 (MCLR) 5 PDI_CLK PDI Clock
7 9 (TDI)
8 5 (TMS)
3.3.4.5 AVR TPI Interface
TPI is a programming-only interface for some tinyAVR® devices. It is not a debugging interface and these devices do not have OCD capability.
3.3.4.5.1 Connecng to an AVR TPI Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection for the 6-pin TPI interface using the adapter board.
PDI_DATA
(NC)
PDI_CLK
1 2
VCC (NC) GND
PDI
Related Links
3.3.2.1. Adapter Board Pinout
3.3.4.5.2 AVR TPI Pinout
For a legacy application PCB which includes an AVR with the TPI interface, the pinout as shown in the gure below may have been used.
Figure 3-18. Legacy TPI Header Pinout
Table 3-9. TPI Pin Mapping
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy TPI Pin Name Description
1 7 or 8 (NC)
2 4 (VDD/VTG) 2 VCC/VTG Target voltage (reference voltage).
3 2 or 10 (GND) 6 GND Ground
4 3 (TDO) 1 DATA TPI Data
TPIDATA
TPICLK
/RESET
1 2
VCC (NC) GND
TPI
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 23
...........continued
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy TPI Pin Name Description
5 1 (TCK) 3 CLOCK TPI Clock
6 6 (MCLR) 5 RESET Reset the device.
7 9 (TDI)
8 5 (TMS)
3.3.4.6 AVR debugWIRE Interface
The debugWIRE interface is for use on low pin-count devices. Unlike the JTAG interface which uses four pins, debugWIRE makes use of just a single pin (RESET) for bidirectional half-duplex asynchronous communication with the debugger tool.
Note: 
The debugWIRE interface can not be used as a programming interface. This means that the SPI interface must also be available (as shown in 3.3.4.2. AVR SPI Interface) in order to program the target.
When launching a debug session using debugWIRE, ash will be programmed using the debugWIRE interface. This is not an option which can be considered for factory programming.
When the debugWIRE enable (DWEN) fuse is programmed and lock-bits are un-programmed, the debugWIRE system within the target device is activated. The RESET pin is congured as a wire-AND (open-drain) bidirectional I/O pin with pull-up enabled and becomes the communication gateway between target and debugger.
Connecons
3.3.4.6.1 Connecng to an AVR debugWIRE Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 10-pin 50-mil JTAG connection for the 6-pin debugWIRE/SPI interface using the adapter board.
Although the debugWIRE interface only requires one signal line (RESET), VCC, and GND to operate correctly, it is advised to have access to the full SPI connector so that the debugWIRE interface can be enabled and disabled using SPI programming.
When the DWEN fuse is enabled, the SPI interface is overridden internally for the OCD module to have control of the RESET pin. The debugWIRE OCD is capable of disabling itself temporarily, thus releasing control of the RESET line. The SPI interface is then available again (only if the SPIEN fuse is programmed), allowing the DWEN fuse to be un-programmed using the SPI interface. If power is toggled before the DWEN fuse is un-programmed, the debugWIRE module will again take control of the RESET pin. Normally MPLAB X IDE or Microchip Studio will automatically handle the interface switching, but it can also be done manually using the button on the debugging tab in the properties dialog in Microchip Studio.
Note: It is highly recommended to let MPLAB X IDE or Microchip Studio handle the setting and clearing of the DWEN fuse.
It is not possible to use the debugWIRE interface if the lockbits on the target AVR device are programmed. Always be sure that the lockbits are cleared before programming the DWEN fuse and never set the lockbits while the DWEN fuse is programmed. If both the debugWIRE Enable (DWEN) fuse and lockbits are set, one can use High Voltage Programming to do a chip erase, and thus clear the lockbits. When the lockbits are cleared, the debugWIRE interface will be re-enabled. The SPI Interface is only capable of reading fuses, reading signature, and performing a chip erase when the DWEN fuse is un-programmed.
Related Links
3.3.2.1. Adapter Board Pinout
3.3.4.6.2 AVR debugWIRE Pinout
For a legacy application PCB which includes an AVR with the debugWire interface, the pinout as shown in the gure below may have been used.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 24
Figure 3-19. Legacy debugWIRE (SPI) Header Pinout
Connecons
Table 3-10. debugWIRE Pin Mapping
MPLAB PICkit 5 Pin Adapter Board AVR JTAG Pin Legacy debugWIRE
1 7 or 8 (NC)
2 4 (VDD/VTG) 2 VCC/TTG Target voltage (reference
3 2 or 10 (GND) 6 GND Ground
4 3 (TDO)
5 1 (TCK)
6 6 (MCLR) 5 RESET or debugWIRE Use pin to Reset the device or
7 9 (TDI)
8 5 (TMS)
3.3.5 PIC32M Connecons
PIC32M MIPS-based devices use EJTAG for debug and programming.
3.3.5.1 Connecng to a PIC32M EJTAG Target
The MPLAB PICkit 5 provides a direct connection for new designs or a legacy 14-pin 10-mil JTAG/ EJTAG connection using the adapter board.
PDO/MISO
SCK
/RESET
Pin
1 2
VCC PDI/MOSI GND
SPI
Name Description
voltage).
transmit debugWIRE data.
3.3.5.2 PIC32M EJTAG Pinout
PIC32M EJTAG pin names and descriptions are shown in the table below. Pin numbers are shown for MPLAB PICkit 5 direct connection and Debugger Adapter Board 14-pin connection.
Table 3-11. PIC32M JTAG Connector 14-Pin Descripon
MPLAB PICkit 5 Pin
1 11 MCLR Reset (optional). Used to reset the target device. Connecting this pin is
2 14 VDD MPLAB PICkit 5 providing power to target (optional) or target providing power to
3 2, 4, 6, 8, 10 GND Ground. All must be connected to ensure that the MPLAB PICkit 5 and the target
4 3 TDO Test Data Out (data transmitted from the target device into the MPLAB PICkit 5).
5 9 TCK Test Clock (clock signal from the MPLAB PICkit 5 into the target device).
6 1 NC Not connected.
7 5 TDI Test Data In (data transmitted from the MPLAB PICkit 5 into the target device).
8 7 TMS Test Mode Select (control signal from the MPLAB PICkit 5 into the target device).
Adapter Board (14-Pin) Pin
3.3.6 PIC MCUs - ICSP Connecon
The MPLAB® PICkit™ 5 In-Circuit Debugger supports debug and programming of PIC microcontrollers (MCUs) and dsPIC digital signal controllers (DSCs) through ICSP™ (In-Circuit Serial Programming™) connections.
Name Description
recommended since it allows the MPLAB PICkit 5 to hold the target device in a reset state, which can be essential to debugging in certain scenarios.
MPLAB PICkit 5 (PTG).
device share the same ground reference.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 25
3.3.6.1 ICSP Target Connecon
Connect a debugger directly to a PIC® MCU target using the ICSP® modular connector or inline connector on most MPLAB® debug tools. The connections to the 3.3.2. Debugger Adapter Board are the same as connections to target boards.
If the debugger and target have dierent connections (modular-to-inline or inline-to-modular respectively) a small adapter can be purchased to enable proper connections: “RJ11 to ICSP Adapter”
(AC164110).
Figure 3-20. 6-Pin RJ11 to ICSP Adapter
Alternatively, the MPLAB PICkit 5 using the adapter board provides an 8-pin 50-mil Microchip Universal connection for the 6-pin and 8-pin ICSP interfaces.
3.3.6.2 ICSP Target Connecon Circuitry
The gure below shows the interconnections of the MPLAB PICkit 5 In-Circuit Debugger to the ICSP connector on the target board. The diagram also shows the wiring from the connector to a device on the target PCB. A pull-up resistor (usually around 10-50 kΩ) is recommended to be connected from the VPP/MCLR line to VDD so that the line may be strobed low to reset the device.
Connecons
Figure 3-21. Standard Connecon to Target Circuitry
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 26
4. Operaon
A simplied theory of operation of the MPLAB PICkit 5 In-Circuit Debugger system is provided here. It is intended to provide enough information so that a target board can be designed that is compatible with the debugger for both debugging and programming operations. The basic theory of in-circuit debugging and programming is discussed so that problems, if encountered, are quickly resolved.
4.1 Quick Debug/Program Reference
The following table is a quick reference for using the MPLAB PICkit 5 In-Circuit Debugger as either a debugging or programming tool.
Attention: MPLAB PICkit 5 does not support debug headers.
Table 4-1. Debug vs. Program Operaon
Item Debug Program
Needed Hardware A computer, a target board (Microchip demo board or your own design), cable(s) and an optional
adapter board to connect the computer to the target.
Debug Tool, USB cable, powered hub or target power supply.
Device with on-board debug circuitry. Device (with or without on-board debug
Needed Software MPLAB X IDE MPLAB X IDE or MPLAB IPE
Application code (example code, i.e. from MPLAB Discover, or your own code).
MPLAB X IDE selection
Program Operation Programs application code into the device.
Debug Features Available
Serial Quick-Time Programming (SQTP)
Command-line Operation
Programmer-To-Go (PTG)
Project Properties, PICkit 5 as Hardware Tool.
Debug Main Project icon .
Depending on the selections on the Project Properties dialog, this can be any range of program memory. In addition, a small debug executive may be placed in program memory and other debug resources may be reserved.
All for device – breakpoints, etc. N/A
N/A Use the MPLAB IPE to generate the SQTP le.
Use MDB command line utility, found by default in C:\Program Files\Microchip\
MPLABX\vx.xx\mplab_platform\bin\mdb.ba t.
N/A Programs application code stored on a
Operaon
circuitry), smartphone or tablet for PTG.
Prebuilt code - Hex le, PTG application for smartphone or tablet.
Make and Program Device icon .
Programs application code into the device. Depending on the selections on the Project Properties dialog, this can be any range of program memory.
Use IPECMD, found by default in C:\Program
Files\Microchip\ MPLABX\vx.xx\mplab_platform\mplab_ipe\ ipecmd.exe.
microSDHC card inserted in the MPLAB PICkit 5 into the device using PTG application.
4.2 Operaonal Overview
Note: Ensure you read 3.1. Power Connections, 3.2. PC and Smartphone Connections and
3.3. Target Connections before completing Step 5.
To debug and program code using the MPLAB PICkit 5 In-Circuit Debugger:
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 27
1. Download and install the latest MPLAB X IDE from the MPLAB X IDE webpage. MPLAB IPE is included in the MPLAB X IDE installer. See MPLAB X IDE documentation for how to create a project for developing application code and how to debug code.
2. Find examples of code in MPLAB Discover or search for Microchip content on GitHub, such as
Microchip PIC & AVR Examples.
3. Find a compiler for on your application device on the MPLAB XC Compilers webpage.
4. Purchase MPLAB PICkit 5 and optionally the Debugger Adapter Board.
5. Launch MPLAB X IDE. Plug in MPLAB PICkit 5 to the computer using the USB cable. Ensure you target is correctly connected.
6. Open your project or an example project in MPLAB X IDE. Right click on the project name in the Projects tab and select Properties. In the Project Properties dialog, ensure that PICkit 5 is selected under “Connected Hardware Tool”. Then select the PICkit 5 Category under a Conf(iguration) and setup options from the “Option Categories” list. Note: This is where you select power to target if desired.
7. Read the following sections for details on operation for your application device.
8. For a complete list of debugger limitations for your device, see the online Help le in MPLAB X IDE (Help > Help Contents > Hardware Tool Reference Help > Limitations - Emulators and Debuggers).
4.3 What is High Voltage?
The term “High Voltage” has been used to mean dierent things. Explanations of past and current denitions of this term are discussed below.
Operaon
AVR Devices
High-Voltage Programming - HVSP and HVPP
Older AVR devices have a programming interface known as High-Voltage Programming in both serial (HVSP) and parallel (HVPP) variants. In general this interface requires 12V to be applied to the RESET pin for the duration of the programming session.
High-Voltage Programming was sometimes necessary to recover when conguration bits (fuses) were incorrectly set or cleared. Some examples are:
• DWEN and lockbits set: debugWIRE not usable.
• DWEN set, SPIEN cleared: stuck in debugWIRE mode, cannot use SPI.
• JTAGEN cleared: Cannot use JTAG.
Tool Support: No current MPLAB hardware tool supports this method of programming. Therefore it is important that all warnings about the above issues be heeded and instructions followed.
High-Voltage Pulse - UPDI Pin
Depending on your device, there are currently two congurations that will require a High-Voltage (HV) Pulse to enable the UPDI function on a pin:
1. The UPDI function is on a shared pin that can also be used for RESET or GPIO. If RESET or GPIO has been selected and UPDI is now desired, an HV pulse is required on that pin to reactivate the UPDI functionality.
This conguration is found on older AVR devices and requires an HV pulse of 12V.
2. The UPDI function is on a shared pin that can also be used for GPIO.
RESET is on a dedicated pin. If GPIO has been selected and UPDI is now desired, an HV pulse is required on the RESET pin to reactivate the UPDI functionality.
This conguration is found on newer AVR devices and requires an HV pulse of approximately V
DD
+ 2 volts. See the device data sheet for the actual value range.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 28
Tool Support: All current MPLAB hardware tools support either HV pulse except for MPLAB Snap (does not support high voltage).
PIC Devices
High-Voltage vs Low-Voltage Programming
For High-Voltage Programming, older PIC devices need to be programmed at high voltage (12V) but newer devices can use lower voltages (a voltage in excess of 9 volts placed on the VPP pin).
For Low-Voltage Programming, the programming voltage VPP will not exceed VDD.
Tool Support: All current MPLAB hardware tools support high and low voltage programming except for:
• MPLAB Snap (does not support high voltage).
• MPLAB PICkit 4 (high voltage programming only when device VDD voltage is at or above 2.8V. Issue xed on 10-10094-R6; see the label on the back of the unit).
4.4 SAM and PIC32C Arm Devices - On-Chip Debugging
Both SAM and PIC32C microcontrollers are based on Arm® Cortex-M® core. Debug features available depend on the type of core (see table below). Debug connectors support SWO and JTAG.
For more information on which devices have which cores, see 32-bit PIC® and SAM Microcontrollers or your device data sheet. See also CoreSight documentation provided by Arm.
Operaon
Table 4-2. Cortex-M Debug and Trace Support Summary
Cortex-M Types Debug Support
Cortex-M0+ Debug Optional: Basic debug functionality includes processor halt, single-step, processor core register
access, Reset and HardFault Vector Catch, unlimited software breakpoints, and full system memory access. Also 1/2/3/4 breakpoint, and 1/2 watchpoint functionality.
Cortex-M23 Debug Optional: Basic debug functionality includes processor halt, single-step, processor core register
access, reset and HardFault Vector Catch, unlimited software breakpoints, and full system memory access. Also 1/2/3/4 breakpoint, and 1/2/3/4 watchpoint functionality.
Cortex-M4, M4F Debug Optional: Basic debug functionality includes processor halt, single-step, processor core register
access, Vector Catch, unlimited software breakpoints, and full system memory access. Also various breakpoint and 1/4 watchpoint functionality.
Cortex-M7 Cortex-M7 debug functionality includes processor halt, single-step, processor core register access, Vector
Catch, unlimited software breakpoints, and full system memory access. The processor also includes support for 4/8 hardware breakpoints and 2/4 watchpoints congured during implementation.
4.5 AVR Devices - On-Chip Debugging (OCD)
An on-chip debug module is a system allowing a developer to monitor and control the execution on a device from an external development platform, usually through a device known as a debugger or debug adapter.
With an OCD system, the application can be executed whilst maintaining exact electrical and timing characteristics in the target system, and while being able to stop execution conditionally or manually and inspect program ow and memory.
Run Mode
When in Run mode, the execution of code is completely independent of the MPLAB PICkit 5. The MPLAB PICkit 5 will continuously monitor the target device to see if a break condition has occurred. When this happens, the OCD system will interrogate the device through its debug interface, allowing the user to view the internal state of the device.
Stopped Mode
When a breakpoint is reached, the program execution is halted, but some I/O may continue to run as if no breakpoint had occurred. For example, assume that a USART transmit has just been initiated
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 29
when a breakpoint is reached. In this case, the USART continues to run at full speed, completing the transmission, even though the core is in Stopped mode.
Hardware Breakpoints
The target OCD module contains several Program Counter comparators implemented in the hardware. When the Program Counter matches the value stored in one of the comparator registers, the OCD enters Stopped mode. Since hardware breakpoints require dedicated hardware on the OCD module, the number of breakpoints available depends upon the size of the OCD module implemented on the target. Usually, one such hardware comparator is ‘reserved’ by the debugger for internal use.
Soware Breakpoints
A software breakpoint is a BREAK instruction placed in the program memory on the target device. When this instruction is loaded, program execution will break, and the OCD enters Stopped mode. To continue execution a “start” command has to be given from OCD. Not all Microchip devices have OCD modules supporting the BREAK instruction.
4.5.1 AVR Device Interfaces
Note: If you are having problems with programming and debugging with AVR microcontroller devices that use the UPDI/PDI/TPI interfaces, check Engineering Technical Notes (ETNs) for your tool.
The AVR devices feature various programming and debugging interfaces. Check the device data sheet for supported interfaces of that device.
Operaon
• All AVR E/D devices and newer tinyAVR devices have a UPDI interface, which is used for programming and debugging. AVR E/D devices also have the SPI interface for in-system programming.
• Some tinyAVR® devices have a TPI interface. TPI can be used for programming the device only. These devices do not have on-chip debug capability at all.
• Some tinyAVR devices and some megaAVR devices have the debugWIRE interface, which connects to an on-chip debug system known as tinyOCD. All devices with debugWIRE also have the SPI interface for in-system programming.
• Some megaAVR devices have a JTAG interface for programming and debugging, with an on-chip debug system, also known as megaOCD. All devices with JTAG also feature the SPI interface as an alternative interface for in-system programming.
• All AVR XMEGA devices have the PDI interface for programming and debugging. Some AVR XMEGA devices also have a JTAG interface with identical functionality.
Table 4-3. Programming and Debugging Interfaces Summary
AVR E/D New devices New devices
tinyAVR New devices Some devices Some devices Some devices
megaAVR All devices Some devices Some devices
AVR XMEGA Some devices All devices
4.5.1.1 AVR E/D OCD - Features
The AVR E/D OCD is based on the UPDI physical interface, which is a single pin programming and debugging interface. Other features include:
UPDI TPI SPI debugWIRE JTAG PDI
• Two hardware breakpoints
• Change of ow, interrupt, and software breakpoints
• Run-time read-out of Stack Pointer (SP) register, Program Counter (PC), and Status Register (SREG)
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 30
• Register le read- and writable in Stopped mode
4.5.1.2 nyAVR OCD Features
The tinyAVR OCD for new devices is based on the UPDI physical interface, which is a single pin programming and debugging interface. It supports the following features:
• Memory-mapped access to device address space (NVM, RAM, I/O)
• No limitation on the device clock frequency
• Unlimited number of user program breakpoints
• Two hardware breakpoints
• Support for advanced OCD features
• Nonintrusive run-time chip monitoring without accessing the system registers
• Interface for reading the result of the CRC check of the Flash on a locked device
The tinyAVR OCD for older devices is based on debugWIRE. For more on OCD features, see
4.5.1.5. debugWIRE OCD Features.
4.5.1.2.1 TinyX-OCD (UPDI) Special Consideraons
The UPDI data pin (UPDI_DATA) can be a dedicated pin or a shared pin, depending on the target AVR device. A shared UPDI pin will require activation using a High-Voltage (HV) pulse on the UPDI or RESET pin depending on device. See your device data sheet for details.
Operaon
On devices which include the CRCSCAN module (Cyclic Redundancy Check Memory Scan), this module should not be used in Continuous Background mode while debugging. The OCD module has limited hardware breakpoint comparator resources, so BREAK instructions may be inserted into Flash (software breakpoints) when more breakpoints are required, or even during source-level code stepping. The CRC module could incorrectly detect this breakpoint as a corruption of Flash memory contents.
The CRCSCAN module will appear congured to perform a CRC scan before boot. In the case of a CRC mismatch, the device will not boot and appears to be in a locked state. The only way to recover the device from this state is to perform a full chip erase and either program a valid Flash image or disable the pre-boot CRCSCAN (a simple chip erase will result in a blank Flash with invalid CRC and the part will thus still not boot). The software front-end will automatically disable the CRCSCAN fuses when chip erasing a device in this state.
When designing a target application PCB where the UPDI interface will be used, the following considerations must be made for correct operation:
• Pull-up resistors on the UPDI line must not be smaller than 10 kΩ. A pull-down resistor should not be used, or it should be removed when using UPDI. The UPDI physical is push-pull capable, so only a weak pull-up resistor is required to prevent false Start bit triggering when the line is idle.
• If the UPDI pin is to be used as a RESET pin, any stabilizing capacitor must be disconnected when using UPDI, since it will interfere with correct operation of the interface.
• If the UPDI pin is used as RESET or GPIO pin, all external drivers on the line must be disconnected during programming or debugging since they may interfere with the correct operation of the interface.
4.5.1.2.2 AVR devices with TPI
TPI (Tiny Programming Interface) is present on tinyAVR devices which have no OCD. Debugging of these devices is not possible - TPI is for programming only.
4.5.1.3 megaAVR OCD Features
The megaAVR OCD is based on the JTAG physical interface. It supports the following features:
• Complete program ow control
• Full access to all registers and memory areas
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 31
• Four program memory (hardware) breakpoints (one is reserved)
• Hardware breakpoints can be combined to form data breakpoints
• Unlimited number of program breakpoints (using BREAK) (except ATmega128[A])
4.5.1.3.1 megaAVR® Special Consideraons
Soware Breakpoints
Since it contains an early version of the OCD module, ATmega128[A] does not support the use of the BREAK instruction for software breakpoints.
JTAG Clock
The target clock frequency must be accurately specied in the software front-end before starting a debug session. For synchronization reasons, the JTAG TCK signal must be less than one-fourth of the target clock frequency for reliable debugging. When programming via the JTAG interface, the TCK frequency is limited by the maximum frequency rating of the target device, and not the actual clock frequency being used.
When using the internal RC oscillator, be aware that the frequency may vary from device to device and is aected by temperature and VCC changes. Be conservative when specifying the target clock frequency.
OCDEN Fuse
To be able to debug a megaAVR device, the OCDEN fuse must be programmed (by default, OCDEN is unprogrammed). This allows access to the OCD to facilitate debugging the device. The software front-end will always ensure that the OCDEN fuse is programmed when starting a debug session and is left unprogrammed when terminating the session, thereby restricting unnecessary power consumption by the OCD module.
Operaon
JTAGEN Fuse
The JTAG interface is enabled using the JTAGEN fuse, which is programmed by default. This allows access to the JTAG programming interface.
Important: If the JTAGEN fuse is unintentionally disabled, it can only be re-enabled using SPI or High Voltage programming methods.
If the JTAGEN fuse is programmed, the JTAG interface can still be disabled in rmware by setting the JTAG disable bit in the MCU Control Register. This will render code un-debuggable, and should not be done when attempting a debug session. If such code is already executing on the Microchip AVR device when starting a debug session, the MPLAB PICkit 5 will assert the RESET line while connecting. If this line is wired correctly, it will force the target AVR device into Reset, thereby allowing a JTAG connection.
If the JTAG interface is enabled, the JTAG pins cannot be used for alternative pin functions. They will remain dedicated JTAG pins until either the JTAG interface is disabled by setting the JTAG disable bit from the program code, or by clearing the JTAGEN fuse through a programming interface.
Tip: 
Be sure to check the “use external reset” checkbox in both the programming dialog and debug options dialog in Atmel Studio to allow the MPLAB PICkit 5 to assert the RESET line and re-enable the JTAG interface on devices which are running code which disables the JTAG interface by setting the JTAG disable bit.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 32
IDR/OCDR Events
The IDR (In-out Data Register) is also known as the OCDR (On-Chip Debug Register) and is used extensively by the debugger to read and write information to the MCU when in Stopped mode during a debug session. When the application program in Run mode writes a byte of data to the OCDR register of the AVR device being debugged, the MPLAB PICkit 5 reads this value out and displays it in the message window of the software front-end. The OCDR register is polled every 50 ms, so writing to it at a higher frequency will NOT yield reliable results. When the AVR device loses power while being debugged, spurious OCDR events may be reported. This happens because the MPLAB PICkit 5 may still poll the device as the target voltage drops below the AVR’s minimum operating voltage.
4.5.1.4 AVR XMEGA OCD Features
The AVR XMEGA OCD is otherwise known as PDI (Program and Debug Interface). Two physical interfaces (JTAG and PDI physical) provide access to the same OCD implementation within the device. It supports the following features:
• Complete program ow control
• Full access to all registers and memory areas
• One dedicated program address comparator or symbolic breakpoint (reserved)
• Four hardware comparators
• Unlimited number of user program breakpoints (using BREAK instruction)
• No limitation on system clock frequency
Operaon
Note: For the ATxmegaA1 family, only revision G or later is supported.
4.5.1.4.1 AVR® XMEGA® Special Consideraons
OCD and Clocking
When the MCU enters Stopped mode, the OCD clock is used as MCU clock. The OCD clock is either the JTAG TCK if the JTAG interface is being used, or the PDI_CLK if the PDI interface is being used.
I/O Modules in Stopped Mode
In contrast to earlier Microchip megaAVR devices, in XMEGA, the I/O modules are stopped in Stop mode. This means that USART transmissions will be interrupted and timers (and PWM) will be stopped.
Hardware Breakpoints
There are four hardware breakpoint comparators - two address comparators and two value comparators. They have certain restrictions:
• All breakpoints must be of the same type (program or data).
• All data breakpoints must be in the same memory area (I/O, SRAM, or XRAM).
• There can only be one breakpoint if the address range is used.
Here are the dierent combinations that can be set:
• Two single data or program address breakpoints.
• One data or program address range breakpoint.
• Two single data address breakpoints with single value compare.
• One data breakpoint with address range, value range, or both.
MPLAB X IDE and Atmel Studio will tell you if the breakpoint cannot be set, and why. Data breakpoints have priority over program breakpoints if software breakpoints are available.
JTAGEN Fuse
The JTAG interface is enabled using the JTAGEN fuse, which is programmed by default. This allows access to the JTAG programming interface.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 33
Operaon
Important: If the JTAGEN fuse is unintentionally disabled, it can only be re-enabled using the PDI physical interface.
If the JTAGEN fuse is programmed, the JTAG interface can still be disabled in rmware by setting the JTAG disable bit in the MCU Control Register. This will render code un-debuggable, and should not be done when attempting a debug session. If such code is already executing on the Microchip AVR device when starting a debug session, the MPLAB PICkit 5 will assert the RESET line while connecting. If this line is wired correctly, it will force the target AVR device into Reset, thereby allowing a JTAG connection.
If the JTAG interface is enabled, the JTAG pins cannot be used for alternative pin functions. They will remain dedicated JTAG pins until either the JTAG interface is disabled by setting the JTAG disable bit from the program code, or by clearing the JTAGEN fuse through a programming interface.
Tip: 
Be sure to check the “use external reset” checkbox in both the programming dialog and debug options dialog in Atmel Studio to allow the MPLAB PICkit 5 to assert the RESET line and re-enable the JTAG interface on devices which are running code which disables the JTAG interface by setting the JTAG disable bit.
Debugging with Sleep for ATxmegaA1 rev H and Earlier
A bug existed on early versions of ATxmegaA1 devices that prevented the OCD from being enabled while the device was in certain sleep modes. There are two work-arounds to re-enable OCD:
• Go into the MPLAB PICkit 5. Options in the Tools menu and enable “Always activate external Reset when reprogramming device.”
• Perform a chip erase.
The sleep modes that trigger this bug are:
• Power-Down
• Power-Save
• Standby
• Extended Standby
4.5.1.5 debugWIRE OCD Features
The debugWIRE OCD is a specialized OCD module with a limited feature set specially designed for AVR devices with low pin-count. It supports the following features:
• Complete program ow control
• Full access to all registers and memory areas
• Unlimited user program breakpoints (using BREAK instruction)
• Automatic baud rate conguration based on target clock
4.5.1.5.1 debugWIRE Special Consideraons
The debugWIRE communication pin (dW) is physically located on the same pin as the external Reset (RESET). An external Reset source is, therefore, not supported when the debugWIRE interface is enabled.
The debugWIRE Enable (DWEN) fuse must be set on the target device for the debugWIRE interface to function. This fuse is by default unprogrammed when the Microchip AVR device is shipped from the factory. The debugWIRE interface itself cannot be used to set this fuse. To set the DWEN fuse, the SPI
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 34
Operaon
mode must be used. The software front-end handles this automatically provided that the necessary SPI pins are connected. It can also be set manually using SPI programming in the software front-end.
Either: Attempt to start a debug session on the debugWIRE part. If the debugWIRE interface is not enabled, the software
front-end will oer to retry or attempt to enable debugWIRE using SPI programming. If you have the full SPI header connected, debugWIRE will be enabled and you will be asked to toggle power on the target. This is required for the fuse changes to be eective.
Or: Open the programming dialog in Microchip Studio in SPI mode and verify that the signature matches the correct
device. Check the DWEN fuse to enable debugWIRE.
Important: 
It is important to leave the SPIEN fuse programmed and the RSTDISBL fuse unprogrammed! Not doing this will render the device stuck in debugWIRE mode and High­Voltage programming will be required to revert the DWEN setting.
To disable the debugWIRE interface, use High-Voltage programming to unprogram the DWEN fuse. Alternately, use the debugWIRE interface itself to temporarily disable itself, which will allow SPI programming to take place, provided that the SPIEN fuse is set.
Important: 
If the SPIEN fuse was NOT left programmed, the software front-end will not be able to complete this operation and High-Voltage programming must be used.
In MPLAB X IDE, if debugWIRE is enabled on the target device and an SPI programming session is attempted, the IDE will oer to disable debugWIRE rst. In Microchip Studio, this must be done manually by, during a debug session, selecting the ‘Disable debugWIRE and Close’ menu option from the ‘Debug’ menu. debugWIRE will be temporarily disabled, and the software front-end will use SPI programming to unprogram the DWEN fuse.
Having the DWEN fuse programmed enables some parts of the clock system to be running in all sleep modes. This will increase the power consumption of the AVR while in sleep modes. The DWEN Fuse should, therefore, always be disabled when debugWIRE is not used.
When designing a target application PCB where debugWIRE will be used, the following considerations must be made for correct operation:
• Pull-up resistors on the dW/(RESET) line must not be smaller than 10 kΩ. The pull-up resistor is not required for debugWIRE functionality since the debugger tool provides this.
• Any stabilizing capacitor connected to the RESET pin must be disconnected when using debugWIRE since they will interfere with correct operation of the interface.
• All external Reset sources or other active drivers on the RESET line must be disconnected, since they may interfere with the correct operation of the interface.
Never program the lock-bits on the target device. The debugWIRE interface requires that lock-bits are cleared to function correctly.
4.5.1.5.2 debugWIRE Soware Breakpoints
The debugWIRE OCD is drastically downscaled when compared to the megaAVR (JTAG) OCD. This means that it does not have any Program Counter breakpoint comparators available to the user for debugging purposes. One such comparator does exist for purposes of run-to-cursor and single­stepping operations, but additional user breakpoints are not supported in hardware.
Instead, the debugger must make use of the AVR BREAK instruction. This instruction can be placed in FLASH, and when loaded for execution, it will cause the AVR CPU to enter Stopped mode. To
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 35
support breakpoints during debugging, the debugger must insert a BREAK instruction into FLASH at the point at which the users request a breakpoint. The original instruction must be cached for later replacement. When single-stepping over a BREAK instruction, the debugger has to execute the original cached instruction to preserve program behavior. In extreme cases, the BREAK has to be removed from FLASH and replaced later. All these scenarios can cause apparent delays when single-stepping from breakpoints, which will be exacerbated when the target clock frequency is very low.
It is thus recommended to observe the following guidelines, where possible:
• Always run the target at as high a frequency as possible during debugging. The debugWIRE physical interface is clocked from the target clock.
• Try to minimize the number of breakpoint additions and removals, as each one requires a FLASH page to be replaced on the target.
• Try to add or remove a small number of breakpoints at a time, to minimize the number of FLASH page write operations.
• If possible, avoid placing breakpoints on double-word instructions.
4.5.1.5.3 Understanding debugWIRE and the DWEN Fuse
When enabled, the debugWIRE interface takes control of the device’s /RESET pin, which makes it mutually exclusive to the SPI interface, which also needs this pin. When enabling and disabling the debugWIRE module, follow one of these two approaches:
• Let the software front-end take care of things (recommended)
• Set and clear DWEN manually (exercise caution, advanced users only!)
Operaon
Important: When manipulating DWEN manually, the SPIEN fuse must remain set to avoid having to use High-Voltage programming.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 36
Figure 4-1. Understanding debugWIRE and the DWEN Fuse
Start debug session
Power toggle (latches debugWIRE state)
Atmel Studio "Disable debugWIRE and close" (disables debugWIRE module temporarily and then clears DWEN fuse using SPI) MPLAB® X IDE offers to do this automatically if an attempt to connect using the SPI interface fails due to debugWIRE being enabled
atprogram dwdisable (atprogram disables debugWIRE module temporarily)
Clear DWEN fuse using SPI
Set DWEN fuse using SPI
Intermediate state 1:
Fuse DWEN set Fuse SPIEN set* (NB!) Module debugWIRE disabled until power toggle You can: Toggle power
DWEN SPIEN
Default state:
Fuse DWEN cleared Fuse SPIEN set Module debugWIRE disabled You can: Access flash and fuses using SPI
DWEN SPIEN
Debug state:
Fuse DWEN set Fuse SPIEN set Module debugWIRE enabled You can: Use debugWIRE You cannot: Access fuses or flash using SPI
DWEN SPIEN
Intermediate state 2:
Fuse DWEN set Fuse SPIEN set Module debugWIRE disabled You can: Access fuses and flash using SPI
DWEN SPIEN
Debug state (not recommended):
Fuse DWEN set Fuse SPIEN cleared Module debugWIRE enabled You can: Use debugWIRE To access flash and fuses, it is now necessary to use the High-Voltage Programming interface
DWEN SPIEN
Operaon
4.5.1.6 Advanced Debugging (AVR® JTAG/debugWIRE devices)
I/O Peripherals
Most I/O peripherals will continue to run even though the program execution is stopped by a breakpoint. Example: If a breakpoint is reached during a UART transmission, the transmission will be completed and corresponding bits set. The TXC (transmit complete) ag will be set and be available on the next single step of the code even though it normally would happen later in an actual device.
All I/O modules will continue to run in Stopped mode with the following two exceptions:
• Timer/Counters (congurable using the software front-end)
• Watchdog Timer (always stopped to prevent Resets during debugging)
Single Stepping I/O Access
Since the I/O continues to run in Stopped mode, care should be taken to avoid certain timing issues. For example, the code:
OUT PORTB, 0xAA IN TEMP, PINB
When running this code normally, the TEMP register would not read back 0xAA because the data would not yet have been latched physically to the pin by the time it is sampled by the IN operation. A NOP instruction must be placed between the OUT and the IN instruction to ensure that the correct value is present in the PIN register.
© 2023 Microchip Technology Inc. and its subsidiaries
User Guide
DS-50003525A - 37
Operaon
However, when single-stepping this function through the OCD, this code will always give 0xAA in the PIN register since the I/O is running at full speed even when the core is stopped during the single-stepping.
Single Stepping and Timing
Certain registers need to be read or written within a given number of cycles after enabling a control signal. Since the I/O clock and peripherals continue to run at full speed in Stopped mode, single-stepping through such code will not meet the timing requirements. Between two single steps, the I/O clock may have run millions of cycles. To successfully read or write registers with such timing requirements, the whole read or write sequence should be performed as an atomic operation running the device at full speed. This can be done by using a macro or a function call to execute the code or use the run-to-cursor function in the debugging environment.
Accessing 16-Bit Registers
The Microchip AVR peripherals typically contain several 16-bit registers that can be accessed via the 8-bit data bus (e.g., TCNTn of a 16-bit timer). The 16-bit register must be byte accessed using two read or write operations. Breaking in the middle of 16-bit access or single-stepping through this situation may result in erroneous values.
Restricted I/O Register Access
Certain registers cannot be read without aecting their content. Such registers include those which contain ags which are cleared by reading, or buered data registers (e.g., UDR). The software front-end will prevent reading these registers when in Stopped mode to preserve the intended non-intrusive nature of OCD debugging. Also, some registers cannot safely be written without side­eects occurring. These registers are read-only. For example:
• Flag registers, where a ag is cleared by writing 1 to any bit. These registers are read-only.
• UDR and SPDR registers cannot be read without aecting the state of the module. These registers are not accessible.
4.6 PIC32M MCU - On-Chip Debugging
PIC32M MCU devices support two types of debugging: (1) In-Circuit Serial Programming™ (ICSP™) and debugging using the PGECx and PGEDx pins or (2) 4-wire MIPS® Enhanced JTAG.
The MIPS32 M4K Processor core provides for an Enhanced JTAG (EJTAG) interface for use in the software debug of application and kernel code. In addition to the standard JTAG instructions, special instructions dened in the EJTAG specication dene which registers are selected and how they are used. For details on this interface, see your device data sheet.
In addition there are unlimited program and six complex data breakpoints. See your device data sheet for details on debug features for your specic PIC32M device.
Related Links
4.7. PIC MCU/dsPIC DSC - On-Chip Debugging
4.7 PIC MCU/dsPIC DSC - On-Chip Debugging
An on-chip debug module is a system allowing a developer to monitor and control the execution on a device from an external development platform, usually through a device known as a debugger or debug adapter. With an OCD system, the application can be executed while exact electrical and timing characteristics in the target system (as opposed to a simulator). The system is able to stop execution conditionally or manually and inspect program ow and memory.
For PIC microcontrollers (MCUs) or dsPIC digital signal controllers (DSC), some device resources may need to be reserved for debug.
4.7.1 Basic Debug Features
MPLAB® PICkit™ 5 In-Circuit Debugger has the following basic debug features.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 38
4.7.1.1 Start and Stop Debugging
To debug an application in MPLAB X IDE, you must create a project containing your source code so that the code may be built, programmed into your device, and executed as specied below:
Debug or execute project code in debug mode.
Pause or halt code execution.
Continue code execution after a pause or halt.
For paused/halted code, Step Into or execute one instruction. Be careful not to step into a Sleep instruction or you will have to perform a processor Reset to resume emulation.
For paused/halted code, Step Over an instruction.
Finish the debug session, which ends code execution.
Perform a processor Reset. Additional Resets, such as POR/BOR, MCLR and System, may be available, depending on device.
Operaon
4.7.1.2 View Processor Memory and Files
MPLAB X IDE provides several windows for viewing debug and various processor memory information. These are selectable from the Window menu. See MPLAB X IDE documentation for assistance on using these windows.
Window>Target Memory Views – view the dierent types of device memory. Depending on the selected device, memory types include Program Memory, File Registers, Conguration Memory, etc.
Window>Debugging – view debug information. Select from variables, watches, call stack, breakpoints, stopwatch, and trace.
To view your source code, nd the source-code le you wish to view in the Projects window and double click it to open it in a Files window. Code in this window is color-coded according to the processor and build tool selected. To change the style of color-coding, select Tools>Options>Fonts & Colors>Syntax.
For more on the Editor, see MPLAB X IDE documentation, Editor section.
4.7.1.3 Use Breakpoints
Use breakpoints to halt code execution at specied lines in your code.
4.7.1.3.1 Breakpoint Resources
For 16-bit PIC/dsPIC devices, breakpoints, data captures, and runtime watches use the same resources. So, the available number of breakpoints is actually the available number of combined breakpoints/triggers.
For 32-bit PIC devices, breakpoints use dierent resources than data captures and runtime watches. So, the available number of breakpoints is independent of the available number of triggers.
The number of hardware and software breakpoints available and/or used is displayed in the Dashboard window (Window>Dashboard). See the MPLAB X IDE documentation for more on this feature. Not all devices have software breakpoints.
See MPLAB X IDE Help>Help Contents>Hardware Tool Reference> Limitations - Emulators and Debuggers for limitations on breakpoint operation, including the general number of hardware breakpoints per device and hardware breakpoint skidding amounts.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 39
4.7.1.3.2 Hardware or Soware Breakpoint Selecon
To select hardware or software breakpoints:
1. Select your project in the Projects window and then right click to select “Properties.”
2. In Project Properties, select PICkit 5>Debug Options.
3. Check “Use software breakpoints” to use software breakpoints. Uncheck to use hardware
breakpoints.
Note: Using software breakpoints for debug impacts device endurance. Therefore, it is recommended that devices used in this manner not be used as production parts.
To help you decide which type of breakpoints to use (hardware or software) the following table compares the features of each.
Table 4-4. Hardware vs. Soware Breakpoints
Feature Hardware Breakpoints Software Breakpoints
Number of breakpoints Limited Unlimited
Breakpoints written to* Internal debug registers Flash Program Memory
Breakpoints applied to** Program Memory/Data Memory Program Memory only
Time to set breakpoints Minimal Dependent on oscillator speed, time to
Breakpoint skidding Most devices. See MPLAB X IDE Help>Help
Contents>Hardware Tool Reference> Limitations ­Emulators and Debuggers.
* Where information about the breakpoint is written in the device.
** What kind of device feature applies to the breakpoint. This is where the breakpoint is set.
Operaon
program Flash Memory and page size.
No
4.7.1.4 Use the Stopwatch
Use the stopwatch to determine the timing between two breakpoints.
Note: The stopwatch uses breakpoint resources.
To use the Stopwatch:
1. Add a breakpoint where you want to start the stopwatch.
2. Add another breakpoint where you want to stop the stopwatch.
3. Select
Window>Debugging>Stopwatch. Click on the Properties icon on the left of the window and
select the start and stop breakpoints.
4. Debug the program again to get the stopwatch timing result.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 40
Figure 4-2. Stopwatch Setup
Operaon
Figure 4-3. Stopwatch Window with Content
The stopwatch has the following icons on the left side of the window:
Table 4-5. Stopwatch Icons
Icon Icon Text Description
Properties Set stopwatch properties. Select one current breakpoint or trigger to start the stopwatch
Reset Stopwatch on Run Reset the stopwatch time to zero at the start of a run.
Clear History Clear the stopwatch window.
Clear Stopwatch (Simulator Only) Reset the stopwatch after you reset the device.
4.7.1.5 Set Freeze Peripherals
For some devices and tools, you can select a “Freeze on Halt” option, which allows you to freeze selected peripherals on a halt.
and one to stop the stopwatch.
4.7.2 ICSP Debugging
There are two steps to using MPLAB PICkit 5 In-Circuit Debugger as a debugger. The rst requires that an application is programmed into the target device (MPLAB PICkit 5 can be used for this). The
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 41
Operaon
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 MPLAB X IDE operations:
1. Programming the code into the target and activating special debug functions (see the next
section for details).
2. Using the debugger to set breakpoints and run.
For more information, refer to the MPLAB X IDE WebHelp.
If the target device cannot be programmed correctly, the MPLAB PICkit 5 will not be able to debug it.
A simplied diagram of some of the internal interface circuitry of the MPLAB PICkit 5 is shown in the gure below. In the gure, Rpu=10 kΩ typical and Ric=4.7 kΩ.
Figure 4-4. Proper Connecons for ICSP Programming
For programming, no clock is needed on the target device, but power must be supplied. When programming, the debugger puts programming levels on VPP/MCLR, sends clock pulses on PGC, and serial data via PGD. To verify that the part has been programmed correctly, clocks are sent to PGC and data is read back from PGD. This sequence conrms the debugger and device are communicating correctly.
4.7.2.1 ICSP Circuits That Will Prevent a Debug Tool From Funconing
The gure below shows the active debugger lines with some components that will prevent the MPLAB PICkit 5 In-Circuit Debugger from functioning.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 42
Figure 4-5. Improper Circuit Components
Operaon
In particular, these guidelines must be followed:
Do not use pull-ups on PGC/PGD – they could disrupt the voltage levels.
Do not use capacitors on PGC/PGD – they will prevent fast transitions on data and clock lines during programming and debugging communications, and slow programming times.
Do not use capacitors on MCLR – they will prevent fast transitions of VPP. A simple pull-up resistor is generally sucient.
Do not use diodes on PGC/PGD – they will prevent bidirectional communication between the debugger and the target device.
4.7.2.2 Sequence of Operaons Leading to Debugging
Given that the 4.7.2.4. Requirements for Debugging are met, set the MPLAB PICkit 5 In-Circuit Debugger as the current tool in MPLAB X IDE. Go to File> Project Properties to open the dialog and then under “Hardware Tool,” click “PICkit 5.”
The following actions can now be performed:
• When Debug > Debug Main Project is selected, the application code is programmed into the device’s memory via the ICSP protocol as described at the beginning of this section.
• A small “debug executive” program is loaded into the memory of the target device. Since some architectures require that 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 X IDE. These allow the debug executive to be activated by the debugger. For more information on the device’s reserved resources, see 4.7.2.5. Resources Used by the Debugger.
• The target device is run in Debug mode.
4.7.2.3 Debugging Details
The gure below illustrates the MPLAB PICkit 5 In-Circuit Debugger system when it is ready to begin debugging. In the gure, Rpu=10 kΩ typical and Ric=4.7 kΩ.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 43
Figure 4-6. MPLAB PICkit 5 Ready to Begin Debugging - PIC MCU
Operaon
To nd out whether an application program will run correctly, a breakpoint is typically set early in the program code. When a breakpoint is set from the user interface of MPLAB X IDE, the address of the breakpoint is stored in the special internal debug registers of the target device. Commands on PGC and PGD communicate directly to these registers to set the breakpoint address.
Next, the Debug > Debug Main Project function is usually selected in MPLAB X IDE. The debugger tells the debug executive to run. The target starts from the Reset vector and executes until the Program Counter reaches the breakpoint address that was stored previously in the internal debug registers.
After the instruction at the breakpoint address is executed, the in-circuit debug mechanism of the target device “res” and transfers the device’s program counter to the debug executive (like an interrupt) and the user’s application is eectively halted. The debugger communicates with the debug executive via PGC and PGD, gets the breakpoint status information, and sends it back to MPLAB X IDE. MPLAB X IDE then sends a series of queries to the debugger to get information about the target device, i.e., le register contents and the state of the CPU. These queries are performed by the debug executive.
The debug executive runs like an application in program memory. It uses some locations on the stack for its temporary variables. If the device does not run, for whatever reason (no oscillator, faulty power supply connection, shorts on the target board, etc.), then the debug executive cannot communicate to the MPLAB PICkit 5, and MPLAB X IDE will issue an error message.
Another way to set a breakpoint is to select Debug > Pause. This toggles the PGC and PGD lines so that the in-circuit debug mechanism of the target device switches the Program Counter from the user’s code in program memory to the debug executive. Again, the target application program is eectively halted, and MPLAB X IDE uses the debugger communications with the debug executive to interrogate the state of the target device.
4.7.2.4 Requirements for Debugging
To debug (set breakpoints, see registers, etc.) with the MPLAB PICkit 5 In-Circuit Debugger system, there are critical elements that must be working correctly:
• The debugger must be powered, must be connected to a computer, and must be communicating with the MPLAB X IDE software.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 44
• The target device must have power and a functional, running oscillator. If for any reason the target device does not run, the MPLAB PICkit 5 In-Circuit Debugger will not be able to debug it.
• The target device must have its Conguration words programmed correctly. These may be set using code or the Conguration Bits window in MPLAB X IDE.
– The oscillator Conguration bits should correspond to oscillator types available on the target.
– For some devices, the Watchdog Timer is enabled by default and needs to be disabled.
– The target device must not have any type of 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 selected in the device’s conguration word settings. This only refers to debugging, since programming will work through any PGC/PGD pair.
4.7.2.5 Resources Used by the Debugger
For some devices, device resources must be used for debug. For a complete list of resources used by the debugger for your device, in MPLAB X IDE select Help > Release Notes. In addition to a section for “Release Notes/Readmes,” there is a section for “Reserved Resources.” Select either “Reserved Resources by Device Family and Tool” or “Reserved Resources by Device for All Tools.”
4.7.2.6 Programming
Note: For information on programming, refer to the WebHelp.
Operaon
In the MPLAB X IDE, use the MPLAB PICkit 5 as a programmer to program a non-ICE/-ICD device, that is, a device not on a header board. Set the MPLAB PICkit 5 as the current tool (click the Debug Tool PICkit 5 in the navigation window, then select File > Project Properties from the main menu to open the dialog, then under “Hardware Tool,” click “PICkit 5”) to perform these actions:
• When Run > Run Main Project icon (see below) is selected, the application code is programmed into the device’s memory via the ICSP protocol. No clock is required while programming and all modes of the processor can be programmed – including code protect, Watchdog Timer enabled, and table read protect.
Run Main Project Icon
• A small “program executive” program may be loaded into the high area of program memory for some target devices.
• Special “in-circuit debug” registers in the target device are disabled by MPLAB X IDE, along with all debug features. This means that a breakpoint cannot be set and register contents cannot be seen or altered.
• The target device is run in Release mode. As a programmer, the debugger can only toggle the MCLR line to Reset and start the target device.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 45
5. Programmer-To-Go
The MPLAB PICkit 5 Programmer-To-Go (PTG) functionality allows a device memory image to be downloaded into a microSDHC card inserted in the MPLAB PICkit 5 tool for later programming into a specic device. That image contains the programming algorithm information. No software or PC is required to program devices once the MPLAB PICkit 5 programmer is set up for Programming-To-Go; however a PTG application for a BLE smartphone or tablet is available to provide a console to view image les on the microSDHC card and trigger actions. You can use the MPLAB X IDE (see
5.3.1. Setting Up PTG Mode Using MPLAB X IDE) or the MPLAB IPE (see 5.3.2. Setting Up PTG Mode
with MPLAB IPE) to set up the MPLAB PICkit 5 for Programmer-To-Go mode.
Note: 
No debugging capabilities are available in Programmer-To-Go mode.
Figure 5-1. MPLAB® PICkit™ 5 In-Circuit Debugger Diagram
Programmer-To-Go
Prerequisites for Programmer-To-Go
• MPLAB X IDE or MPLAB IPE (v6.10 or greater) must be installed on your computer.
• MicroSDHC Card - a formatted FAT32-compatible microSDHC card must be inserted correctly in the MPLAB PICkit 5 tool in order to use the Programmer-To-Go feature.
• Optional PTG application for BLE devices to control PTG actions and select memory images to program.
• Power source - for setting up the MPLAB PICkit 5 for Programmer-To-Go mode and for programming devices remotely. See the following section for specic power requirements.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 46
Related Links
5.6. Using the PTG Application on a BLE Device
5.1 Power Requirements for Programmer-To-Go
When Connected to Computer
When the MPLAB PICkit 5 is connected to a computer (and the MPLAB X IDE or MPLAB IPE application), power is supplied via the USB cable between the computer and the USB Type-C connector located on the top of the tool.
When Programming a Device Using PTG
When the MPLAB PICkit 5 is connected to the remote target board for programming a device using Programmer-To-Go, the target can supply power to the debugger. The minimum current required from the target board to the MPLAB PICkit 5 is 350 mA.
If sucient power cannot be supplied from the target board, then MPLAB PICkit 5 must be powered by a 5V power supply through the USB Type-C connector on the top of the MPLAB PICkit 5 tool. There are several options for providing power using:
• Any available PC USB port or USB hub port (no USB communication is necessary; it is only used to provide power).
• A USB host port on a portable device.
• A USB power adapter or charger with a USB Type-C connector, either from an automotive power jack or an AC wall plug.
• A portable battery charge or power source for cell phones or other portable devices with USB Type-C connector.
• A custom battery pack that supplies regulated 5V into the MPLAB PICkit 5 USB Type-C connector.
Programmer-To-Go
The USB power source used should meet the following minimum criteria:
• Capable of supplying at least 350 mA of current to the MPLAB PICkit 5 tool.
• Provides a steady, regulated 4.5V to 5.5V output.
Notes: 
1. Most portable chargers/power devices with their own batteries will not give an indication when
their internal battery voltage gets low and the output drops below 4.5V. Therefore, you must be sure the device’s battery has sucient remaining capacity to power the MPLAB PICkit 5 above
4.5V.
2. Any battery-based power sources should be disconnected from the MPLAB PICkit 5 unit when it
is not in use. Otherwise, the MPLAB PICkit 5 unit will drain the power source battery.
5.2 Limitaons for Programmer-To-Go
1. You must have a formatted FAT32-compatible microSDHC card inserted correctly into the
MPLAB PICkit 5 in order to use the Programmer-To-Go feature.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 47
Programmer-To-Go
Figure 5-2. Inserng the MicroSDHC Card Correctly
2. Devices Supported: Check the MPLAB PICkit 5 Release Notes (Readme) for device support
information.
3. In Programmer-To-Go mode, if the target board is powering the PICkit 5 it must be capable of
providing 350 mA of power for the PICkit 5 tool to operate properly. If the target board cannot provide enough power, you will need to provide power directly to the PICkit 5 through its USB port with either a power supply, computer, or USB power bank. See 5.1. Power Requirements
for Programmer-To-Go for suggested power sources.
4. If high voltage (HV) programming is not required, it is recommended to use low voltage
programming (LVP) if the device supports it.
5.3 Seng up PICkit 5 for Programmer-To-Go Mode
Before downloading a memory image to the MPLAB PICkit 5 for PTG operation, the PICkit 5 programmer options should be set up for Programmer-To-Go operation. In fact, it is highly recommended to test programming a target device from the software rst, with all desired options, to ensure the device programs as expected before downloading an image to Programmer-To-Go. Then you can put the PICkit 5 into PTG mode. Refer to the following sections for instructions.
5.3.1 Seng Up PTG Mode Using MPLAB X IDE
Using MPLAB X IDE, follow these steps to download the project les into the microSDHC card in the MPLAB PICkit 5 and enter Programmer-To-Go mode.
1. Insert a formatted FAT32-compatible microSDHC card into the PICkit 5.
2. Ensure that you have the appropriate connections to the device for Programmer-To-Go:
– PICkit 5 is connected to the computer via the USB cable.
– PICkit 5 is connected via the appropriate programming interface connector to the target
board.
– The target board is powered from either the PICkit 5 or a power supply, depending on your
Project Properties selection.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 48
Programmer-To-Go
3. In MPLAB X IDE, open the project you want to use and select the PICkit 5 tool for programming.
4. Right-click on your project name to open the Project Properties dialog. Then click on PICkit 5
under Categories to display the Options for PICkit 5 on the right side of the display. Select the Programmer-To-Go option category.
Figure 5-3. MPLAB® X IDE Programmer-To-Go Opons
5. In the Image Name eld, the default is “<your project name>_ptg,” though you can edit the name,
if you wish. This will be the folder name on the microSDHC card that contains the appropriate les for Programmer-To-Go.
6. In the Send image to tool, the check box is selected by default. With the box checked, the PTG
image is created and then sent to the microSDHC card in the connected MPLAB PICkit 5.
7. The Program Device check box is selected by default. When the check box selected, the device
connected to the MPLAB PICkit 5 is programmed. Note: If both the Send image to tool and Program Device check boxes are unchecked, see
5.3.3. Setting Up PTG Mode Without a Memory Card.
8. Click Apply, then OK. Use the Make and Program Device Main Project icon on the toolbar and
select Programmer-To-Go Project Name.
Figure 5-4. MPLAB® X IDE - Download Image to the MicroSDHC Card
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 49
During this process, the device is programmed, then the microSDHC card is populated with the appropriate les for the Programmer-To-Go operation. The Output window displays a status message “Programming/Verify complete” when the process nishes successfully. Note: The PTG settings on the microSDHC card are the same as in the project (for example, memory, power, etc.).
The PICkit 5 is now in Programmer-To-Go mode. The LED should blink green to indicate the tool has been congured successfully for Programmer-To-Go.
9. Disconnect the PICkit 5 and you’re ready to use Programmer-To-Go.
5.3.2 Seng Up PTG Mode with MPLAB IPE
Using MPLAB IPE, follow these steps to download the project les into the microSDHC card in the MPLAB PICkit 5 and enter Programmer-To-Go mode.
1. Insert a formatted FAT32-compatible microSDHC card into the PICkit 5.
Programmer-To-Go
2. Ensure that you have the appropriate connections to the device for Programmer-To-Go:
– PICkit 5 is connected to the computer via the USB cable.
– PICkit 5 is connected via the appropriate programming interface connector to the target
board.
– The target board is powered from either the PICkit 5 or a power supply, depending on your
Project Properties selection.
3. From the MPLAB IPE menu, select Settings > Advance Mode, and type in the password to log in.
The Operate tab should be visible/selected; if not click on the Operate button. Then, as shown in the following Figure, (1) enter your Device name and click Apply, (2) select your debug Tool and click Connect, and (3) select either your Hex or SQTP le by Browsing.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 50
Figure 5-5. MPLAB® IPE Operate Setup
Programmer-To-Go
4. Next, as shown in the following Figure, (1) click Settings and then (2) locate the Programmer-To-
Go box.
Figure 5-6. MPLAB® IPE Programmer-To-Go Opons
5. In the Image Name eld, the default is “<your project name>_ptg,” though you can edit the name
if you wish. This will be the folder name on the microSDHC card that contains the appropriate les for Programmer-To-Go.
6. The Send image to tool check box is selected by default. With the check box selected, the PTG
image is created and then sent to the microSDHC card in the connected MPLAB PICkit 5.
7. The Program Device check box is selected by default. With the check box selected,, the device
connected to the MPLAB PICkit 5 is programmed. Note: If both the Send image to tool and Program Device check boxes are unchecked, see
5.3.3. Setting Up PTG Mode Without a Memory Card.
8. Click the Programmer-To-Go button.
During this process, the device is programmed, then the Programmer-To-Go directory is populated with the appropriate les for the Programmer-To-Go operation into the microSDHC
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 51
card. The Output window displays a status message “Programming/Verify complete” when the process nishes successfully. Note: The PTG settings on the microSDHC card are the same as in the project (for example, memory, power, etc.).
The PICkit 5 is now in Programmer-To-Go mode. The LED should blink green to indicate the tool has been congured successfully for Programmer-To-Go.
9. Disconnect the PICkit 5 and you’re ready to use Programmer-To-Go.
5.3.3 Seng Up PTG Mode Without a Memory Card
If you do not want to send an image or program a device, you do not need to have a microSDHC card in the PICkit 5 to put it into PTG mode. This method puts the PICkit 5 into PTG mode and presumes that the necessary image is already on a microSDHC card that will be inserted in the PICkit 5 prior to using PTG to program devices.
There are several cases where you may want to do this, for example, the les for programming a device are put in a zip le and sent to a dierent location where they can be unzipped and downloaded to a microSDHC card which will be inserted into a PICkit 5 that’s already in PTG mode. Or you may have a situation where multiple instances of PICkit 5 are put in PTG mode and microSDHC cards for a variety of devices are used to program these devices. These are some examples of why you would want to set up PTG mode without a memory card installed.
Refer to the instructions in 5.3.1. Setting Up PTG Mode Using MPLAB X IDE or 5.3.2. Setting Up
PTG Mode with MPLAB IPE but leave both the Send Image to Tool and Program Device check boxes
unchecked. Continue with the instructions provided in those sections to put the PICkit 5 into PTG mode.
Programmer-To-Go
Remember, in order to use PTG, you must have a microSDHC card, with the necessary image inserted in the PICkit 5.
5.4 Using Programmer-To-Go
Complete the following steps when you are ready to start programming devices using the MPLAB PICkit 5 in PTG mode:
1. Connect the PICkit 5 tool, with a microSDHC card inserted, to the target board with the device
specied in your project.
2. Ensure that you have the appropriate connections to the device for Programmer-To-Go:
– PICkit 5 is connected via appropriate programming interface connector on the target board.
Ensure you match pin 1 on the target board with the pin 1 indicator on the PICkit 5.
– The target board is powered from either the PICkit 5 or a power supply, depending on your
project properties selection.
Note:  In Programmer-To-Go mode, if the target is providing power to the MPLAB PICkit 5, the target board must be capable of providing 350 mA of power for the PICkit 5 tool to operate properly.
3. When the PICkit 5 LED changes to a blinking green state, it is ready to program. If no image is on
the microSDHC card, the MPLAB PICkit 5 tool blinks red to indicate a PTG error.
4. To start programming the device, either:
rmly press (not hold) on the center of PICkit 5 shield (logo) on the front of the tool.
– use the PTG app on your BLE device to select an image and perform programming.
After the tool checks the device ID, the LED changes to blinking purple indicating that it is programming the device.
5. When programming is complete, the LED changes back to a ashing green to indicate a
successful programming/verify operation. It is now ready for the next programming operation.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 52
Programmer-To-Go
Note: A long press on the PICkit 5 push button reinitializes the tool. This can be used to reinitialize the PICkit 5 after detecting an error. It can also be used if you want to swap another microSDHC card with a dierent Programmer-To-Go image.
LED Status Sequence
When the PICkit 5 is in Programmer-To-Go mode and is properly connected to the target board, the following sequence occurs:
Status Meaning
Fast blinking yellow Initializing power settings.
Blinking green PICkit™ 5 is ready to program or programming completed successfully.
Blinking purple Programming in progress.
Blinking red Errors during initializing:
A microSDHC card is not detected.
The microSDHC card format is not supported. This should be reported by MPLAB X IDE or MPLAB IPE when the “Send image to tool” check box was selected.
Initialization les are not found on the microSDHC card. Check if Programmer-To-Go image is present in the microSDHC card.
Errors during programming:
The power settings are not set properly. For example, if the tool is supplying power, but it detects VDD from the target. Or if the target is supposed to be supplying power but the PICkit 5 tool does not detect VDD from the target, the LED will blink red to indicate an unexpected event.
Memory verify errors.
Device ID does not match.
If the data les for programming are not found or are corrupted.
Related Links
5.6. Using the PTG Application on a BLE Device
5.5 Exing Programmer-To-Go Mode
To exit from Programmer-To-Go mode, plug the MPLAB PICkit 5 unit into a PC USB port and connect toMPLAB X IDE or MPLAB IPE. Initiate any non-PTG operation (for example, Program, Erase, etc.) and the following message displays:
“The PICkit 5 is currently in programmer to go mode. If you continue with this operation, the PICkit 5 will exit programmer to go mode. Would you like to continue?”
Select Yes to exit Programmer-To-Go mode.
5.6 Using the PTG Applicaon on a BLE Device
An Android/iOS smartphone or tablet running the PTG application can be used to connect to the PICkit5 via Bluetooth and provide user friendly graphical interface to:
• browse the SD card and get the list of memory images present
• select and load the required image
• trigger Programmer-To-Go (PTG) operations
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 53
Figure 5-7. List of Images on SD Card
The application console will provide options to see the status of the ongoing PTG operation and programming messages coming from the tool during operation.
5.6.1 Opening Programmer-To-Go Applicaon
The MPLAB Programmer-To-Go (PTG) application allows for connections to the PICkit 5 via Bluetooth to remotely program downloaded device memory images stored on the microSDHC card inserted into the PICkit 5 device. MPLAB PTG application is available for download on Android/iOS smartphones and tablets.
MPLAB PTG can be downloaded for your device from the following sources:
• Google Play (Android OS)
• Apple Store (iOS)
Programmer-To-Go
After the application has been installed on your device, make sure that the device has Bluetooth services enabled in order to connect to the target PICkit 5 device. To open the application, select it from your devices app drawer or homepage.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 54
Programmer-To-Go
Once the PTG application has been opened, a list of all available PICKit 5 devices in range of your device will display. Available devices will be identied by their serial number. To select your target device, tap it on your screen.
Once your device has been selected you will be take to the PICkit 5 Status menu. From here you can see the status of your PICkit 5 device:
• PTG Mode: Displays and toggles between the current Programmer-to-Go mode.
• MicroSD card: Shows the current status of the SD card.
• Active PTG image: Displays the le path and name of the currently active memory image.
• Browse SD card: This option allows you to browse through all available memory images on the MicroSD card.
• Program: This option will take you to the operations menu to program the active image or view logs and statistics.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 55
5.6.2 Image Selecon
After opening the MPLAB Programmer-to-Go (PTG) application and selecting your target PICkit 5 device, navigate to the “Browse SD card” option. This section of the app will display all compatible memory image les stored remotely on the microSDHC card inserted into the connected PICkit 5 device.
Programmer-To-Go
This list can be navigated by scrolling down the displayed list or by searching for relevant le names. Select the intended memory image le by tapping on it.
5.6.3 Programming Target PICKit 5 Device
Once a compatible memory image le has been selected through the File Manager, you will be shown the Operation menu. From this menu you can select the “Program” option to immediately program your target PICkit 5 device.
© 2023 Microchip Technology Inc. and its subsidiaries
User Guide
DS-50003525A - 56
Programmer-To-Go
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 57
6. Troubleshoong
If you are having problems with MPLAB PICkit 5 In-Circuit Debugger operation, start here.
6.1 Some Quesons to Answer First
1. Which device are you working with?
Often an upgrade to a newer version of MPLAB® X IDE or MPLAB IPE is required to support newer devices.
2. Are you using a Microchip demo board or one of your own design? And have you followed
the guidelines for resistors/capacitors for communications connections?
See the “Operations” section.
3. Have you powered the target?
The debugger cannot power the target if greater than 150 mA. For applications needing more than 150 mA, use an external power supply to power the target board.
4. Are you using a USB hub in your setup? Is it powered?
If you continue to have problems, try using the debugger without the hub (plugged directly into the computer).
5. Are you using the USB cable shipped with the debugger? Other USB cables may be of poor
quality, too long or do not support USB Communication.
Troubleshoong
6.2 Top Reasons Why You Can't Debug
1. Oscillator not working. Check your Conguration bits setting for the oscillator. If you are using
an external oscillator, try using an internal oscillator. If you are using an internal PLL, make sure your PLL settings are correct.
2. No power to the target board. Check the power cable connection.
3. Incorrect VDD voltage. The VDD voltage is outside the specications for this device. See the
device programming specication for details.
4. Physical disconnect. The debugger has become physically disconnected from the computer
and/or the target board. Check the communication cables’ connections.
5. Communications lost. Debugger to PC communication has somehow been interrupted.
Reconnect to the debugger in MPLAB X IDE or MPLAB IPE.
6. Device not seated. The device is not properly seated on the target board. If the debugger is
properly connected and the target board is powered, but the device is absent or not plugged in completely, you may receive the following message:
Target Device ID (0x0) does not match expected Device ID (0x%x)
, where %x is the expected device ID.
7. Device is code-protected. Check your Conguration bits settings for code protection.
8. Application code corrupted. The target application has become corrupted or contains errors.
Try rebuilding and reprogramming the target application. Then initiate a Power-On-Reset of the target.
9. Incorrect programming pins. The PGC/PGD pin pairs are not correctly programmed in your
Conguration bits (for devices with multiple PGC/PGD pin pairs).
10. Additional setup required. Other conguration settings are interfering with debugging. Any
conguration setting that would prevent the target from executing code will also prevent the debugger from putting the code into Debug mode.
11. Incorrect brown-out voltage. Brown-out Detect voltage is greater than the operating voltage
VDD. This means the device is in Reset and cannot be debugged.
12. Incorrect connections. Review the guidelines in “Connections” section for the correct
communication connections.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 58
13. Invalid request. The debugger cannot always perform the action requested. For example, the
debugger cannot set a breakpoint if the target application is currently running.
Related Links
3. Connections
6.3 General
1. It is possible the error was a one-time event. Try the operation again.
2. There may be a problem programming in general. As a test, switch to Run mode using the
icon and program the target with the simplest application possible (for example, a program to blink an LED). If the program will not run, then you know that something is wrong with the target setup.
3. It is possible that the target device has been damaged in some way (for example, over current).
Development environments are notoriously hostile to components. Consider trying another target board. Microchip Technology Inc. oers demonstration boards to support most of its microcontrollers. Consider using one of these applications, which are known to work, to verify correct MPLAB® PICkit™ 5 In-Circuit Debugger functionality.
4. Review debugger setup to ensure proper application setup. For more information, see the
“Connections” and “Operation” sections.
5. Your program speed may be set too high for your circuit. In MPLAB X IDE, go to
Properties and select the PICkit 5 category, Program Options option category. Next to Program Speed select a slower speed from the drop-down menu. The default is Normal.
6. There may be certain situations where the debugger is not operating properly and rmware may
need to be downloaded or the debugger needs to be reprogrammed. See the following sections to determine additional actions.
Troubleshoong
File > Project
Related Links
3. Connections
6.4 How to Invoke the Bootload Mode
If the MPLAB X IDE or MPLAB IPE cannot communicate with the debugger, the debugger may need to be forced into bootload mode (download new rmware). Some possible reasons could be the following:
• If steps in the previous section did not correct the debugger issue.
• If the debugger’s rmware is not the newest, the MPLAB X IDE Output window shows an asterisk (*) next to the Application version number.
This can occur if the “Tool pack update options” in Project Properties is set to “Use a specic pack.” In this case, select “Use Latest installed tool pack” or nd and install the latest pack using the Pack Manager (Tools>Packs). If this does not resolve the debugger issue, proceed to the following steps for bootload mode.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 59
Troubleshoong
CAUTION
• If the indicator lights show a bootloader error. Refer to the “Indicator Lights Strip” section for more information on light strip modes and bootloader errors.
Perform the following steps to force the debugger into bootload mode:
1. Disconnect the USB cable from the debugger.
2. Press down on the MPLAB PICkit 5 logo and hold while plugging in the USB cable. The light strip
ashes purple. Continue pressing the logo until the light strip stops ashing and changes to steady on purple. You are now in bootload mode.
3. Try to reestablish communication with the MPLAB X IDE or MPLAB IPE. If successful, the latest
rmware is downloaded. When complete, the LED is steady on blue and the debugger is ready for operation.
Related Links
6.3. General
10.2.2. Indicator Lights Strip
6.5 How to Use the Hardware Tool Emergency Boot Firmware Recovery Ulity
Notice:  Only use this utility to restore hardware tool boot rmware to its factory state. Use only if your hardware tool no longer functions on any machine.
The debugger may need to be forced into recovery boot mode (reprogrammed) in rare situations; for example, if any of the following occurs when the debugger is connected to the computer:
• If the debugger has no LED lit.
• If the procedure described in the previous section was not successful.
YOU MUST HAVE MPLAB X IDE v6.10 OR GREATER TO USE THE EMERGENCY RECOVERY UTILITY FOR MPLAB PICkit 5.
Carefully follow the instructions found in MPLAB X IDE under the main menu options Debug > Hardware Tool Emergency Boot Firmware Recovery.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 60
Troubleshoong
Figure 6-1. Selecng Emergency Ulity
The gure below shows where the emergency recovery button is located on the MPLAB PICkit 5 In-Circuit Debugger.
Figure 6-2. Emergency Recovery Buon
If the procedure was successful, the recovery wizard displays a success screen. The MPLAB PICkit 5 will now be operational and able to communicate with the MPLAB X IDE.
If the procedure failed, try it again. If it fails a second time, contact Microchip Support at
support.microchip.com.
Related Links
6.4. How to Invoke the Bootload Mode
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 61
7. Frequently Asked Quesons
Look here for answers to frequently asked questions about the MPLAB PICkit 5 In-Circuit Debugger system.
7.1 How Does it Work?
What's in the silicon that allows it to communicate with the MPLAB PICkit 5 In-Circuit Debugger?
MPLAB PICkit 5 In-Circuit Debugger can communicate with Flash silicon via the ICSP™ interface. It uses the debug executive downloaded into program or test memory.
How is the throughput of the processor aected by having to run the debug executive?
The debug executive doesn't run while in Run mode, so there is no throughput reduction when running your code, that is, the debugger doesn’t ‘steal’ any cycles from the target device.
Does the MPLAB PICkit 5 In-Circuit Debugger have complex breakpoints like other in-circuit emulators/debuggers?
No. But you can break based on a value in a data memory location or program address.
Does the MPLAB PICkit 5 In-Circuit Debugger 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 have to occur before it breaks. However, you can only do two sequences. You can also do the AND condition and do PASS counts.
Frequently Asked Quesons
Is the MPLAB PICkit 5 In-Circuit Debugger optoisolated or electrically isolated?
No. You cannot apply a oating or high voltage (120V) to the current system.
Will the MPLAB PICkit 5 In-Circuit Debugger slow down the running of the program?
No. The device will run at any device speed as specied in the data sheet.
Is it possible to debug a dsPIC DSC device running at any speed?
The MPLAB PICkit 5 In-Circuit Debugger is capable of debugging at any device speed as specied in the device’s data sheet.
7.2 What's Wrong?
Things to consider:
Performing a Verify fails after programming the device. Is this a programming issue?
If Run Main Project icon ( )is selected, the device will automatically run immediately after programming. Therefore, if your code changes the Flash memory, verication could fail. To prevent the code from running after programming, select Hold in Reset.
My computer went into power-down/hibernate mode and now my debugger won’t work. What happened?
When using the debugger for prolonged periods of time, especially as a debugger, be sure to disable the Hibernate mode in the Power Options Dialog window of your computer’s operating system. Go to the Hibernate tab and uncheck the “Enable hibernation” check box. This will ensure that all communication is maintained across all the USB subsystem components.
I set my peripheral to NOT freeze on halt, but it is suddenly freezing. What's going on?
For dsPIC30F/33F and PIC24F/H devices, a reserved bit in the peripheral control register (usually either bit 14 or 5) is used as a Freeze bit by the debugger. If you have performed a write to the entire register, you may have overwritten this bit (the bit is user-accessible in Debug mode).
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 62
Frequently Asked Quesons
To avoid this problem, write only to the bits you wish to change for your application (BTS, BTC) instead of to the entire register (MOV).
When using a 16-bit device, an unexpected Reset occurred. How do I determine what caused it?
Some things to consider:
• To determine a Reset source, check the RCON register.
• Handle traps/interrupts in an Interrupt Service Routine (ISR). You should include trap.c style code, for example,
void __attribute__((__interrupt__)) _OscillatorFail(void); : void __attribute__((__interrupt__)) _AltOscillatorFail(void); : void __attribute__((__interrupt__)) _OscillatorFail(void) { INTCON1bits.OSCFAIL = 0; //Clear the trap flag while (1); } : void __attribute__((__interrupt__)) _AltOscillatorFail(void) { INTCON1bits.OSCFAIL = 0; while (1); } :
• Use ASSERTs. For example: ASSERT (IPL==7)
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 63
8. Error Messages
The MPLAB PICkit 5 In-Circuit Debugger produces various error messages; some are specic and others can be resolved with general corrective actions. In general, read any instructions under your error message. If these fail to x the problem or if there are no instructions, refer to the following sections.
8.1 Types of Error Messages
8.1.1 Debugger-to-Target Communicaons Errors
Failed to send database
If you receive this error:
• Try downloading again. It may be a one-time error.
• Try manually downloading the highest-number .jam le.
If these fail to x the problem or if there are no instructions, see 8.2.3. Debugger to Computer
Communication Error Actions.
8.1.2 Corrupted/Outdated Installaon Errors
Failed to download rmware
Error Messages
If the hex le exists:
• Reconnect and try again.
• If this does not work, the le may be corrupted. Reinstall MPLAB X IDE or MPLAB IPE.
If the hex le does not exist:
• Reinstall MPLAB X IDE or MPLAB IPE.
Unable to download debug executive
If you receive this error while attempting to debug:
1. Deselect the debugger as the debug tool.
2. Close your project and then close MPLAB X IDE or MPLAB IPE.
3. Restart MPLAB X IDE or MPLAB IPE and reopen your project.
4. Reselect the debugger as the debug tool and attempt to program the target device again.
Unable to download program executive
If you receive this error while attempting to program:
1. Deselect the debugger as the programmer.
2. Close your project and then close MPLAB X IDE or MPLAB IPE.
3. Restart MPLAB X IDE or MPLAB IPEE and reopen your project.
4. Reselect the debugger as the programmer and attempt to program the target device again.
If these actions fail to x the problem or if there are no instructions, see Corrupted Installation
Actions.
8.1.3 Debug Failure Errors
The target device is not ready for debugging. Please check your Conguration bit settings and program the device before proceeding.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 64
You will receive this message if you try to Run before programming your device for the rst time. If you receive this message after this, or immediately after programming your device, please refer to
8.2.6. Debug Failure Actions.
The device is code protected.
The device on which you are attempting to operate (read, program, blank check or verify) is code protected, in other words, the code cannot be read or modied. Check your Conguration bits setting for code protection (Windows > Target Memory Views > Conguration Bits).
Disable code protection, set or clear the appropriate Conguration bits in code or in the Conguration Bits window according to the device data sheet. Then erase and reprogram the entire device.
If these actions fail to x the problem, see Debugger to Target Communication Error Actions and
8.2.6. Debug Failure Actions.
8.1.4 Miscellaneous Errors
MPLAB PICkit 5 is busy. Please wait for the current operation to nish.
If you receive this error when attempting to deselect the debugger as a debugger or programmer:
1. Wait. Give the debugger time to nish any application tasks. Then try to deselect the debugger
again.
Error Messages
2. Select (Finish Debugger Session) to stop any running applications. Then, try to deselect the
debugger again.
3. Unplug the debugger from the computer. Then, try to deselect the debugger again.
4. Shut down MPLAB X IDE.
8.1.5 List of Error Messages
Table 8-1. Alphabezed List Of Error Messages
AP_VER=Algorithm Plugin Version
AREAS_TO_PROGRAM=The following memory area(s) will be programmed:
AREAS_TO_READ=The following memory area(s) will be read:
AREAS_TO_VERIFY=The following memory area(s) will be veried:
BLANK_CHECK_COMPLETE=Blank check complete, device is blank.
BLANK_CHECK_FAILED=Blank check failed. The device is not blank.
BLANK_CHECKING=Blank Checking...
BOOT_CONFIG_MEMORY=boot cong memory
BOOT_VER=Boot Version
BOOTFLASH=boot ash
BP_CANT_B_DELETED_WHEN_RUNNING=software breakpoints cannot be removed while the target is running. The selected breakpoint will be removed the next time the target halts.
CANT_CREATE_CONTROLLER=Unable to nd the tool controller class.
CANT_FIND_FILE=Unable to locate le %s.
CANT_OP_BELOW_LVPTHRESH=The voltage level selected %f, is below the minimum erase voltage of %f. The operation cannot continue at this voltage level.
CANT_PGM_USEROTP=The debug tool cannot program User OTP memory because it is not blank. Please exclude User OTP memory from the memories to program or switch to a device with blank User OTP memory.
CANT_PRESERVE_PGM_MEM=Unable to preserve program memory: Invalid range Start = %08x, End = %08x.
CANT_READ_REGISTERS=Unable to read target register(s).
CANT_READ_SERIALNUM=Unable to read the device serial number.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 65
Error Messages
CANT_REGISTER_ALTERNATE_PNP=Unable to register for PNP events for multiple USB product IDs.
CANT_REMOVE_SWPS_BUSY=The ICD 4 is currently busy and cannot remove software breakpoints at this time.
CHECK_4_HIGH_VOLTAGE_VPP=CAUTION: Check that the device selected in MPLAB IDE (%s) is the same one that is physically attached to the debug tool. Selecting a 5V device when a 3.3V device is connected can result in damage to the device when the debugger checks the device ID. Do you wish to continue?
CHECK_PGM_SPEED=You have set the program speed to %s. The circuit on your board may require you to slow the speed down. Please change the setting in the tool properties to low and try the operation again.
CHECK_SLAVE_DEBUG=Debugging may have failed because the, "Debug" check box in the Slave Core settings of the master project has not been enabled. Please make sure this setting is enabled.
COMM_PROTOCOL_ERROR=A communication error with the debug tool has occurred. The tool will be reset and should re-enumerate shortly.
COMMAND_TIME_OUT=PICkit 5 has timeout out waiting for a response to command %02x.
CONFIGURATION=conguration
CONFIGURATION_MEMORY=conguration memory
CONNECTION_FAILED=Connection Failed
CORRUPTED_STREAMING_DATA=Invalid streaming data has been detected. Run time watch or trace data may no longer be valid. It is recommended that you restart your debug session.
CPM_TO_TARGET_FAILED=An exception occurred during ControlPointMediator.ToTarget().
DATA_FLASH_MEMORY=Data Flash memory
DATA_FLASH=data ash
DEBUG_INFO_PGM_FAILED=Could not enter debug mode because programming the debug information failed. Invalid combinations of cong bits may cause this problem.
DEBUG_READ_INFO=Reading the device while in debug mode may take a long time due to the target oscillator speed. Reducing the range that you'd like to read (under the ICD 4 project properties) can mitigate the situation. The abort operation can be used to terminate the read operation if necessary.
DEVICE_ID_REVISION=Device ID Revision
DEVICE_ID=Device ID
DEVICE_INFO_CONFIG_BITS_MASK=Address = %08x, Mask = %08x
DEVICE_INFO_MEMBERS=DeviceInfo: pcAddress = %08x, Vpp = %.2f, useRowEraseIfVoltageIsLow = %s, voltageBelowWhichUseRowErase = %.2f, deviceName = %s, programmerType = %s
DEVICE_INFO_MEMINFO_MEMBERS= DeviceInfo: mask = %04x, exists = %s, startAddr = %08x, endAddr = %08x, rowSize = %04x, rowEraseSize = %04x, addrInc = %04x, widthProgram = %04x
DEVICE_INFO=DeviceInfo: Values:
DEVID_MISMATCH=Target Device ID (0x%x) is an Invalid Device ID. Please check your connections to the Target Device.
DFU_NOT_SUPPORTED=MPLAB X has detected the tool connected has capabilities that this version does not support. Please download the latest version of MPLAB X to use this tool.
DISCONNECT_WHILE_BUSY=The tool was disconnected while it was busy.
EEDATA_MEMORY=EEData memory
EEDATA=EEData
EMPTY_PROGRAM_RANGES=The programming operation did not complete because no memory areas have been selected.
EMULATION_MEMORY_READ_WRITE_ERROR=An error occurred while trying to read/write MPLAB's emulation memory: Address=%08x
END=end
ENSURE_SELF_TEST_READY=Please ensure the RJ-11 cable is connected to the test board before continuing.
ENSURE_SELF_TEST_READY=Please ensure the RJ-11 cable is connected to the test board before continuing. Would you like to continue?
ENV_ID_GROUP=Device Identication
ERASE_COMPLETE=Erase successful
ERASING=Erasing...
FAILED_2_PGM_DEVICE=Failed to program device.
FAILED_CREATING_COM=Unable create communications object.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 66
Error Messages
FAILED_CREATING_DEBUGGER_MODULES=Initialization failed: Failed creating the debugger module.
FAILED_ERASING=Failed to erase the device.
FAILED_ESTABLISHING_COMMUNICATION=Unable to establish tool communications.
FAILED_GETTING_DBG_EXEC=A problem occurred while trying to load the debug executive.
FAILED_GETTING_DEVICE_INFO=Initialization failed: Failed while retrieving device database (.pic) information
FAILED_GETTING_EMU_INFO=Initialization failed: Failed getting emulation database information
FAILED_GETTING_HEADER_INFO=Initialization failed: Failed getting header database information
FAILED_GETTING_PGM_EXEC=A problem occurred while trying to load the program executive.
FAILED_GETTING_TEX=Unable to obtain the ToolExecMediator
FAILED_GETTING_TOOL_INFO=Initialization failed: Failed while retrieving tool database (.ri4) information
FAILED_INITING_DATABASE=Initialization failed: Unable to initialize the tool database object
FAILED_INITING_DEBUGHANDLER=Initialization failed: Unable to initialize the DebugHandler object
FAILED_PARSING_FILE=Failed to parse rmware le: %s
FAILED_READING_EMULATION_REGS=Failed to read emulation memory.
FAILED_READING_MPLAB_MEMORY=Unable to read %s memory from %0x08 to %0x08.
FAILED_READING_SECURE_SEGMENT=A failure occurred while reading secure segment conguration bits
FAILED_SETTING_PC=Unable to set PC.
FAILED_SETTING_SHADOWS=Failed to properly set shadow registers.
FAILED_SETTING_XMIT_EVENTS=Unable to synchronize run time data semiphores.
FAILED_STEPPING=Failed while stepping the target.
FAILED_TO_GET_DEVID=Failed to get Device ID. Please make sure the target device is attached and try the operation again.
FAILED_TO_INIT_TOOL=Failed to initialize PICkit 5
FAILED_UPDATING_BP=Failed to update breakpoint:\nFile: %s\naddress: %08x
FAILED_UPDATING_FIRMWARE=Failed to properly update the rmware.
FILE_REGISTER=le register
FIRMWARE_DOWNLOAD_TIMEOUT=PICkit 5 timeout out during the rmware download process.
FLASH_DATA_MEMORY=Flash data memory
FLASH_DATA=ash data
FRCINDEBUG_NEEDS_CLOCKSWITCHING=To use FRC in debug mode the clock switching conguration bits setting must be enabled. Please enable clock switching and retry the requested operation.
FW_DOESNT_SUPPORT_DYNBP=The current PICkit 5 rmware does not support setting run time breakpoints for the selected device. Please download rmware version %02x.%02x.%02x or higher.
GOOD_ID_MISMATCH=Target Device ID (0x%x) is a valid Device ID but does not match the expected Device ID (0x%x) as selected.
HALTING=Halting...
HIGH=High
HOLDMCLR_FAILED=Hold in reset failed.
IDS_SELF_TEST_BOARD_PASSED=PICkit 5 is functioning properly. If you are still having problems with your target circuit please check the Target Board Considerations section of the online help.
IDS_ST_CLKREAD_ERR=Test interface PGC clock line read failure.
IDS_ST_CLKREAD_NO_TEST=Test interface PGC clock line read not tested.
IDS_ST_CLKREAD_SUCCESS=Test interface PGC clock line read succeeded.
IDS_ST_CLKWRITE_ERR=Test interface PGC clock line write failure. Please ensure that the tester is properly connected.
IDS_ST_CLKWRITE_NO_TEST=Test interface PGC clock line write not tested.
IDS_ST_CLKWRITE_SUCCESS=Test interface PGC clock line write succeeded.
IDS_ST_DATREAD_ERR=Test interface PGD data line read failure.
IDS_ST_DATREAD_NO_TEST=Test interface PGD data line read not tested.
IDS_ST_DATREAD_SUCCESS=Test interface PGD data line read succeeded.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 67
Error Messages
IDS_ST_DATWRITE_ERR=Test interface PGD data line write failure.
IDS_ST_DATWRITE_NO_TEST=Test interface PGD data line write not tested.
IDS_ST_DATWRITE_SUCCESS=Test interface PGD data line write succeeded.
IDS_ST_LVP_ERR=Test interface LVP control line failure.
IDS_ST_LVP_NO_TEST=Test interface LVP control line not tested.
IDS_ST_LVP_SUCCESS=Test interface LVP control line test succeeded.
IDS_ST_MCLR_ERR=Test interface MCLR level failure.
IDS_ST_MCLR_NO_TEST=Test interface MCLR level not tested.
IDS_ST_MCLR_SUCCESS=Test interface MCLR level test succeeded.
IDS_TEST_NOT_COMPLETED=Interface test could not be completed. Please contact your local FAE/CAE to SAR the unit.
INCOMPATIBLE_FW=The REAL ICE rmware in not compatible with the current version of MPLAB X software.
INVALID_ADDRESS=The operation cannot proceed because the %s address is outside the devices address range of 0x%08x ­0x%08x.
JTAG_NEEDS_JTAGEN=The JTAG Adapter requires the JTAG enable conguration bit to be turned on. Please enable this conguration bit before continuing.
MCLR_HOLD_RESET_NO_MAINTAIN_POWER=WARNING: You are powering the target device from PICkit 5 and have not selected the, "Maintain active power" option on the PICkit 5's Power property page. Without this option, the state of MCLR (hold/release from reset) cannot be guaranteed after the current session has ended.
MCLR_OFF_ID_WARNING=If you are using low voltage programming and the MCLRE cong bit on the target device is set to OFF, this may explain why the device ID is incorrect. In this case, please switch to the \"Use high voltage programming mode entry\" Program mode entry setting on the PICkit 5 Program Options property page and try the operation again.
MCLR_OFF_WARNING=If you wish to continue with MCLRE conguration bit set to OFF, switch to the \"Use high voltage programming mode entry\" Program mode entry setting on the PICkit 5 Program Options property page.
MEM_INFO=DeviceInfo: MemInfo values:
MEM_RANGE_ERROR_BAD_END_ADDR=Invalid program range end address %s received. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_ERROR_BAD_START_ADDR=Invalid program range start address %s received. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_ERROR_END_LESSTHAN_START=Invalid program range received: end address %s < start address %s. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_ERROR_ENDADDR_NOT_ALIGNED=Invalid program range received: end address %s is not aligned on a proper 0x%x address boundary. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_ERROR_STARTADDR_NOT_ALIGNED=Invalid program range received: start address %s is not aligned on a proper 0x%x address boundary. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_ERROR_UNKNOWN=An unknown error has occurred while trying to validate the user entered memory ranges.
MEM_RANGE_ERROR_WRONG_DATABASE=Unable to access data object while validating user entered memory ranges.
MEM_RANGE_OUT_OF_BOUNDS=The selected program range, %s, does not fall within the proper range for the memory area selected. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
MEM_RANGE_STRING_MALFORMED=The memory range(s) entered on the, "Memories to Program" property page (%s) is not formatted properly.
MISSING_BOOT_CONFIG_PARAMETER=Unable to nd boot cong start/end address in database.
MUST_NOT_USE_LVP_WHEN_LVPCFG_OFF=MPLAB has detected that the low voltage conguration bit on the device is o and you have selected the low voltage programming option on the debug tool's property page. If you wish to use the low voltage programming option you must rst do the following:\n* Turn o the low voltage programming option on the debug tool's Program Options property page\n* Program the low voltage conguration bit to on\n* Turn on the low voltage programming option on the debug tool's Program Options property page.
MUST_SET_LVPBIT_WITH_LVP=The low voltage programming feature requires the LVP conguration bit to be enabled on the target device. Please enable this conguration bit and try the operation again.
NEW_FIRMWARE_NO_DEVICE=Downloading rmware.
NEW_FIRMWARE=Now Downloading new Firmware for target device: %s
NMMR=NMMR
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 68
Error Messages
NO_DYNAMIC_BP_SUPPORT_AT_ALL=The current device does not support the ability to set breakpoints while the devices is running. The breakpoint will be applied prior to the next time you run the device.
NO_PGM_HANDLER=Cannot program software breakpoints. The program handler has not been initialized.
NO_PROGRAMMING_ATTEMPTED=MPLAB's memory is blank so no programming operation was attempted.
NORMAL=Normal
OP_FAILED_FROM_CP=The requested operation failed because the device is code protected.
OpenIDE-Module-Name=PICkit 5
OPERATION_INFO_MEMBERS=OperationInfo: Type = %s, Mask = %08x, Erase = %s, Production Mode = %s.
OPERATION_INFO_TRANSFER_INFO_MEMBERS=OperationInfo: Start = %x, End = %x, Buer Length = %d, Type = %s, Mask = %08x.
OPERATION_INFO=OperationInfo: Values:
OPERATION_NOT_SUPPORTED=This operation is not supported for the selected device
OUTPUTWIN_TITLE=PICkit 5
PERIPHERAL=Peripheral
POWER_ERROR_NO_POWER_SRC=The conguration is set for the target board to supply its own power but no voltage has been detected on VDD. Please ensure you have your target powered up and try again.
POWER_ERROR_POWER_SRC_CONFLICT=The conguration is set for the tool to provide power to the target but there is voltage already detected on VDD. This is a conict. Please ensure your target is not supplying voltage to the tool and try again.
POWER_ERROR_SLOW_DISCHARGE= There seems to be excessive capacitance on VDD causing a slower system discharge and shutdown. Consider minimizing overall capacitance loading or use power from your target to avoid discharge delays.
POWER_ERROR_UNKNOWN=An unknown power error has occurred.
POWER_ERROR_VDD_TOO_HIGH=The VDD voltage desired is out of range. It exceeds the maximum voltage of 5.5V.
POWER_ERROR_VDD_TOO_LOW=The VDD voltage desired is out of range. It is below the minimum voltage of 1.5V.
POWER_ERROR_VPP_TOO_HIGH=The VPP voltage desired is out of range. It exceeds the maximum voltage of 14.2V.
POWER_ERROR_VPP_TOO_LOW=The VPP voltage desired is out of range. It is below the minimum voltage of 1.5V.
PRESERVE_MEM_RANGE_ERROR_BAD_END_ADDR=Invalid preserve range end address %s received. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
PRESERVE_MEM_RANGE_ERROR_BAD_START_ADDR=Invalid preserve range start address %s received. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
PRESERVE_MEM_RANGE_ERROR_END_LESSTHAN_START=Invalid preserve range received: end address %s < start address %s. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
PRESERVE_MEM_RANGE_ERROR_ENDADDR_NOT_ALIGNED=Invalid preserve range received: end address %s is not aligned on a proper 0x%x address boundary. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
PRESERVE_MEM_RANGE_ERROR_STARTADDR_NOT_ALIGNED=Invalid preserve range received: start address %s is not aligned on a proper 0x%x address boundary. Please check the manual program ranges on the debug tool's, "Memories to Program" property page.
PRESERVE_MEM_RANGE_ERROR_UNKNOWN=An unknown error has occurred while trying to validate the user entered preserve ranges.
PRESERVE_MEM_RANGE_ERROR_WRONG_DATABASE=Unable to access data object while validating user entered memory ranges.
PRESERVE_MEM_RANGE_MEM_NOT_SELECTED=You have selected to preserve an area of memory but have not selected to program that area. Please check the preserved ranges on the debug tool's "Memories to Program" property page and make sure that any preserved memory is also designated to be programmed.
PRESERVE_MEM_RANGE_OUT_OF_BOUNDS=The selected preserve range, %s, does not fall within the proper range for the memory area selected. Please check the manual program ranges on the debug tool's "Memories to Program" property page.
PRESERVE_MEM_RANGE_STRING_MALFORMED=The preserve memory range(s) entered on the, "Memories to Program" property page (%s) is not formatted properly.
PRESERVE_MEM_RANGE_WONT_BE_PROGRAMMED_AUTO_SELECT=Some or all of the preserve memory ranges (%s) entered on the, "Memories to Program" property page, do not fall under the indicated program range(s) (%s) for the memory selected. Please deselect the "Auto select memories and ranges" option on the "Memories to Program" property page, change to manual mode and adjust your range(s) accordingly.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 69
Error Messages
PRESERVE_MEM_RANGE_WONT_BE_PROGRAMMED=Some or all of the preserve memory ranges (%s) entered on the, "Memories to Program" property page, do not fall under the indicated program range(s) (%s) for the memory selected. Please check the preserved ranges on the debug tool's, "Memories to Program" property page.
PROGRAM_CFG_WARNING=WARNING: You have selected to program conguration memory. Programming invalid values into any of the conguration elds may have unintended consequences. Please make sure that EVERY conguration eld has a valid value. If you are not sure, you can read the conguration values o of device rst and then change only the elds you are concerned with. Would you like to continue programming?
PROGRAM_COMPLETE=Programming/Verify complete
PROGRAM_MEMORY=program memory
PROGRAM=program
PROGRAMMING_DID_NOT_COMPLETE=Programming did not complete.
READ_COMPLETE=Read complete
READ_DID_NOT_COMPLETE=Read did not complete.
RELEASEMCLR_FAILED=Release from reset failed.
REMOVING_SWBPS_COMPLETE=Removing software breakpoints complete
REMOVING_SWBPS=Removing software breakpoints...
RESET_FAILED=Failed to reset the device.
RESETTING=Resetting...
RISKY_CFG_RANGE_REMOVED=The conguration memory will not be included in the program operation because the, "Exclude conguration memory from programming" option is set. To change this, go to the Memories to Program property page and uncheck the setting. WARNING: Programming conguration values on this device can cause unintended consequences if all of the conguration values are not properly set. It is advised that you read the conguration values o of device rst and then change only the elds you are concerned with.
RUN_INTERRUPT_THREAD_SYNCH_ERROR=An internal run error has occurred. It is advised that you restart your debug session. You may continue running but certain run time features may no longer work properly.
RUN_TARGET_FAILED=Unable to run the target device.
RUNNING=Running
SERIAL_NUM=Serial Number:
SETTING_SWBPS=Setting software breakpoints.......
STACK=stack
START_AND_END_ADDR=start address = 0x%x, end address = 0x%x
START=start
TARGET_DETECTED=Target voltage detected
TARGET_FOUND=Target device %s found.
TARGET_HALTED=Target Halted
TARGET_NOT_READY_4_DEBUG=The target device is not ready for debugging. Please check your conguration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings.
TARGET_VDD=Target VDD:
TEST=test
TOOL_INFO_MEMBERS=ToolInfo: speedLevel = %d, PGCResistance = %d, PGDResistance = %d, PGCPullDir = %s, PGDPullDir = %s, ICSPSelected = %s.
TOOL_INFO=ToolInfo: Values:
TOOL_IS_BUSY=PICkit 5 is busy. Please wait for the current operation to nish.
TOOL_SUPPLYING_POWER=PICkit 5 is supplying power to the target (%.2f volts).
TOOL_VDD=VDD:
TOOL_VPP=VPP:
UNABLE_TO_OBTAIN_RESET_VECTOR=PICkit 5 was unable to retrieve the reset vector address. This indicates that no _reset symbol has been dened and may prevent the device from starting up properly.
UNKNOWN_MEMTYPE=Unknown memory type
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 70
Error Messages
UNLOAD_WHILE_BUSY=PICkit 5 was unloaded while still busy. Please unplug and reconnect the USB cable before using PICkit 5 again.
UPDATING_APP=Updating rmware application...
UPDATING_BOOTLOADER=Updating rmware bootloader.
USE_LVP_PROGRAMMING=NOTE: If you would like to program this device using low voltage programming, select Cancel on this dialog. Then go to the PICkit 5 node of the project properties and check the Enable Low Voltage Programming check box of the Program Options Option Category pane (low voltage programming is not valid for debugging operations).
USERID_MEMORY=User Id Memory
USERID=user Id
VERIFY_COMPLETE=Verication successful.
VERIFY_FAILED=Verify failed
VERSIONS=Versions
VOLTAGE_LEVEL_BAD_VALUE_EX=You have entered an invalid value %s for the Voltage Level on the PICkit 5 Power property page. Please x this before continuing.
VOLTAGE_LEVEL_BAD_VALUE=Unable to parse the voltage level %s. Please enter a valid voltage entry.
VOLTAGE_LEVEL_OUT_OF_RANGE=The target voltage level you have entered, %.3f, is outside the range of the device %.3f ­%.3f.
VOLTAGES=Voltages
WOULD_YOU_LIKE_TO_CONTINUE=Would you like to continue?
WRONG_PICkit 5_FLAVOR=Your PICkit 5 hardware needs updating please, contactPICkit 5_Update@microchip.com to get a replacement.
8.2 General Correcve Acons
8.2.1 Read/Write Error Acons
If you receive a read or write error:
1. Did you click Debug > Reset? 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 debugger-to-target connection is correct (PGC and PGD are connected).
5. For write failures, ensure that “Erase all before Program” is checked on the Program Options for
the debugger in the Project Properties window.
6. Ensure that the cable(s) are of the correct length.
Related Links
9.2.2. Debug Options
8.2.2 Debugger to Target Communicaon Error Acons
If the MPLAB PICkit 5 In-Circuit Debugger and the target device are not communicating with each other:
1. Select Debug > Reset and then try the action again.
2. Ensure that the cable(s) are of the correct length.
8.2.3 Debugger to Computer Communicaon Error Acons
If the MPLAB PICkit 5 In-Circuit Debugger and MPLAB X IDE or MPLAB IPE are not communicating with each other:
1. Unplug and then plug in the debugger.
2. Reconnect to the debugger.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 71
3. Try the operation again. It is possible the error was a one-time event.
4. The version of MPLAB X IDE or MPLAB IPE installed may be incorrect for the version of rmware
loaded on the MPLAB PICkit 5 In-Circuit Debugger. Follow the steps outlined in 8.2.4. Corrupted
Installation Actions.
5. There may be an issue with the computer USB port. See section 8.2.5. USB Port Communication
Error Actions.
8.2.4 Corrupted Installaon Acons
The problem is most likely caused by a incomplete or corrupted installation of MPLAB X IDE or MPLAB IPE.
1. Uninstall all versions of MPLAB X IDE or MPLAB IPE from the computer.
2. Reinstall the desired MPLAB X IDE or MPLAB IPE version.
3. If the problem persists, contact Microchip Support.
8.2.5 USB Port Communicaon Error Acons
The problem is most likely caused by a faulty or non-existent communications port.
1. Reconnect to the MPLAB PICkit 5 In-Circuit Debugger.
2. Make sure the debugger is physically connected to the computer on the appropriate USB port.
3. Make sure the appropriate USB port has been selected in the debugger options in the Project
Properties window.
4. Make sure the USB port is not in use by another device.
5. If using a USB hub, make sure it is powered.
6. Make sure the USB drivers are loaded.
Error Messages
Related Links
9.2. Debugger Options Selection
8.2.6 Debug Failure Acons
The MPLAB PICkit 5 In-Circuit Debugger was unable to perform a debugging operation. There are numerous reasons why this might occur.
Related Links
6. Troubleshooting
8.2.7 Internal Error Acons
Internal errors are not expected and should not happen. They are used for internal Microchip development.
The most likely cause is a corrupted installation (8.2.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).
If the problem persists, contact Microchip Support.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 72
9. Debugger Funcon Summary
A summary of the MPLAB PICkit 5 In-Circuit Debugger functions are summarized below.
9.1 Debugger Selecon and Switching
Use the Project Properties dialog to select or switch debuggers for a project. To switch you must have more than one debugger connected to your computer. MPLAB X IDE will dierentiate between the debuggers by displaying dierent serial numbers.
To select or change the debugger used for a project:
1. Open the Project Properties dialog by doing one of the following:
a. Click on the project name in the Projects window and select
or
b. Right click on the project name in the Projects window and select Properties.
2. Under Categories on the left side, expand “Conf:[default]” to show PICkit 5.
3. Under Hardware Tools, nd PICkit 5 and click on a serial number (SN) to select a debugger for
use in the project, then click Apply.
9.2 Debugger Opons Selecon
Debugger options are set in the Project Properties dialog. Click on PICkit 5 under Categories to display the Options for PICkit 5 (see gure below). Use the Options categories drop down list to select various options. Click on an option name to see its description in the Option Description box below. Click to the right of an option name to select or change it.
Debugger Funcon Summary
File > Project Properties.
Note: The available option categories and the options within those categories are dependent on the device you have selected.
Figure 9-1. Opons for MPLAB® PICkit™ 5
After setting the options, click Apply or OK. Also click the Refresh Debug Tool icon in the MPLAB X IDE dashboard display to update any changes made.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 73
9.2.1 Memories to Program
Select the memories to be programmed into the target. The table below shows all the possible options, however, only those options available for your selected device will be displayed in MPLAB X IDE. Note: If Erase All Before Program is selected, as shown in “Program Options,” then all device memory will be erased before programming.
Table 9-1. Memories to Program Opon Category
Auto select memories and ranges Allow PICkit 5 to Select Memories - The debugger uses your selected device
Conguration Memory Check to include Conguration Memory in the area(s) to be programmed. This is
Boot Flash Check to include Boot Flash memory in the area(s) to be programmed. This is
EEPROM Check to include EEPROM memory in the area(s) to be programmed.
ID Check to program the user ID.
Program Memory Check to program the target program memory range specied below.
Program Memory Range(s) (hex) The range(s) of program memory to be programmed. These are the starting and
Debugger Funcon Summary
and default settings to determine what to program. Manually select memories and ranges - You select the type and range of memory to program (see below).
always programmed in Debug mode.
always programmed in Debug mode.
ending hex address range(s) in program memory for programming, reading, or verication. Each range must be two hex numbers (the start and end addresses of the range) separated by a dash. Multiple ranges must be separated by a comma (for example, 0-, 200-2). Ranges must be aligned on a 0x800 address boundary. Note: The address range does not apply to the Erase function. The Erase function will erase all data on the device.
Preserve Program Memory Enabling this option will cause the current program memory on the device to
be read into MPLAB X IDE's memory and then reprogrammed back to the target device when programming is done. The range(s) of program memory that will be preserved is determined by the Preserve Program Memory Range(s) option below. Ensure that code is NOT code protected.
Preserve Program Memory Range(s) (hex) The range(s) of program memory to be preserved. Each range must be two hex
numbers, representing the start and end addresses of the range, separated by a dash. Ranges must be separated by a comma (for example, 0-, 200-2). Areas are reserved by reading them into MPLAB X IDE and then programming them back down when a program operation occurs. Thus the preserved areas must lie within a memory range that will be programmed.
Preserve (Type of) Memory Enabling this option will cause the current memory type on the device to be read
into MPLAB X IDE's memory and then reprogrammed back to the target device when programming is done. Check to preserve Memory for reprogramming, where Memory is the type of memory. Types include: EEPROM, ID, Boot Flash, and Auxiliary. Ensure that code is NOT code protected.
Preserve (Type of) Memory Range(s) (hex)*
* If you receive a programming error due to an incorrect range, ensure the range does not exceed available/remaining device memory.
The range(s) of the memory type to be preserved. Each range must be two hex numbers, representing the start and end addresses of the range, separated by a dash. Ranges must be separated by a comma (for example, 0-, 200-2). Areas are reserved by reading them into MPLAB X IDE and then programming them back down when a program operation occurs. Thus the preserved areas must lie within a memory range that will be programmed. Memory is the type of memory, which includes EEPROM, ID, Boot Flash, and Auxiliary. Ensure that code is NOT code protected.
9.2.2 Debug Opons
If this option is available for the project device, you can select to use software breakpoints.
Table 9-2. Debug Opon Category
Debug startup Begin a debug session after device startup.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 74
Debug reset Begin a debug session after a reset.
Use Software Breakpoints Use Software Breakpoints.
Table 9-3. Soware vs. Hardware Breakpoints
Features Software Breakpoints Hardware Breakpoints
Number of breakpoints Unlimited Limited
Breakpoints are written to Program Memory Debug Registers
Time to set breakpoints Oscillator Speed Dependent – can take
Skidding No Yes
Note: Using software breakpoints for debugging impacts device endurance. Therefore, it is recommended that devices used in this manner not be used as production parts.
9.2.3 Program Opons
Choose to erase all memory before programming or to merge code. Also set options specically for the PICkit 5 tool.
Table 9-4. Program Opon Category
Erase All Before Program Enabling this option will cause the entire device to be erased prior to programming
Programming mode entry This option designates the method the debugger will use to put the target device in
Programming Method Apply VDD before V
LED Brightness Setting Select the level of brightness from 1 (darkest) to 10 (brightest).
PGC Conguration This option determines the type of resistance that will be applied to the PGC line
PGC resistor value (kΩ) Type in a resistor value from 0-50. The default value is 4.7 kΩ. If the PGC conguration
PGD Conguration Select either none, pull up or pull down. The default is pull down. The value of the
PGD resistor value (kΩ) Type in a resistor value from 0-50. The default value is 4.7 kΩ. If the PGD conguration
Program Speed Select the speed the debugger will use to program the target as either Low, Normal
Debugger Funcon Summary
Minimal
minutes
the data from MPLAB X IDE. Any memory areas designated to be preserved will be read before the device is erased and reprogrammed on the device when the device is programmed. Unless programming new or already erased devices, it is important to have this box checked. If not checked, the device is not erased and program code will be merged with the code already in the device.
programming mode. For the low-voltage method, VPP will not exceed the VDD supply voltage. Instead a test pattern will be used on VPP. For the high-voltage method, a voltage in excess of 9 volts will be placed on VPP. Note: High voltage programming requires VDD above 2.8V. Select low voltage programming if your target voltage is below 2.8V.
High voltage program mode entry - 2.8 to 5.0V.
Low voltage program mode entry only - 1.2 to 5.0V.
Apply VPP before V
(pull down, pull up or none). The default is pull down. The value of the resistance is determined by the PGC resistor value option below.
is set to none, this value is ignored.
resistance is determined by the PGD resistor value option below.
is set to none, this value is ignored.
or High. The default is Normal. If programming should fail, using a slower speed may solve the problem.
PP
DD
9.2.4 Freeze Peripherals
Select from the list of peripherals to freeze or not freeze on program halt. The available peripherals are device dependent.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 75
PIC12/16/18 MCU Devices
To freeze/unfreeze all device peripherals on halt, check/uncheck the “Freeze on Halt” check box. If this does not halt your desired peripheral, be aware that some peripherals do not have a freeze-on­halt capability and cannot be controlled by the debugger.
dsPIC, PIC24 and PIC32 Devices
Select the peripheral’s check box in the “Peripherals to Freeze on Halt” list to freeze that peripheral on a halt. Uncheck the peripheral to let it run while the program is halted. If you do not see a peripheral on the list, check “All Other Peripherals.” If this does not halt your desired peripheral, be aware that some peripherals do not have a freeze-on-halt capability and cannot be controlled by the debugger.
To select all peripherals, including “All Other Peripherals,” click Check All. To deselect all peripherals, including “All Other Peripherals,” click Uncheck All.
9.2.5 Power
Select power options.
Table 9-5. Power Opon Category
Power Target Circuit from PICkit™ 5
Voltage Level If the “Power Target Circuit from PICkit 5” check box is checked, select the target VDD that the
Debugger Funcon Summary
If checked, this option will allow the PICkit 5 to power the target circuit. Otherwise an external power supply must be used (see 3.1.2. Target is Powered by the Debugger).
debugger will provide.
9.2.6 Programmer-To-Go
Select the Programmer-To-Go options.
Table 9-6. Programmer-To-Go Opon Category
Image Name The default image name is “<your project name>_ptg,” though you can edit the name if you wish. This will
Send image to tool
Program Device This check box is selected by default. With the box checked, the device connected to the MPLAB PICkit 5 is
9.2.7 Secure Segment
Select and load debugger rmware.
Table 9-7. Secure Segment Opon Category
Segments to be Programmed
9.2.8 Clock
Set the option to use the fast internal RC (FRC) clock for the selected device.
be the folder name on the microSDHC card that contains the appropriate les for Programmer-To-Go.
This check box is selected by default. With the box checked, the PTG image is created and then sent to the microSDHC card in the connected MPLAB® PICkit™ 5.
programmed.
Select one of the following:
1. Full Chip Programming (default).
2. Boot, Secure and General Segments.
3. Secure and General Segments.
4. General Segment Only.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 76
Table 9-8. Clock Opon Category
Use FRC in Debug mode (dsPIC33F and PIC24F/H devices only)
9.2.9 Tool Pack Selecon
Select and load debugger rmware.
Table 9-9. Tool Pack Selecon Category
Tool pack update options Select either Use latest installed tool pack (recommended) or Use specic tool
Specically selected version Press to select which tool pack to use. When pressed, the Select Tool pack dialog
9.2.10 Communicaon
Set the option(s) to use for your device and type of target communication.
Debugger Funcon Summary
When debugging, use the device fast internal RC (FRC) for clocking instead of the oscillator specied for the application. This is useful when the application clock is slow. Checking this check box will let the application run at the slow speed but debug at the faster FRC speed.
Reprogram after changing this setting.
Note: Peripherals that are not frozen will operate at the FRC speed while debugging.
pack.
opens from which to select the version you want.
Table 9-10. Communicaon Opon Category
Interface Select the interface from the available options based on the project device.
Speed (MHz) Enter a speed based on the available range for the interface.
High Voltage Activation Mode This option displays only for AVR® devices with this option. No High Voltage - Default
9.2.10.1 User Power Toggle Design Consideraons
When using the debugger, if the power toggle rise time on Target Vdd is too slow (greater than 10 seconds) the User Power Toggle feature won't work. As an example, for the STK600 using the power switch gives you a too slow rise time but using the VTARGET jumper gives you a fast enough rise time.
For developers creating their own boards, ensure the Vdd rise time is less than 10 seconds.
9.2.10.2 Programming AVR Devices with UPDI
MPLAB PICkit 5 supports using the high-voltage mechanism to activate the AVR Unied Program and Debug Interface (UPDI). On low pin count AVR devices with UPDI, the UPDI pin can be congured as GPIO or RESET by conguring the RSTPINCFG conguration bits. To do further programming, the debugger will have to use a high voltage pulse to reactivate the UPDI interface. When using the high voltage pulse, you must make sure that all circuits connected to the UPDI wire can tolerate a pulse of at least 12V.
setting. Simple High Voltage Pulse - The tool will try to activate the interface by issuing a high voltage pulse. This procedure is safe if the pin is congured as an input. User Power Toggle - In this mode the user will be prompted to toggle power on the target device. Once the tool detects that the power returns it will issue a high voltage pulse before the target device pin is congured, making the activation procedure as gentle as possible. See also UPDI High-Voltage Activation
Information.
GPIO vs. UPDI Operation:
When using a high voltage pulse to reactivate the UPDI interface, the reactivation is only temporary, but it will retain the UPDI functionality until the next reset. After the next reset, the pin will go back to the conguration as specied by the RSTPINCFG conguration bits. To have the pin congured as UPDI after a reset, the user will have to change the RSTPINCFG conguration bits back to UPDI.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 77
It is possible to perform a debug session when the RSTPINCFG is congured to GPIO, but the pin will be temporarily congured as UPDI, and the pin will not operate as a GPIO pin.
Table 9-11. SYSCFG0 RSTPINCFG[1:0] Conguraon Bits
9.2.11 Event Recorder
Specify options for the Event Recorder. Find out more about the Event Recorder in the MPLAB® X IDE User’s Guide (DS-50002027).
Table 9-12. Event Recorder Opon Category
Enable Check to enable Event Recorder
SCVD Files Specify SCVD les to be used in project
Debugger Funcon Summary
Values Function
0x0 GPIO
0x1 UPDI
0x2 RESET
0x3 Reserved
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 78
10. Hardware Specicaon
The hardware and electrical specications of the MPLAB PICkit 5 In-Circuit Debugger system are detailed in this section.
10.1 USB Connector Specicaons
The MPLAB PICkit 5 In-Circuit Debugger is connected to the host computer via a USB Type-C connector, version 2.0 compliant. The USB connector is located on the top of the debugger.
The system is capable of reloading the rmware via the USB interface.
System power is derived from the USB interface. The debugger is classied as a high power system per the USB specication and requires slightly more than 50 mA of power from the USB to function in all operational modes (debugger/programmer).
Note: The MPLAB PICkit 5 In-Circuit Debugger is powered through its USB Type-C connector. The target board is powered from its own supply. Alternatively, the debugger can power the target board only if the target consumes less than 150 mA.
Cable Length – The computer-to-debugger cable, shipped with the debugger kit, is the correct length for proper operation.
Powered Hubs – If you are going to use a USB hub, make sure it is self-powered. Also, USB ports on computer keyboards do not have enough power for the debugger to operate.
Hardware Specicaon
Computer Hibernate/Power-Down Modes – Disable the hibernate or other power saver modes on your computer to ensure proper USB communications with the debugger.
10.2 MPLAB PICkit 5 In-Circuit Debugger
The debugger consists of an internal main board and an external USB Type-C connector and an 8-pin SIL connector. On the front of the debugger enclosure is an indicator light strip and a hidden push button located underneath the logo.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 79
Figure 10-1. MPLAB® PICkit™ 5 In-Circuit Debugger
Hardware Specicaon
1. Lanyard Connection - An opening through the top and side for a lanyard (not included) to be
attached.
2. Emergency Recovery Button - If needed, this recessed button is used for Recovery Boot Mode.
3. USB Type-C Connector - Used to connect the debugger to the computer with the supplied USB
cable.
4. Indicator Light Strip - Displays the operational modes of the debugger (see 10.2.2. Indicator
Lights Strip).
5. Button Area - The area in the center of the shield logo is used for the Programmer-To-Go1 option
and for invoking the bootload mode (see 6.4. How to Invoke the Bootload Mode).
6. Pin 1 Marker - This designates the pin 1 location for proper connector alignment.
7. Programming Connector - The connector is an 8-pin SIL connector (0.100" spacing) that connects
to the target device (see Target Connection Pinouts).
8. MicroSDHC Card Slot - The microSDHC card slot supports a large variety of microSDHC cards
with various speed requirements.
10.2.1 Board Specicaons
The main board includes the following features:
• A 32-bit microcontroller using an Arm Cortex-M7 core which includes memory for holding the program code image. This image is used for programming the on-board Flash device.
• A USB 2.0 interface capable of USB speeds of 480 Mbit/s.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 80
• RN4871 Bluetooth Low Energy Module - Bluetooth v5.0 @ 2.4GHz.
• One LED strip.
Related Links
3.2. PC and Smartphone Connections
10.2.2 Indicator Lights Strip
The expected start-up sequence for the MPLAB PICkit 5 debugger is:
1. Purple - steady on for approximately 4 seconds.
2. Blue - steady on. The debugger is ready.
The indicator light strip has the following signicance.
Table 10-1. Typical Light Strip Descripons
Color Description
Blue Power is connected; debugger in standby.
Orange Power target circuit from PICkit 5 checked.
Green Power target circuit from PICkit 5 unchecked.
Red Lit when the debugger has failed.
The following tables provide descriptions of the indicator lights and bootloader errors.
Hardware Specicaon
Table 10-2. Addional Light Strip Descripons
Color Description
Blue Power is connected; debugger in standby.
Orange Power target circuit from PICkit 5 checked (see Table 9-5).
Green Power target circuit from PICkit 5 unchecked (see Table 9-5).
Purple Bootloader is running.
Yellow Debugger is busy.
Red An operation has failed.
Purple Fast blink indicates the time window for forcing the debugger
Table 10-3. Bootloader Error Descripons
Bootloader Errors Description
Red, slow blink Power accessing the debugger’s serial EEPROM.
Red, fast blink Bootloader API commands cannot be processed.
White, fast blink A runtime exception occurred in the tool rmware.
Related Links
5.4. Using Programmer-To-Go
10.3 Communicaon Hardware
For standard debugger communication with a target, connect the debugger directly to the target. The debugger has an 8-pin SIL connector. If the target has a 6-pin connector, make sure to align the Pin 1 appropriately. An optional adapter board is available for other connections.
into Bootload mode.
Additionally Bluetooth hardware is built-in to support communication with a mobile application for PTG code programming.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 81
10.3.1 Standard Communicaon
The main interface to the target processor is via standard communication. It contains the connections to the high voltage (VPP), VDD sense lines, and clock and data connections that are required for programming and connecting with the target devices.
The VPP high-voltage lines can produce a variable voltage that can swing from 0-14V to satisfy the voltage requirements of the specic emulation processor.
The VDD sense connection draws very little current from the target processor. The actual power comes from the MPLAB PICkit 5 In-Circuit Debugger system, as the VDD sense line is used as a reference only to track the target voltage.
The clock and data connections are interfaces with the following characteristics:
• Clock and data signals are in high-impedance mode (even when no power is applied to the MPLAB PICkit 5 In-Circuit Debugger system).
• Clock and data signals are protected from high voltages caused by faulty target systems, or improper connections.
• Clock and data signals are protected from high current caused from electrical shorts in faulty target systems.
Table 10-4. Electrical Logic Table
Logic Inputs VIH = VDD x 0.7V (min.)
VIL = VDD x 0.3V (max.)
Logic Outputs VDD = 5V VDD = 3V VDD = 2.3V VDD = 1.4V
VOH = 3.8V min. VOH = 2.4V min. VOH = 1.9V min. VOH = 1.0V min.
VOL = 0.55V max. VOL = 0.55V max. VOL = 0.3V max. VOL = 0.1V max.
Hardware Specicaon
Related Links
3.3.1. Target Connection Pinout
10.3.2 Other Communicaon
To support other communication connections, an adapter board is available.
Figure 10-2. Debugger Adapter Board
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 82
Table 10-5. Debugger Adapter Board - Target Connecons
Connector Location on Board Description Compatibility
J1 Top RJ45/11 MPLAB ICD 4/5 ICSP/JTAG
J6 Top 1 x 8 - 100 mil ICSP PICkit 4/5 ICSP
J2 Top 2 x 10 - 100 mil DIP SEGGER JLink JTAG SWD
J3 Top 2 x 7 - 100 mil DIP SEGGER JLink EJTAG
J4 Top 2 x 5 - 50 mil Atmel-ICE JTAG SWD
J7 Top 2 x 5 - 50 mil Atmel-IDE AVR JTAG
J5 Bottom 1 x 6 or 1 x 8 - 50 mil SIP MPLAB ICD 4/5 ICSP/JTAG, PICkit 4/5 ICSP
Related Links
3.3.2.1. Adapter Board Pinout
10.4 Target Board Consideraons
The target board should be powered according to the requirements of the selected device and the application.
Note: Stresses above those listed under "Absolute Maximum Ratings" in the Electrical Characteristics chapter of the device’s data sheet may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or any other conditions, above those indicated in the operation listings of this specication, is not implied. Exposure to maximum rating conditions for extended periods may aect device reliability.
Hardware Specicaon
The debugger does sense target voltage.
Depending on the type of debugger-to-target communication that is used, there are some considerations for target board circuitry:
3.3.6.2. ICSP Target Connection Circuitry
4.7.2.1. ICSP Circuits That Will Prevent a Debug Tool From Functioning
9.2.10.1. User Power Toggle Design Considerations
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 83
11. Revision History
Revision A (April 2023)
Initial release of this document.
Revision History
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 84
12. Support
12.1 Warranty Registraon
Go to www.microchip.com/mysoftware to register your tool online. If you do not already have a myMicrochip account, you can register for an account at that link. If you already have an account, sign in and click on Register Hardware Tool.
Registering your tool online entitles you to receive new product updates. Interim software releases are available at the Microchip website.
12.2 myMicrochip Personalized Nocaon Service
Microchip's personal notication service helps keep customers current on their Microchip products of interest. Subscribers will receive e-mail notication whenever there are changes, updates, revisions or errata related to a specied product family or development tool.
To begin the registration process and select your preferences to receive personalized notications, go to:
www.microchip.com/pcn
A FAQ and registration details are available on the webpage.
Support
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 85
13. Glossary
Absolute Secon
A GCC compiler section with a xed (absolute) address that cannot be changed by the linker.
Absolute Variable/Funcon
A variable or function placed at an absolute address using the OCG compiler’s @ address syntax.
Access Memory
PIC18 Only – Special registers on PIC18 devices that allow access regardless of the setting of the Bank Select Register (BSR).
Access Entry Points
Access entry points provide a way to transfer control across segments to a function which may not be dened at link time. They support the separate linking of boot and secure application segments.
Address
A value that identies a location in memory.
Alphabec Character
Alphabetic characters are those characters that are letters of the Roman alphabet (a, b, …, z, A, B, …, Z).
Glossary
Alphanumeric
Alphanumeric characters are comprised of alphabetic characters and decimal digits (0,1, …, 9).
ANDed Breakpoints
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.
Anonymous Structure
16-bit C Compiler – An unnamed structure.
PIC18 C Compiler – An unnamed structure that is a member of a C union. The members of an anonymous structure may be accessed as if they were members of the enclosing union. For example, in the following code, hi and lo are members of an anonymous structure inside the union caster.
union castaway int intval; struct { char lo; //accessible as caster.lo char hi; //accessible as caster.hi }; } caster;
ANSI
The American National Standards Institute is an organization responsible for formulating and approving standards in the United States.
Applicaon
A set of software and hardware that may be controlled by a PIC® microcontroller.
Archive/Archiver
An archive/library is a collection of relocatable object modules. It is created by assembling multiple source les to object les, and then using the archiver/librarian to combine the object les into one archive/library le. An archive/library can be linked with object modules and other archives/libraries to create executable code.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 86
Glossary
ASCII
The American Standard Code for Information Interchange is a character set encoding that uses 7 binary digits to represent each character. It includes upper and lower case letters, digits, symbols and control characters.
Assembly/Assembler
Assembly is a programming language that describes binary machine code in a symbolic form. An assembler is a language tool that translates assembly language source code into machine code.
Assigned Secon
A GCC compiler section which has been assigned to a target memory block in the linker command
le.
Asynchronously
Multiple events that do not occur at the same time. This is generally used to refer to interrupts that may occur at any time during processor execution.
Asynchronous Smulus
Data generated to simulate external inputs to a simulator device.
Aribute
GCC Characteristics of variables or functions in a C language program, which are used to describe machine-specic properties.
Aribute, Secon
GCC Characteristics of sections, such as “executable,” “read-only,” or “data” that can be specied as ags in the assembler .section directive.
AVR MCUs
AVR® microcontrollers (MCUs) refer to all Microchip AVR 8-bit microcontroller families.
Binary
The base two numbering system that uses the digits 0-1. The rightmost digit counts ones, the next counts multiples of 2, then 22 = 4, etc.
Bookmarks
Use bookmarks to easily locate specic lines in a le.
Select Toggle Bookmarks on the Editor toolbar to add/remove bookmarks. Click other icons on this toolbar to move to the next or previous bookmark.
C/C++
C is a general-purpose programming language which features economy of expression, modern control ow and data structures, as well as a rich set of operators. C++ is the object-oriented version of C.
Calibraon Memory
A special function register or registers used to hold values for calibration of a PIC microcontroller on-board RC oscillator or other device peripherals.
Central Processing Unit
The part of a device that is responsible for fetching the correct instruction for execution, decoding that instruction, and then executing that instruction. When necessary, it works in conjunction with the arithmetic logic unit (ALU) to complete the execution of the instruction. It controls the program memory address bus, the data memory address bus, and accesses to the stack.
Clean
Clean removes all intermediary project les, such as object, hex and debug les, for the active project. These les are recreated from other les when a project is built.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 87
Glossary
COFF
Common Object File Format. An object le of this format contains machine code, debugging and other information.
Command Line Interface
A means of communication between a program and its user based solely on textual input and output.
Compiled Stack
A region of memory managed by the compiler in which variables are statically allocated space. It replaces a software or hardware stack when such mechanisms cannot be eciently implemented on the target device.
Compiler
A program that translates a source le written in a high-level language into machine code.
Condional Assembly
Assembly language code that is included or omitted based on the assembly-time value of a specied expression.
Condional Compilaon
The act of compiling a program fragment only if a certain constant expression, specied by a preprocessor directive, is true.
Conguraon Bits
Special-purpose bits programmed to set PIC MCU and dsPIC DSC modes of operation. A Conguration bit may or may not be preprogrammed.
Constant
Represents an immediate value such as a denition through the C code #dene directive or the assembly .equ directive.
Control Direcves
Directives in assembly language code that cause code to be included or omitted based on the assembly-time value of a specied expression.
CPU
See Central Processing Unit.
Cross Reference File
A le that references a table of symbols and a list of les that references the symbol. If the symbol is dened, the rst le listed is the location of the denition. The remaining les contain references to
the symbol.
Data Direcves
Data directives are those that control the assembler’s allocation of program or data memory and provide a way to refer to data items symbolically; that is, by meaningful names.
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.
Debug/Debugger
See ICE/ICD.
Debugging Informaon
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.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 88
Glossary
Deprecated Features
Features that are still supported for legacy reasons, but will eventually be phased out and no longer used.
Device Programmer
A tool used to program electrically programmable semiconductor devices such as microcontrollers.
Digital Signal Processing\Digital Signal Processor
Digital signal processing (DSP) is the computer manipulation of digital signals, commonly analog signals (sound or image) which have been converted to digital form (sampled). A digital signal processor is a microprocessor that is designed for use in digital signal processing.
Direcves
Statements in source code that provide control of the language tool’s operation.
Download
Download is the process of sending data from a host to another device, such as an emulator, programmer or target board.
dsPIC DSCs
dsPIC® digital signal controllers (DSCs) refer to the Microchip family of microcontrollers with digital signal processing capability.
DWARF
Debug With Arbitrary Record Format. DWARF is a debug information format for ELF les.
EEPROM
Electrically Erasable Programmable Read Only Memory. A special type of PROM that can be erased electrically. Data is written or erased one byte at a time. EEPROM retains its contents even when power is turned o.
ELF
Executable and Linking Format. An object le of this format contains machine code. Debugging and other information is specied in with DWARF. ELF/DWARF provide better debugging of optimized code than COFF.
Emulaon/Emulator
See ICE/ICD.
Endianness
The ordering of bytes in a multi-byte object.
Environment
MPLAB PM3 – A folder containing les on how to program a device. This folder can be transferred to a SD/MMC card.
Epilogue
A portion of compiler-generated code that is responsible for deallocating stack space, restoring registers and performing any other machine-specic requirement specied in the runtime model. This code executes after any user code for a given function, immediately prior to the function return.
EPROM
Erasable Programmable Read Only Memory. A programmable read-only memory that can be erased usually by exposure to ultraviolet radiation.
Error/Error File
An error reports a problem that makes it impossible to continue processing your program. When possible, an error identies the source le name and line number where the problem is apparent. An error le contains error messages and diagnostics generated by a language tool.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 89
Glossary
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.
Executable Code
Software that is ready to be loaded for execution.
Export
Send data out of the MPLAB X IDE in a standardized format.
Expressions
Combinations of constants and/or symbols separated by arithmetic or logical operators.
Extended Microcontroller Mode
In extended microcontroller mode, on-chip program memory as well as external memory is available. Execution automatically switches to external if the program memory address is greater than the internal memory space of the PIC18 device.
Extended Mode (PIC18 MCUs)
In Extended mode, the compiler will utilize the extended instructions (i.e., ADDFSR, ADDULNK, CALLW, MOVSF, MOVSS, PUSHL, SUBFSR, and SUBULNK) and the indexed with literal oset addressing.
External Label
A label that has external linkage.
External Linkage
A function or variable has external linkage if it can be referenced from outside the module in which it is dened.
External Symbol
A symbol for an identier which has external linkage. This may be a reference or a denition.
External Symbol Resoluon
A process performed by the linker in which external symbol denitions from all input modules are collected in an attempt to resolve all external symbol references. Any external symbol references which do not have a corresponding denition cause a linker error to be reported.
External Input Line
An external input signal logic probe line (TRIGIN) for setting an event based upon external signals.
External RAM
O-chip Read/Write memory.
Fatal Error
An error that halts compilation immediately. No further messages will be produced.
File Registers
On-chip data memory, including General Purpose Registers (GPRs) and Special Function Registers (SFRs).
Filter
Determine by selection what data is included/excluded in a trace display or data le.
Fixup
The process of replacing object le symbolic references with absolute addresses after relocation by the linker.
Flash
A type of EEPROM where data is written or erased in blocks instead of bytes.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 90
Glossary
FNOP
Forced No Operation. A forced NOP cycle is the second cycle of a two-cycle instruction. Since the PIC microcontroller architecture is pipelined, it prefetches the next instruction in the physical address space while it is executing the current instruction. However, if the current instruction changes the program counter, this prefetched instruction is explicitly ignored, causing a forced NOP cycle.
Frame Pointer
A pointer that references the location on the stack that separates the stack-based arguments from the stack-based local variables. Provides a convenient base from which to access local variables and other values for the current function.
Free-Standing
An implementation that accepts any strictly conforming program that does not use complex types and in which the use of the features specied in the library clause (ANSI ‘89 standard clause
7) is conned to the contents of the standard headers <float.h>, <iso646.h>, <limits.h>,
<stdarg.h>, <stdbool.h>, <stddef.h>, and <stdint.h>.
GPR
General Purpose Register. The portion of device data memory (RAM) available for general use.
Halt
A stop of program execution. Executing Halt is the same as stopping at a breakpoint.
Heap
An area of memory used for dynamic memory allocation where blocks of memory are allocated and freed in an arbitrary order determined at run-time.
Hex Code/Hex File
Hex code is executable instructions stored in a hexadecimal format code. Hex code is contained in a hex le.
Hexadecimal
The base 16 numbering system that uses the digits 0-9 plus the letters A-F (or a-f). The digits A-F represent hexadecimal digits with values of (decimal) 10 to 15. The rightmost digit counts ones, the next counts multiples of 16, then 162 = 256, etc.
High Level Language
A language for writing programs that is further removed from the processor than assembly.
ICE/ICD
In-Circuit Emulator/In-Circuit Debugger: A hardware tool that debugs and programs a target device. An emulator has more features than an debugger, such as trace.
In-Circuit Emulation/In-Circuit Debug: The act of emulating or debugging with an in-circuit emulator or debugger.
-ICE/-ICD: A device (MCU or DSC) with on-board in-circuit emulation or debug circuitry. This device is
always mounted on a header board and used to debug with an in-circuit emulator or debugger.
ICSP
In-Circuit Serial Programming. A method of programming Microchip embedded devices using serial communication and a minimum number of device pins.
IDE
Integrated Development Environment, as in MPLAB X IDE.
Idener
A function or variable name.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 91
Glossary
IEEE
Institute of Electrical and Electronics Engineers.
Import
Bring data into the MPLAB X IDE from an outside source, such as from a hex le.
Inialized Data
Data which is dened with an initial value. In C,
int myVar=5;
denes a variable, which will reside in an initialized data section.
Instrucon Set
The collection of machine language instructions that a particular processor understands.
Instrucons
A sequence of bits that tells a central processing unit to perform a particular operation and can contain data to be used in the operation.
Internal Linkage
A function or variable has internal linkage if it can not be accessed from outside the module in which it is dened.
Internaonal Organizaon for Standardizaon
An organization that sets standards in many businesses and technologies, including computing and communications. Also known as ISO.
Interrupt
A signal to the CPU that suspends the execution of a running application and transfers control to an Interrupt Service Routine (ISR) so that the event may be processed. Upon completion of the ISR, normal execution of the application resumes.
Interrupt Handler
A routine that processes special code when an interrupt occurs.
Interrupt Service Request (IRQ)
An event which causes the processor to temporarily suspend normal instruction execution and to start executing an interrupt handler routine. Some processors have several interrupt request events allowing dierent priority interrupts.
Interrupt Service Roune (ISR)
Language tools: A function that handles an interrupt.
MPLAB X IDE: 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.
Interrupt Vector
Address of an interrupt service routine or interrupt handler.
L-value
An expression that refers to an object that can be examined and/or modied. An l-value expression is used on the left-hand side of an assignment.
Latency
The time between an event and its response.
Library/Librarian
See Archive/Archiver.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 92
Glossary
Linker
A language tool that combines object les and libraries to create executable code, resolving references from one module to another.
Linker Script Files
Linker script les are the command les of a linker. They dene linker options and describe available memory on the target platform.
Lisng Direcves
Listing directives are those directives that control the assembler listing le format. They allow the specication of titles, pagination and other listing control.
Lisng File
A listing le is an ASCII text le that shows the machine code generated for each C source statement, assembly instruction, assembler directive, or macro encountered in a source le.
Lile Endian
A data ordering scheme for multi-byte data, whereby the least signicant byte is stored at the lower addresses.
Local Label
A local label is one that is dened inside a macro with the LOCAL directive. These labels are particular to a given instance of a macro’s instantiation. In other words, the symbols and labels that are declared as local are no longer accessible after the ENDM macro is encountered.
Machine Code
The representation of a computer program that is actually read and interpreted by the processor. A program in binary machine code consists of a sequence of machine instructions (possibly interspersed with data). The collection of all possible instructions for a particular processor is known as its “instruction set.”
Machine Language
A set of instructions for a specic central processing unit, designed to be usable by a processor without being translated.
Macro
Macro instruction. An instruction that represents a sequence of instructions in abbreviated form.
Macro Direcves
Directives that control the execution and data allocation within macro body denitions.
Makele
Export to a le the instructions to Make the project. Use this le to Make your project outside of MPLAB X IDE, i.e., with a make.
Make Project
A command that rebuilds an application, recompiling only those source les that have changed since the last complete compilation.
MCU
Microcontroller Unit. An abbreviation for microcontroller. Also uC.
Memory Model
For C compilers, a representation of the memory available to the application. For the PIC18 C compiler, a description that species the size of pointers that point to program memory.
Message
Text displayed to alert you to potential problems in language tool operation. A message will not stop operation.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 93
Glossary
Microcontroller
A highly integrated chip that contains a CPU, RAM, program memory, I/O ports and timers.
Microcontroller Mode
One of the possible program memory congurations of PIC18 microcontrollers. In microcontroller mode, only internal execution is allowed. Thus, only the on-chip program memory is available in microcontroller mode.
Microprocessor Mode
One of the possible program memory congurations of 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.
Module
The preprocessed output of a source le after preprocessor directives have been executed. Also known as a translation unit.
MPLAB® X IDE
Microchip’s Integrated Development Environment. comes with an editor, project manager and simulator.
MPLAB X Simulator
Microchip’s simulator that works with in support of Microchip MCU, DSC and MPU devices.
MPLAB XC C Compilers
Microchip’s family of C and C++ compilers comprising of the MPLAB XC8 C compiler (8-bit device support), MPLAB XC16 C compiler (16-bit device support) and MPLAB XC32 C/C++ compiler (32-bit support.)
MPLAB Xpress IDE
Microchip’s Integrated Development Environment in the Cloud. MPLAB Xpress comes with an editor, project manager and simulator.
MPU
Microprocessor Unit. An abbreviation for microprocessor.
MRU
Most Recently Used. Refers to les and windows available to be selected from main pull down menus.
Nave Data Size
For Native trace, the size of the variable used in a Watches window must be of the same size as the selected device’s data memory: bytes for PIC18 devices and words for 16-bit devices.
Nesng Depth
The maximum level to which macros can include other macros.
Node
project component.
Non-Extended Mode (PIC18 MCUs)
In Non-Extended mode, the compiler will not utilize the extended instructions nor the indexed with literal oset addressing.
Non Real Time
Refers to the processor at a breakpoint or executing single-step instructions or being run in simulator mode.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 94
Glossary
Non-Volale Storage
A storage device whose contents are preserved when its power is o.
NOP
No Operation. An instruction that has no eect when executed except to advance the program counter.
Object Code/Object File
Object code is the machine code generated by an assembler or compiler. An object le is a le containing machine code and possibly debug information. It may be immediately executable or it may be relocatable, requiring linking with other object les, e.g., libraries, to produce a complete executable program.
Object File Direcves
Directives that are used only when creating an object le.
Octal
The base 8 number system that only uses the digits 0-7. The rightmost digit counts ones, the next digit counts multiples of 8, then 82 = 64, etc.
O-Chip Memory
O-chip memory refers to the memory selection option for the PIC18 device where memory may reside on the target board, or where all program memory may be supplied by the emulator. The Memory tab accessed from Options>Development Mode provides the O-Chip Memory selection dialog box.
Opcodes
Operational Codes. See Mnemonics.
Operators
Symbols, like the plus sign ‘+’ and the minus sign ‘-’, that are used when forming well-dened expressions. Each operator has an assigned precedence that is used to determine order of evaluation.
OTP
One Time Programmable. EPROM devices that are not in windowed packages. Since EPROM needs ultraviolet light to erase its memory, only windowed devices are erasable.
Pass Counter
A counter that decrements each time an event (such as the execution of an instruction at a particular address) occurs. When the pass count value reaches zero, the event is satised. You can assign the Pass Counter to break and trace logic, and to any sequential event in the complex trigger dialog.
PC
Personal Computer or Program Counter.
PC Host
Any PC running a supported Windows operating system.
Persistent Data
Data that is never cleared or initialized. Its intended use is so that an application can preserve data across a device Reset.
Phantom Byte
An unimplemented byte in the dsPIC architecture that is used when treating the 24-bit instruction word as if it were a 32-bit instruction word. Phantom bytes appear in dsPIC hex les.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 95
Glossary
PIC MCUs
PIC® microcontrollers (MCUs) refers to all Microchip PIC 8-, 16-, and 32-bit microcontroller families.
Plug-ins
The has both built-in components and plug-in modules to congure the system for a variety of software and hardware tools. Several plug-in tools may be found under the Tools menu.
Pod
The enclosure for an in-circuit emulator or debugger. Other names are Puck, if the enclosure is round, and Probe, not be confused with logic probes.
Power-on-Reset Emulaon
A software randomization process that writes random values in data RAM areas to simulate uninitialized values in RAM upon initial power application.
Pragma
A directive that has meaning to a specic compiler. Often a pragma is used to convey implementation-dened information to the compiler.
Precedence
Rules that dene the order of evaluation in expressions.
Producon Programmer
A production programmer is a programming tool that has resources designed in to program devices rapidly. It has the capability to program at various voltage levels and completely adheres to the programming specication. Programming a device as fast as possible is of prime importance in a production environment where time is of the essence as the application circuit moves through the assembly line.
Prole
For MPLAB X 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 Counter Unit
16-bit assembler – A conceptual representation of the layout of program memory. The program counter increments by 2 for each instruction word. In an executable section, 2 program counter units are equivalent to 3 bytes. In a read-only section, 2 program counter units are equivalent to 2 bytes.
Program Memory
: The memory area in a device where instructions are stored. Also, the memory in the debugger, emulator or simulator containing the downloaded target application rmware.
16-bit assembler/compiler: The memory area in a device where instructions are stored.
Project
A project contains the les needed to build an application (source code, linker script les, etc.) along with their associations to various build tools and build options.
Prologue
A portion of compiler-generated code that is responsible for allocating stack space, preserving registers and performing any other machine-specic requirement specied in the run-time model. This code executes before any user code for a given function.
Prototype System
A term referring to a user's target application, or target board.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 96
Glossary
Psect
The OCG equivalent of a GCC section, short for program section. A block of code or data which is treated as a whole by the linker.
PWM Signals
Pulse Width Modulation Signals. Certain PIC MCU devices have a PWM peripheral.
Qualier
An address or an address range used by the Pass Counter or as an event before another operation in a complex trigger.
Radix
The number base, hex, or decimal, used in specifying an address.
RAM
Random Access Memory (Data Memory). Memory in which information can be accessed in any order.
Raw Data
The binary representation of code or data associated with a section.
Read Only Memory
Memory hardware that allows fast access to permanently stored data but prevents addition to or modication of the data.
Real Time
When an in-circuit emulator or debugger is released from the halt state, the processor runs in Real Time mode and behaves exactly as the normal chip would behave. In Real Time mode, the real time trace buer of an emulator is enabled and constantly captures all selected cycles, and all break logic is enabled. In an in-circuit emulator or debugger, the processor executes in real time until a valid breakpoint causes a halt, or until the user halts the execution.
In the simulator, real time simply means execution of the microcontroller instructions as fast as they can be simulated by the host CPU.
Recursive Calls
A function that calls itself, either directly or indirectly.
Recursion
The concept that a function or macro, having been dened, can call itself. Great care should be taken when writing recursive macros; it is easy to get caught in an innite loop where there will be no exit from the recursion.
Re-entrant
A function that may have multiple, simultaneously active instances. This may happen due to either direct or indirect recursion or through execution during interrupt processing.
Relaxaon
The process of converting an instruction to an identical, but smaller instruction. This is useful for saving on code size. MPLAB XC16 currently knows how to relax a CALL instruction into an RCALL instruction. This is done when the symbol that is being called is within +/- 32k instruction words from the current instruction.
Relocatable
An object whose address has not been assigned to a xed location in memory.
Relocatable Secon
16-bit assembler – A section whose address is not xed (absolute). The linker assigns addresses to relocatable sections through a process called relocation.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 97
Glossary
Relocaon
A process performed by the linker in which absolute addresses are assigned to relocatable sections and all symbols in the relocatable sections are updated to their new addresses.
ROM
Read Only Memory (Program Memory). Memory that cannot be modied.
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.
Run-me Model
Describes the use of target architecture resources.
Run-me Watch
A Watches window where the variables change in as the application is run. See individual tool documentation to determine how to set up a run-time watch. Not all tools support run-time watches.
SAM MCUs/MPUs
SAM microcontrollers (MCUs) and microprocessors (MPUs) refer to all Microchip SAM 32-bit microcontroller and microprocessor families.
Scenario
For MPLAB X simulator, a particular setup for stimulus control.
Secon
The GCC equivalent of an OCG psect. A block of code or data which is treated as a whole by the linker.
Secon Aribute
A GCC characteristic ascribed to a section (e.g., an access section).
Sequenced Breakpoints
Breakpoints that occur in a sequence. Sequence execution of breakpoints is bottom-up; the last breakpoint in the sequence occurs rst.
Serialized Quick Turn Programming
Serialization allows you to program a serial number into each microcontroller device that the Device Programmer programs. This number can be used as an entry code, password or ID number.
Shell
The MPASM assembler shell is a prompted input interface to the macro assembler. There are two MPASM assembler shells: one for the DOS version and one for the Windows operating system version.
Simulator
A software program that models the operation of devices.
Single Step
This command steps though code, one instruction at a time. After each instruction, updates register windows, watch variables, and status displays so you can analyze and debug instruction execution. You can also single step C compiler source code, but instead of executing single instructions, will execute all assembly level instructions generated by the line of the high level C statement.
Skew
The information associated with the execution of an instruction appears on the processor bus at dierent times. For example, the executed opcodes appear on the bus as a fetch during the execution of the previous instruction; the source data address, value, and destination data address
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 98
Glossary
appear when the opcodes are actually executed; and the destination data value appears when the next instruction is executed. The trace buer captures the information that is on the bus at one instance. Therefore, one trace buer entry will contain execution information for three instructions. The number of captured cycles from one piece of information to another for a single instruction execution is referred to as the skew.
Skid
When a hardware breakpoint is used to halt the processor, one or more additional instructions may be executed before the processor halts. The number of extra instructions executed after the intended breakpoint is referred to as the skid.
Source Code
The form in which a computer program is written by the programmer. Source code is written in a formal programming language which can be translated into machine code or executed by an interpreter.
Source File
An ASCII text le containing source code.
Special Funcon Registers (SFRs)
The portion of data memory (RAM) dedicated to registers that control I/O processor functions, I/O status, timers or other modes or peripherals.
SQTP
See Serialized Quick Turn Programming.
Stack, Hardware
Locations in PIC microcontroller where the return address is stored when a function call is made.
Stack, Soware
Memory used by an application for storing return addresses, function parameters, and local variables. This memory is dynamically allocated at run-time by instructions in the program. It allows for re-entrant function calls.
Stack, Compiled
A region of memory managed and allocated by the compiler in which variables are statically assigned space. It replaces a software stack when such mechanisms cannot be eciently implemented on the target device. It precludes re-entrancy.
Stac RAM or SRAM
Static Random Access Memory. Program memory you can read/write on the target board that does not need refreshing frequently.
Status Bar
The Status Bar is located on the bottom of the MPLAB X IDE window and indicates such current information as cursor position, development mode and device, and active tool bar.
Step Into
This command is the same as Single Step. Step Into (as opposed to Step Over) follows a CALL instruction into a subroutine.
Step Over
Step Over allows you to debug code without stepping into subroutines. When stepping over a CALL instruction, the next breakpoint will be set at the instruction after the CALL. If for some reason the subroutine gets into an endless loop or does not return properly, the next breakpoint will never be reached. The Step Over command is the same as Single Step except for its handling of CALL instructions.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 99
Glossary
Step Out
Step Out allows you to step out of a subroutine which you are currently stepping through. This command executes the rest of the code in the subroutine and then stops execution at the return address to the subroutine.
Smulus
Input to the simulator, i.e., data generated to exercise the response of simulation to external signals. Often the data is put into the form of a list of actions in a text le. Stimulus may be asynchronous, synchronous (pin), clocked and register.
Stopwatch
A counter for measuring execution cycles.
Storage Class
Determines the lifetime of the memory associated with the identied object.
Storage Qualier
Indicates special properties of the objects being declared (e.g., const).
Symbol
A symbol is a general purpose mechanism for describing the various pieces which comprise a program. These pieces include function names, variable names, section names, le names, struct/ enum/union tag names, etc. Symbols in MPLAB X IDE refer mainly to variable names, function names and assembly labels. The value of a symbol after linking is its value in memory.
Symbol, Absolute
Symbols can be made absolute by placing them at a specic address in memory, e.g., int scanMode __at(0x200);
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 Applicaon
Software residing on the target board.
Target Board
The circuitry and programmable device that makes up the target application.
Target Processor
The microcontroller device on the target application board.
Template
Lines of text that you build for inserting into your les at a later time. The MPLAB Editor stores templates in template les.
Toolbar
A row or column of icons that you can click on to execute functions.
Trace
An emulator or simulator function that logs program execution. The emulator logs program execution into its trace buer which is uploaded to the trace window.
Trace Memory
Trace memory contained within the emulator. Trace memory is sometimes called the trace buer.
User Guide
© 2023 Microchip Technology Inc. and its subsidiaries
DS-50003525A - 100
Loading...