MPLAB PICkit 4 In-Circuit Debugger User's Guide

2y ago
10 Views
2 Downloads
1.50 MB
83 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Kian Swinton
Transcription

MPLAB PICkit 4 In-Circuit Debugger User's GuideNotice to CustomersImportant:All documentation becomes dated and this manual is no exception. Microchip tools and documentation areconstantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differfrom those in this document. Please refer to our website (www.microchip.com) to obtain the latestdocumentation available.Documents are identified with a “DS” number. This number is located on the bottom of each page, in frontof the page number. The numbering convention for the DS number is “DSXXXXXA,” where “XXXXX” is thedocument 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 theHelp menu and then Topics, to open a list of available online help files. 2020 Microchip Technology Inc.User GuideDS50002751F-page 1

Table of ContentsNotice to Customers.11.Introduction. 41.1.1.2.1.3.2.About the Debugger. 62.1.2.2.2.3.2.4.3.Power Requirements for Programmer-To-Go.23Limitations for Programmer-To-Go. 24Setting up PICkit 4 for Programmer-To-Go Mode. 25Using Programmer-To-Go. 29Exiting Programmer-To-Go n and Setup.17Debug Tutorial.17Quick Debug/Program Reference. 17Debugger Limitations. 18Common Debug Features. 18Connecting the Target Board.19Setting Up the Target Board. 19Setting Up MPLAB X IDE. 20Starting and Stopping Debugging. 20Viewing Processor Memory and Files. 21Breakpoints and Stopwatch.21MPLAB PICkit 4 Programmer-To-Go. 235.1.5.2.5.3.5.4.5.5.6.Debugger to Target Communication.9Target Communication Connections. 10Debugging. 13Requirements for Debugging. 14Programming.16Resources Used by the Debugger. 16Debugger Usage. MPLAB PICkit 4 In-Circuit Debugger Description. 6MPLAB PICkit 4 In-Circuit Debugger Advantages. 6MPLAB PICkit 4 In-Circuit Debugger Components. 7MPLAB PICkit 4 Block Diagram. 8Operation. 93.1.3.2.3.3.3.4.3.5.3.6.4.Document Layout. 4Conventions Used in This Guide.4Recommended Reading.5Some Questions to Answer First.31Top Reasons Why You Can't Debug. 31Other Things to Consider. 32Frequently Asked Questions. 35 2020 Microchip Technology Inc.User GuideDS50002751F-page 2

7.1.7.2.8.Error Messages.378.1.8.2.9.How Does it Work?.35What's Wrong?. 35Types of Error Messages. 37General Corrective Actions. 46Engineering Technical Notes (ETNs). 4810. Debugger Function Summary. 4910.1. Debugger Selection and Switching. 4910.2. Debugger Options Selection. 4911. Hardware Specification. 5511.1.11.2.11.3.11.4.USB Connector. 55MPLAB PICkit 4 In-Circuit Debugger. 55Communication Hardware.57Target Board Considerations.6012. Revision History. 6112.1.12.2.12.3.12.4.12.5.12.6.Revision A (May 2018). 61Revision B (August 2018).61Revision C (October 2018).61Revision D (January 2020).61Revision E (February 2020). 61Revision F (October 2020). 6113. Support.6213.1. Warranty Registration.6213.2. myMicrochip Personalized Notification Service.6214. Glossary. 63The Microchip Web Site. 81Customer Change Notification Service. 81Customer Support. 81Microchip Devices Code Protection Feature. 81Legal Notice. 82Trademarks. 82Quality Management System. 82Worldwide Sales and Service.83 2020 Microchip Technology Inc.User GuideDS50002751F-page 3

Introduction1.IntroductionThis chapter contains general information that will be useful to know before using the MPLAB PICkit 4 In-CircuitDebugger.1.1Document LayoutThis document describes how to use the MPLAB PICkit 4 In-Circuit Debugger as a development tool to emulate anddebug firmware on a target board, as well as how to program devices. The document is organized as follows: 1.22. About the Debugger – What the MPLAB PICkit 4 In-Circuit Debugger is and how it can help you develop yourapplication.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 PICkit4 In-Circuit Debugger is chosen as the debug tool. This includes the debug features for breakpoints andstopwatch.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 theMPLAB 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.Conventions Used in This GuideThis manual uses the following documentation conventions:Table 1-1. Documentation ConventionsDescriptionRepresentsExamplesArial font:Referenced booksMPLAB IDE User’s GuideEmphasized text.is the only compiler.A windowthe Output windowA dialogthe Settings dialogA menu selectionselect Enable ProgrammerQuotesA field name in a window or dialog“Save project before build”Underlined, italic text with rightangle bracketA menu pathFile SaveBold charactersA dialog buttonClick OKA tabClick the Power tabItalic charactersInitial capsN‘RnnnnA number in verilog format, where N is 4‘b0010, 2‘hF1the total number of digits, R is theradix and n is a digit.Text in angle brackets A key on the keyboardPress Enter , F1 Courier New font: 2020 Microchip Technology Inc.User GuideDS50002751F-page 4

sSample source code#define STARTFilenamesautoexec.batFile pathsc:\mcc18\hKeywordsasm, endasm, staticCommand-line options-Opa , -Opa-Bit values0, 1Constants0xFF, ‘A’Italic Courier NewA variable argumentfile.o, where file can be any validfilenameSquare brackets [ ]Optional argumentsmcc18 [options] file[options]Curly brackets and pipecharacter: { }Choice of mutually exclusivearguments; an OR selectionerrorlevel {0 1}Ellipses.Replaces repeated textvar name [, var name.]Represents code supplied by uservoid main (void){ .Plain Courier New}1.3Recommended ReadingThis user's guide describes how to use MPLAB PICkit 4 In-Circuit Debugger. Other useful documents are listedbelow. 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 beconsidered when using the MPLAB PICkit 4 In-Circuit Debugger with your target design.MPLAB X IDE Online HelpThis 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, installationrequirements, tutorials, details on creating new projects, setting build properties, debugging code, settingconfiguration bits, setting breakpoints, programming a device, etc. This help file is generally more up-to-date than theprintable PDF of the user’s guide (DS50002027) available as a free download at www.microchip.com/mplabx/.Release Notes for MPLAB PICkit 4 In-Circuit DebuggerFor the latest information on using MPLAB PICkit 4 In-Circuit Debugger, read the notes under “Release Notes andSupport Documentation” on the MPLAB X IDE Start Page. The release notes contain update information and knownissues 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-CircuitDebugger using standard communications and a target board.Processor Extension Pak and Header Specification (DS50001292)This booklet describes how to install and use headers. Headers are used to better debug selected devices, withoutthe loss of pins or resources. See also the PEP and Header online Help file. 2020 Microchip Technology Inc.User GuideDS50002751F-page 5

About the Debugger2.About the DebuggerAn overview of the MPLAB PICkit 4 In-Circuit Debugger system is provided here.2.1MPLAB PICkit 4 In-Circuit Debugger DescriptionThe MPLAB PICkit 4 In-Circuit Debugger (PG164140) allows fast and easy debugging and programming of MicrochipPIC , dsPIC , AVR, SAM and CEC (Arm Cortex -M7-based) microcontrollers using the powerful graphical userinterface 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 canbe connected to the target via a Microchip debug 8-pin Single In-Line (SIL) connector. The connector uses two deviceI/O pins and the reset line to implement in-circuit debugging and In-Circuit Serial Programming (ICSP ). Anadditional microSDHC card slot and the ability to be self-powered from the target means you can take your code withyou 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 interfacessuch as 4-wire JTAG, Serial Wire Debug (SWD), and streaming Data Gateway1, while being backward compatible fordemo boards, headers and target systems using 2-wire JTAG and ICSP. The MPLAB PICkit 4 also has a uniqueProgrammer-To-Go function with the addition of a microSDHC card slot to hold project code and the ability to bepowered 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 beset 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 laterLinux macOS The MPLAB PICkit 4 In-Circuit Debugger was developed for debugging embedded processors with rich debugfacilities 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 deviceproduction programmer.2.2MPLAB PICkit 4 In-Circuit Debugger AdvantagesThe 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.1The functionality will be available in a future update to the product through MPLAB X IDE. 2020 Microchip Technology Inc.User GuideDS50002751F-page 6

About the Debugger Sets breakpoints based on internal events.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 freedownload at 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 for low voltage program mode entry from 1.2 to 5.0V and for high voltageprogram mode entry from 2.8 to 5.0V. 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, ornonexistent). Controlled programming speed provides flexibility to overcome target board design issues. CE and RoHS compliant – conforms to industry standards.2.3MPLAB PICkit 4 In-Circuit Debugger ComponentsThe 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 topwhich 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 providingpower to the debugger.Figure 2-1. Basic Debugger SystemAdditional hardware and accessories may be ordered separately from Microchip Direct (www.microchipdirect.com). 2020 Microchip Technology Inc.User GuideDS50002751F-page 7

About the Debugger 2.4(Part Number AC002015) - a connectivity board that supports JTAG, SWD and ICSP protocols, useful fordebugging legacy AVR with MPLAB PICkit 4 15).Transition sockets.ICD headers.MPLAB processor extension paks.MPLAB PICkit 4 Block DiagramUSB HS(SIE)(SPI)LOGICBUFFERSAME70MICROVDD MONITORSCALERSVPP MONITORVPP ONVPP AN0VPPGENICSP M(I2C)IDENTIFIERSVDD ONVDD AN1OVERCURRENTPGM(HSMCI)uSD CARD 5.5v 5.5vVUSBPWRBOOST 5v 3.3VDIST 2020 Microchip Technology Inc.SWITCHERTVDDRGB LEDUser GuideDS50002751F-page 8

Operation3.OperationA simplified theory of operation of the MPLAB PICkit 4 In-Circuit Debugger system is provided here. It is intended toprovide enough information so that a target board can be designed that is compatible with the debugger for bothdebugging and programming operations. The basic theory of in-circuit debugging and programming is discussed sothat problems, if encountered, are quickly resolved.3.1Debugger to Target CommunicationImportant: The MPLAB X IDE software must be installed prior to connecting the MPLAB PICkit 4 InCircuit 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 debuggerpower.The debugger system configurations are discussed in the following sections.CAUTIONCommunication Failure.Do not connect the hardware before installing the software andUSB drivers.CAUTIONDebugger or Target Damage.Do not change hardware connections while the debugger or targetis powered.Note: The MPLAB PICkit 4 In-Circuit Debugger is warrantied for operation using the provided cable. Cables fromother vendors may result in communication errors.3.1.1 Standard ICSP Device CommunicationThe debugger system can be configured to use standard ICSP communication connection for both programming anddebugging functions.Make sure to align the Pin 1 on the debugger to Pin 1 on the target. The programming connector can be inserted intoeither: A matching connector at the target, where the target device is on the target board. 2020 Microchip Technology Inc.User GuideDS50002751F-page 9

OperationFigure 3-1. Standard Debugger System – Device With On-board ICE Circuitry A standard adapter/header board combo (available as a Processor Extension Pak), which is then plugged intothe target board.Figure 3-2. Standard Debugger System – ICE DeviceFor more on standard communication, see Standard Communication.3.2Target Communication ConnectionsImportant: Refer to the data sheet for the device you are using as well as the application notes and thespecific interface for additional information and diagrams.3.2.1Standard Communication Target ConnectionUSING SINGLE IN-LINE CONNECTOR 2020 Microchip Technology Inc.User GuideDS50002751F-page 10

OperationUse the single in-line connector between the MPLAB PICkit 4 In-Circuit Debugger and the target board connector(see Figure 3-1 and Standard Communication).USING AN ADAPTERUse the AC164110 adapter between the MPLAB PICkit 4 In-Circuit Debugger and the target device with the modularinterface (six conductor) cable. The pin numbering for the connector is shown from the bottom of the target PCB inthe following figure.Figure 3-3. Standard RJ-11 Connection at TargetTargetConnectorVDDVPP/MCLR3.2.2PGDReserved2 4 6PGC1 3 5VssTargetPC BoardBottom SideTarget Connection CircuitryThe figure below shows the interconnections of the MPLAB PICkit 4 In-Circuit Debugger to the connector on thetarget 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 bestrobed low to reset the device.Figure 3-4. Standard Connection to Target Circuitry3.2.3Target PoweredIn the following descriptions, only three lines are active and relevant to core debugger operation: pins 1 (VPP/MCLR),5 (PGC), and 4 (PGD). Pins 2 (VDD) and 3 (VSS) are shown in Figure 3-4 for completeness. MPLAB PICkit 4 has twoconfigurations for powering the target device: internal debugger and external target power.The recommended source of power is external and derived from the target application (see figure below). In thisconfiguration, target VDD is sensed by the debugger to allow level translation for the target low voltage operation. Ifthe debugger does not sense voltage on its VDD line (pin 2 of the interface connector), it will not operate. 2020 Microchip Technology Inc.User GuideDS50002751F-page 11

OperationFigure 3-5. Target Powered from External Source3.2.4Debugger PoweredIf the target is powered through the debugger with an externally powered hub as shown below, the power available tothe target is limited to 50 mA.Figure 3-6. Target Powered Through Self-Powered HubNot all devices have the AVDD and AVSS lines, but if they are present on the target device, all must be connected tothe appropriate levels in order for the debugger to operate. They cannot be left floating.Also, devices with a VCAP line (PIC18FXXJ for example) should be connected to the appropriate capacitor or level.Note: The interconnection is very simple. Any problems experienced are often caused by other connections orcomponents on these critical lines that interfere with the operation of the MPLAB PICkit 4 In-Circuit Debugger, asdiscussed in the following section.3.2.5Circuits That Will Prevent the Debugger From FunctioningThe figure below shows the active debugger lines with some components that will prevent the MPLAB PICkit 4 InCircuit Debugger system from functioning. 2020 Microchip Technology Inc.User GuideDS50002751F-page 12

OperationFigure 3-7. Improper Circuit ComponentsSpecifically, these guidelines must be followed: 3.3Do not use pull-ups on PGC/PGD – they will disrupt the voltage levels, since these lines have programmablepull-down resistors in the debugger.Do not use capacitors on PGC/PGD – they will prevent fast transitions on data and clock lines duringprogramming 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 generallysufficient.Do not use diodes on PGC/PGD – they will prevent bidirectional communication between the debugger and thetarget device.DebuggingThere are two steps to using the MPLAB PICkit 4 In-Circuit Debugger system as a debugger. The first requires thatan application is programmed into the target device (usually with the MPLAB PICkit 4 itself). The second uses theinternal in-circuit debug hardware of the target Flash device to run and test the application program. These two stepsare directly related to the MPLAB X IDE operations:1.2.Programming the code into the target and activating special debug functions.Debugging the code using features such as breakpoints.Note: For more information, refer to the MPLAB X IDEWebHelp.If the target device cannot be programmed correctly, the MPLAB PICkit 4 In-Circuit Debugger will not be able todebug.A simplified diagram of some of the internal interface circuitry of the MPLAB PICkit 4 In-Circuit Debugger is shown inthe figure below. 2020 Microchip Technology Inc.User GuideDS50002751F-page 13

OperationFigure 3-8. Proper Connections for ProgrammingFor programming, no clock is needed on the target device, but power must be supplied. When programming, thedebugger puts programming levels on VPP/MCLR, sends clock pulses on PGC, and serial data via PGD. To verifythat the part has been programmed correctly, clocks are sent to PGC and data is read back from PGD. Thissequence confirms the debugger and device are communicating correctly.3.4Requirements for DebuggingTo debug (set breakpoints, see registers, etc.) with the MPLAB PICkit 4 In-Circuit Debugger system, there are criticalelements that must be working correctly: The debugger must be connected to a computer. It must be powered by the computer via the USB cable and itmust be communicating with the MPLAB X IDE software via the Micro-B USB cable. Refer to the MPLAB X IDEHelp file titled “Getting Started with MPLAB X IDE,” and navigate through the “Tutorial” to the “Running andDebugging Code” section.The debugger must be connected (as shown in the figure in 3.3 Debugging) to the VPP, PGC and PGD pins ofthe target device with the modular interface cable (or equivalent).The target device must have power and a functional, running oscillator. If for any reason, the target device doesnot run, the MPLAB PICkit 4 In-Circuit Debugger will not be able to debug.The target device must have its Configuration words programmed correctly. T

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. 1 The functionality will be available in a future update to the product

Related Documents:

MPLAB SIM MPLAB ICE 2000 MPLAB ICD 2 MPLAB ICE 4000 MPLAB IDE Debugger The other debug engines are hardware devices, while MPLAB SIM is a software program, running on your PC. MPLAB SIM provides many of the same features as in-circuit emulators and in-circuit debuggers.

PICkit 2 Overview 11 PICkit CDROM Tutorials on getting started in the MPLAB IDE and the PICkit 2 Programmer. A 12 Lesson series on Midrange PIC assembly programming. A tutorial on debugging with the PICkit 2. Demo C compilers, example C projects, and tutorials on C language development and debuggin

MPLAB X CCS C Compiler Tutorial How to install the CCS C Compiler inside MPLAB X Before the CCS C Compiler can be used inside MPLAB X, the CCS C MPLAB X Plug-in must be installed. This process can be done inside MPLAB X. 1. Launch MPLAB X. 2. From the MPLAB X menu, select Tools - Plugins 3.

MPLAB C18 C Compiler The layout of this document: –Installing MPLAB C18: A step-by-step guide through the installation process of MPLAB C18 Compiler. –Configuring MPLAB IDE: MPLAB IDE setup for use with MPLAB C18. Basics of MPLAB IDE configuration to run your Program

Chapter 1: MPLAB IDE Preview – An overview of what MPLAB IDE is and how it works. Chapter 2: MPLAB IDE Installation – How to install MPLAB IDE on your computer. Chapter 3: Getting Started with MPLAB IDE – A Tutorial – How to begin using MPLAB IDE. Chapter 4: MPLAB IDE Projects Tuto

included header will interface with MPLAB REAL ICE, MPLAB ICD 3, PICkit 3, MPLAB ICD 2, and PICkit 2. It includes an RJ-11 adapter and 3 pairs of pin headers for the 14-, 20-, and 28-pin targets. This Processor Extension Pak is mandatory for debugging PIC24F04KA200 and PIC24F04KA20

MPLAB X IDE The latest information on Microchip MPLAB X IDE, the Windows Integrated Development Environment for dev elopment systems tools. This list is focused on the MPLAB IDE, MPLAB ID E Project Manager, MPLAB Editor and MPLAB SIM simu

MPLAB Harmony provides a MPLAB Harmony Configurator (MHC) MPLAB X IDE plug-in that can be installed in MPLAB X IDE to help you create your own MPLAB Harmony applications. To create a new MPLAB