Pickit 2 as a debugger - Page 1
Forum section: electronics / general

author: Rendon
author_rank: Newbie
timestamp: July 11, 2018, 06:17:17 pm
content: I know this is an old question, but I am rephrasing it in a new way.Can I assume that since I cannot (and have never been able to) use my pickit 2 with MPLABX, that there just isn't a solution?I have searched the web high and low for answers. I use the pickit 2 stand alone programmer. It works great. But I cannot debug, and this is a problem, especially since it is sold as a "debugger".Mplabx reads the serial# just fine.When I attempt to program or debug (which basically equates to communicating with the programmer), I get this message: The programmer could not be started: Tool software could not be found: PICkit2PlatformTool, com.microchip.mplab.mdbcore.pickit2.PICkit2DbgToolManagerOne would assume it is missing some software. I do a google search for the software, and all the search returns is other people having the same problem I'm having. No solution.So back to my opening question - can I just assume that there is no solution, close the case, and assume that Microchip has not merely mislead, but deliberately lied about the pickit 2 being a debugger?

author: elecman14
author_rank: Unknown
timestamp: July 11, 2018, 06:36:13 pm
content: I have used the pickit2 to debug with MPLAB 8.XX software. Be aware that MPLAB != MPLABX.

author: oPossum
author_rank: Super Contributor
timestamp: July 11, 2018, 06:37:46 pm
content: The Pickit 2 was replaced by the Pickit 3 more than 10 years ago. It was supported for programming and debugging when it was a current product and for a while after. MPLAB 8 will do programming and debugging with it.

author: Rendon
author_rank: Newbie
timestamp: July 13, 2018, 08:24:21 am
content: Thanks for your replies.It actually did lead me to the right answer. I downloaded and installed MPLAB 8. I also downloaded and installed MPLABX 1.52.To cut a long story short, I am able to talk to my programmer (and debug) through MPLABX 4.0!The debugger is quite limited though. Only allows for one break-point. It is the first time I'm debugging PIC microcontroller. I'm used to debugging C# applications in visual studio.Are there better debuggers for PIC? (By better, I mean functionality - more break-points, etc). I kept my pickit 2; indeed, I even chose it over the pickit 3 at the time of purchase because pickit 3 had such a bad rap of issues, and my limited use thereof confirms this.

author: Ian.M
author_rank: Super Contributor
timestamp: July 13, 2018, 08:59:54 am
content: Nope. The single breakpoint is a limitation of the debug silicon in the PIC you are using. Some PIC18 devices will give you three breakpoints with a PICkit 2 as their debug silicon has three breakpoint registers. Note that if there are no free breakpoints, you cant efficiently run to cursor or step over C functions or assembler subroutines, so one tends to spend a lot of time disabling the most recent breakpoint and enabling the next one you want to stop at when debugging single breakpoint PICS.However advanced features like instruction trace or data breakpoints are only supported if you have the correct combo of PIC or emulation header and Microchip debugger - you wont get them with a PICkit 2 or 3 even if the PIC debug silicon supports them. To some extent that's a legacy marketing decision as PICkit 2 or 3 hardware doesn't prevent it responding to a data breakpoint, but the debug executive code that MPLAB loads into the PICto support your chosen debugger doesn't implement advanced features on entry level debuggers. Instruction trace is a slightly different matter as IIRC it requires an extra pair of pins on the ICSP/ICD connector for a clocked serial data stream. The new PICkit 4 has the extra pins but so-far doesn't have software/firmware support for them.N.B. MPLAB 8 debugging can be a bit flaky. If anything resets the PIC unexpectedly, the debugger locks up and wont resume even if you attempt to reset the PIC from the IDE. The cure is to select MPLAB Simulator, then reselect PICkit 2 debugger to reinitialise it, then reset the PIC from the IDE. If its really badly borked, you may also need to disconnect and reconnect the PICkit 2 USB while MPLAB Simulator is selected before reselecting PICkit 2 debugger, but remember, its *NOT* a good idea to unplug the USB while a PICkit 2 or 3 is connected to an externally powered target.

author: JPortici
author_rank: Super Contributor
timestamp: July 13, 2018, 09:21:48 am
content: I thought that instruction trace was possible only with the REAL ICE?

author: Ian.M
author_rank: Super Contributor
timestamp: July 13, 2018, 09:43:05 am
content: Yes, that's the debugger that currently supports instruction trace, however it looks like the PICkit 4 has the hardware for the trace interface. The software support isn't there yet*, and I have no idea whether Microchip will include it free, or make it a paid option to maintain the differentiation between entry level and 'pro' tools. Also, I wouldn't be surprised if instruction trace on the PICkit 4 will have clock speed limitations.* and Microchip have a poor track record for following through with implementing promised debugger features in a timely fashion.