Microchip Technology MPLAB PICkit 4 User manual

MPLAB® PICkit™ 4 In-Circuit Debugger User's Guide
Notice to Customers
Important:
All documentation becomes dated and this manual is no exception. Microchip tools and documentation are
constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ
from those in this document. Please refer to our website (www.microchip.com) to obtain the latest
documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each page, in front
of the page number. The numbering convention for the DS number is “DSXXXXXA,” where “XXXXX” is the
document number and “A” is the revision level of the document.
For the most up-to-date information on development tools, see the MPLAB® X IDE online help. Select the
Help menu and then Topics, to open a list of available online help files.
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 1

Table of Contents
Notice to Customers.......................................................................................................................................1
1. Introduction............................................................................................................................................. 4
1.1. Document Layout......................................................................................................................... 4
1.2. Conventions Used in This Guide..................................................................................................4
1.3. Recommended Reading...............................................................................................................5
2. About the Debugger................................................................................................................................ 7
2.1. MPLAB PICkit 4 In-Circuit Debugger Description........................................................................ 7
2.2. MPLAB PICkit 4 In-Circuit Debugger Advantages....................................................................... 7
2.3. MPLAB PICkit 4 In-Circuit Debugger Components...................................................................... 8
2.4. MPLAB PICkit 4 Block Diagram................................................................................................... 9
3. Operation.............................................................................................................................................. 10
3.1. Debugger to Target Communication...........................................................................................10
3.2. Target Communication Connections...........................................................................................11
3.3. Debugging..................................................................................................................................14
3.4. Requirements for Debugging..................................................................................................... 15
3.5. Programming..............................................................................................................................17
3.6. Resources Used by the Debugger............................................................................................. 17
4. Debugger Usage................................................................................................................................... 18
4.1. Installation and Setup.................................................................................................................18
4.2. Debug Tutorial............................................................................................................................18
4.3. Quick Debug/Program Reference.............................................................................................. 18
4.4. Debugger Limitations................................................................................................................. 19
4.5. Common Debug Features.......................................................................................................... 19
4.6. Connecting the Target Board......................................................................................................20
4.7. Setting Up the Target Board....................................................................................................... 20
4.8. Setting Up MPLAB X IDE........................................................................................................... 21
4.9. Starting and Stopping Debugging.............................................................................................. 21
4.10. Viewing Processor Memory and Files........................................................................................ 22
4.11. Breakpoints and Stopwatch........................................................................................................22
5. MPLAB PICkit 4 Programmer-To-Go.................................................................................................... 24
5.1. Power Requirements for Programmer-To-Go.............................................................................24
5.2. Limitations for Programmer-To-Go............................................................................................. 25
5.3. Setting up PICkit 4 for Programmer-To-Go Mode...................................................................... 26
5.4. Using Programmer-To-Go.......................................................................................................... 30
5.5. Exiting Programmer-To-Go Mode...............................................................................................31
6. Troubleshooting.....................................................................................................................................32
6.1. Some Questions to Answer First................................................................................................32
6.2. Top Reasons Why You Can't Debug.......................................................................................... 32
6.3. Other Things to Consider........................................................................................................... 33
7. Frequently Asked Questions................................................................................................................. 36
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 2

7.1. How Does it Work?.....................................................................................................................36
7.2. What's Wrong?...........................................................................................................................36
8. Error Messages.....................................................................................................................................38
8.1. Types of Error Messages........................................................................................................... 38
8.2. General Corrective Actions........................................................................................................ 47
9. Engineering Technical Notes (ETNs).................................................................................................... 49
10. Debugger Function Summary............................................................................................................... 50
10.1. Debugger Selection and Switching............................................................................................ 50
10.2. Debugger Options Selection...................................................................................................... 50
11. Hardware Specification......................................................................................................................... 56
11.1. USB Connector.......................................................................................................................... 56
11.2. MPLAB PICkit 4 In-Circuit Debugger......................................................................................... 56
11.3. Communication Hardware..........................................................................................................58
11.4. Target Board Considerations......................................................................................................61
12. Revision History.................................................................................................................................... 63
12.1. Revision A (May 2018)............................................................................................................... 63
12.2. Revision B (August 2018)...........................................................................................................63
12.3. Revision C (October 2018).........................................................................................................63
12.4. Revision D (January 2020).........................................................................................................63
13. Support..................................................................................................................................................64
13.1. Warranty Registration.................................................................................................................64
13.2. myMicrochip Personalized Notification Service..........................................................................64
14. Glossary................................................................................................................................................ 65
The Microchip Web Site............................................................................................................................... 83
Customer Change Notification Service........................................................................................................ 83
Customer Support........................................................................................................................................ 83
Microchip Devices Code Protection Feature................................................................................................ 83
Legal Notice................................................................................................................................................. 84
Trademarks.................................................................................................................................................. 84
Quality Management System Certified by DNV........................................................................................... 84
Worldwide Sales and Service.......................................................................................................................85
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 3

1. Introduction
This chapter contains general information that will be useful to know before using the MPLAB® PICkit™ 4 In-Circuit
Debugger.
1.1 Document Layout
This document describes how to use the MPLAB PICkit 4 In-Circuit Debugger as a development tool to emulate and
debug firmware on a target board, as well as how to program devices. The document is organized as follows:
•2. About the Debugger – What the MPLAB PICkit 4 In-Circuit Debugger is and how it can help you develop your
application.
•3. Operation – The theory of MPLAB PICkit 4 In-Circuit Debugger operation. Explains configuration options.
•4. Debugger Usage – A description of basic debug features available in MPLAB X IDE when the MPLAB PICkit
4 In-Circuit Debugger is chosen as the debug tool. This includes the debug features for breakpoints and
stopwatch.
•6. Troubleshooting – The first things you should try if you are having issues with debugger operation.
•7. Frequently Asked Questions – A list of frequently asked questions, useful for troubleshooting.
•8. Error Messages – A list of error messages and suggested resolutions.
•10. Debugger Function Summary – A summary of debugger functions available in MPLAB X IDE when the
MPLAB PICkit 4 In-Circuit Debugger is chosen as the debug or program tool.
•11. Hardware Specification – The hardware and electrical specifications of the debugger system.
•Revision History - A summary of changes to the document and when they were made.
1.2 Conventions Used in This Guide
This manual uses the following documentation conventions:
Table 1-1. Documentation Conventions
Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB® IDE 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 Enable Programmer
Quotes A field name in a window or dialog “Save project before build”
Underlined, italic text with right
angle bracket
A menu path File>Save
Bold characters A dialog button Click OK
A tab Click the Power tab
N‘Rnnnn A number in verilog format, where N is
the total number of digits, R is the
radix and n is a digit.
4‘b0010, 2‘hF1
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Introduction
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 4

...........continued
Description Represents Examples
Plain Courier New Sample source code #define START
Filenames autoexec.bat
File paths c:\mcc18\h
Keywords _asm, _endasm, static
Command-line options -Opa+, -Opa-
Bit values 0, 1
Constants 0xFF, ‘A’
Italic Courier New A variable argument file.o, where file can be any valid
filename
Square brackets [ ] Optional arguments mcc18 [options] file
[options]
Curly brackets and pipe
character: { | }
Choice of mutually exclusive
arguments; an OR selection
errorlevel {0|1}
Ellipses... Replaces repeated text var_name [, var_name...]
Represents code supplied by user void main (void)
{ ...
}
1.3 Recommended Reading
This user's guide describes how to use MPLAB PICkit 4 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 first! This document contains important information about operational issues that should be
considered when using the MPLAB PICkit 4 In-Circuit Debugger with your target design.
MPLAB X IDE Online Help
This is an essential document to be used with any Microchip hardware tool.
This is an extensive help file 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
configuration bits, setting breakpoints, programming a device, etc. This help file is generally more up-to-date than the
printable PDF of the user’s guide (DS50002027) available as a free download at https://www.microchip.com/mplabx/.
Release Notes for MPLAB PICkit 4 In-Circuit Debugger
For the latest information on using MPLAB PICkit 4 In-Circuit Debugger, read the notes under “Release Notes and
Support Documentation” on the MPLAB X IDE Start Page. The release notes contain update information and known
issues that may not be included in this user’s guide.
MPLAB PICkit 4 Quick Start Guide Poster (DS50002721)
This poster shows you how to connect the hardware and install the software for the MPLAB PICkit 4 In-Circuit
Debugger using standard communications and a target board.
MPLAB PICkit 4 In-Circuit Debugger Online Help File
A comprehensive help file for the debugger is included with MPLAB X IDE. Usage, troubleshooting and hardware
specifications are covered. This help file may be more up-to-date than the printed documentation.
Processor Extension Pak and Header Specification (DS50001292)
Introduction
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 5

This booklet describes how to install and use headers. Headers are used to better debug selected devices, without
the loss of pins or resources. See also the PEP and Header online Help file.
Introduction
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 6

2. About the Debugger
An overview of the MPLAB® PICkit™ 4 In-Circuit Debugger system is provided here.
2.1 MPLAB PICkit 4 In-Circuit Debugger Description
The MPLAB PICkit 4 In-Circuit Debugger (PG164140) allows fast and easy debugging and programming of Microchip
PIC®, dsPIC®, AVR, SAM and CEC (Arm® Cortex®-M7-based) microcontrollers using the powerful graphical user
interface of MPLAB X Integrated Development Environment (IDE).
The MPLAB PICkit 4 is connected to the design engineer's computer using a high-speed 2.0 USB 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.
The MPLAB PICkit 4 programs faster than its predecessor (PICkit 3) and comes ready to support PIC, dsPIC, AVR,
SAM and CEC MCU devices. Along with a wider target voltage, the MPLAB PICkit 4 supports advanced interfaces
such as 4-wire JTAG, Serial Wire Debug (SWD), and streaming Data Gateway1, while being backward compatible for
demo boards, headers and target systems using 2-wire JTAG and ICSP. The MPLAB PICkit 4 also has a unique
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.
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 modified by the MPLAB X IDE interface.
The MPLAB PICkit 4 In-Circuit Debugger is compatible with any of these platforms:
• Microsoft Windows® 7 or later
• Linux®
• macOS™
The MPLAB PICkit 4 In-Circuit Debugger was developed for debugging embedded processors with rich debug
facilities which are different 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.
• Faster programming times.
In addition to debugger functions, the MPLAB PICkit 4 In-Circuit Debugger system also may be used as a device
production programmer.
Note: 1 The functionality will be available in a future firmware update of the product through MPLAB X IDE.
2.2 MPLAB PICkit 4 In-Circuit Debugger Advantages
The MPLAB PICkit 4 In-Circuit Debugger system provides the following advantages:
Features/Capabilities:
• Connects to computer via high-speed USB 2.0 (480 Mbits/s) cable.
• An 8-pin SIL programming connector and the option to use various interfaces.
• Programs devices using MPLAB X IDE or MPLAB IPE.
• Supports multiple hardware and software breakpoints, stopwatch, and source code file debugging.
• Debugs your application on your own hardware in real time.
• Sets breakpoints based on internal events.
About the Debugger
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 7

• Monitors internal file registers.
• Debugs at full speed.
• Configures pin drivers.
• Field-upgradeable through an MPLAB X IDE firmware download.
• Adds new device support and features by installing the latest version of MPLAB X IDE (available as a free
download at https://www.microchip.com/mplabx/).
• Indicates debugger status via the indicator light strip.
• Operates within a temperature range of 0-70 degrees Celsius.
Performance/Speed:
• More and faster memory.
• A Real-Time Operating System (RTOS).
• No firmware 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 from 1.2 to 2.8V for low voltage program mode entry and 2.8 to 5.0V for low
voltage and high voltage program mode entry.
• Safely power up to 1A with an optional 9V DC power supply.
• 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 flexibility to overcome target board design issues.
• CE and RoHS compliant – conforms to industry standards.
2.3 MPLAB PICkit 4 In-Circuit Debugger Components
The components of the MPLAB PICkit 4 In-Circuit Debugger system are:
• A rectangular-shaped MPLAB PICkit 4 unit housed in a durable, black plastic case with a brushed metal top
which is accented with an indicator light strip, button area.
• A Micro-B USB connector.
• MicroSD card slot.
• Emergency recovery button.
• Lanyard connector.
• A Micro-B USB cable to provide communications between the debugger and a computer, as well as providing
power to the debugger.
Figure 2-1. Basic Debugger System
Additional hardware and accessories may be ordered separately from Microchip Direct (https://
www.microchipdirect.com).
About the Debugger
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 8

• (Part Number AC002015) - a connectivity board that supports JTAG, SWD and ICSP protocols, useful for
debugging legacy AVR® with MPLAB PICkit 4 (https://www.microchipdirect.com/product/search/all/AC102015).
• Transition sockets.
• ICD headers.
• MPLAB processor extension paks.
2.4 MPLAB PICkit 4 Block Diagram
USB HS
SYSTEM
(SIE)
(I2C)
RGB LED
uSD CARD (HSMCI)PGM
IDENTIFIERS
(SPI)
SCALERS
LOGIC
BUFFER
VDD MONITOR
VPP MONITOR
VDD
GEN
VPP
GEN
VPP ON
VPP AN0
OVERCURRENT
(SPI)
VDD ON
VDD AN1
OVERCURRENT
ICSP SIP
VOLTAGE
REFERENCE VREF
BOOST
+5.5v SWITCHER
DIST
PWR +5v
+3.3V
VUSB
+5.5v
MICRO
SAME70
TVDD
About the Debugger
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 9

3. Operation
A simplified theory of operation of the MPLAB PICkit 4 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.
3.1 Debugger to Target Communication
Important: The MPLAB X IDE software must be installed prior to connecting the MPLAB PICkit 4 In-
Circuit Debugger.
The debugger is connected to the computer via a USB cable for communication and debugger power.
The debugger is connected to the target application for communication and data collection and optional debugger
power.
The debugger system configurations are discussed in the following sections.
DS50002596B-page 18 2017 Microchip Technology Inc.
CAUTION
Communication Failure.
Do not connect the hardware before installing the software and
USB drivers.
CAUTION
Debugger or Target Damage.
Do not change hardware connections while the debugger or target
is powered.
Note: The MPLAB PICkit 4 In-Circuit Debugger is warrantied for operation using the provided cable. Cables from
other vendors may result in communication errors.
3.1.1 Standard ICSP™ Device Communication
The debugger system can be configured to use standard ICSP communication connection for both programming and
debugging functions.
Make sure to align the Pin 1 on the debugger to Pin 1 on the target. The programming connector can be inserted into
either:
• A matching connector at the target, where the target device is on the target board (Figure 3-1).
• A standard adapter/header board combo (available as a Processor Extension Pak), which is then plugged into
the target board (Figure 3-2).
For more on standard communication, see Standard Communication.
Operation
© 2020 Microchip Technology Inc. User Guide DS50002751D-page 10
Table of contents
Other Microchip Technology Computer Accessories manuals

Microchip Technology
Microchip Technology PICkit 3 User manual

Microchip Technology
Microchip Technology MPLAB Snap Manual

Microchip Technology
Microchip Technology MPLAB ICD 3 User manual

Microchip Technology
Microchip Technology MPLAB ICD 4 User manual

Microchip Technology
Microchip Technology MPLAB ICD 4 User manual

Microchip Technology
Microchip Technology Atmel-ICE User manual

Microchip Technology
Microchip Technology MPLAB ICD 3 User manual

















