Using the

PICkit 3 clone

with MPLAB X IDE, MPLAB X IPE & PICkit 3 Standalone App

by S. T. Lawson

Introduction

Pressured for time, and in full awareness that if I did so it would void the warranty, I went ahead and used the PICkit 3 Standalone Application to load the “Operating System” into my new PICkit 3 clone wiping out the existing, factory programmed firmware. Then after hours of pulling my hair out (figuratively -- considering my lack, thereof!) and banging around in Google-land, I got it to work!

Following is the dilemma that compelled me to breach the warranty: I selected the PIC24F08KL302 for a new design in faith that Microchip would, surely, have full support in place. With PCB in hand I installed the PIC24F08KL302 and whipped out my trusty PICkit 2 and embarked on a miserable journey through Not Supported! land.

Well then,I thought, the PICkit 3 must surely support this device! I'll get one of those. Repelled by sticker shock [the PICkit 3 is more expensive than the PICkit 2 and does less], I hit eBay and discovered the clone offered by tommyvdp [or if you cant find it there, a similar one is available at Amazon.com ]. A couple of days later [It arrived so quickly, I fully expected smoke to be drifting off the package when I opened my mailbox ;) ], I set about trying to get it to program the PIC24F08KL302. But, because all the documentation on the included CD was in Chinese, including what might have been a rather useful AVI movie about using the clone with MPLAB X [also in Chinese], I was left to my own devices.

I tried using the PICkit3 Standalone Application in the way I've always done with my PICkit 2, but it keep telling me that it was in “MPLAB mode” and wanted me to “download an OS compatible with this application.” Since that sounded like it would void the warranty, I shied away from this apparent solution. I downloaded and installed MPLAB X, installed the Microchip XC16 compiler, created a project, pointed it to the PICkit 3 clone, connected the clone to a board with a PIC16F616 (one that I had programmed successfully with my PICkit 2). I figured the PIC16F616 would definitely be supported by the PICkit 3—but NO!!!

That was when I decided to take the leap, and try downloading the OS into the PICkit 3 clone [that "warranty voiding" solution I shied away from, earlier]. After getting one crucial detail from a Microchip forum post (See BTW2, below), I was in business. I was able to not only program the PIC16F616, but also the PIC24F08KL302! I was confounded by an embarrassment of variables and assumptions [such as, the assumption that the PICkit 3 is ever much as feature rich as the PICkit 2] but finally I triumphed! I'm writing this document so I never again have to go through the ordeal of getting this to work (my memory isn't that great!). If you benefit from it, too, so much the better!

BTW: This document seems to also apply to the honest-to-gosh Microchip for-reals PICkit 3 [just substitute 'PICkit 3' for 'PICkit 3 clone', throughout].

BTW2: It turns out that the PICkit 3 clone (at least the one sold by tommyvdp or Amazon.com ), probably would have worked just fine out of the box, if I had discovered that one little important detail during my experiments conducted on the MPLAB X IDE and IPE. That important detail? Merely that neither the IDE nor the IPE will auto-magically supply VDD to the part! [another of those confounding variables]. You see, my PICkit 2, driven by the Standalone Application, is smart enough to check the supply lines for power, and if not present, supply it. Not the MPLAB X IDE, or even the IPE! They are dumb AND blind and require every degree of hand-holding imaginable! In fact, they won't even auto-magically discover and select the PIC. You have to manually select the device part-number from a drop-down list! [Which brings to mind the following question: why create a new and separate, feature poor application (the IPE), when there already exists a perfectly good, feature-friendly application (i.e. the PICkit 2 + Standalone Application). Why not just add support for newer PIC devices to that?]

FYI: IDE stands for Integrated Development Environment and I'm betting IPE stands for Integrated Programming Environment.

What You Need To Know For Successful Use Of The IDE/IPE

It appears the IDE and IPE were designed from the assumption that the part being programmed will already have power supplied to it. And, in fact, this is the most stable configuration. Unlike the PICkit 2 and PICkit 3 Standalone Apps, the IDE/IPE DOES NOT check for power on the supply lines. They don't even temporarily supply power to the device while attempting to first connect with it! You have to either, supply power externally, or manually turn on the PICkit 3 clone's internal supply from the IDE/IPE--which, BTW, doesn't always work (I mean, the voltage gets applied, but the IDE/IPE, still won't connect to the PICkit 3 clone).

I had one case, where the PIC was on a PCB and was programmed to drive [and sequentially flash] an array of LEDs. I tried to get the IPE to connect to this already programmed/in-circuit PIC, but, when I enabled the PICkit 3's internal power supply, the PIC would come to life and fire up all those LEDs, which put a load on the PICkit 3. That load seemed to be enough to prevent a successful connection [even though it was no more than 55ma]. This failure mode might, also, have been caused by supply noise, inserted by the flashing LEDs. It turned out that the only way I could successfully connect with the PIC and re-program it, was to turn the PICkit 3's internal supply off and apply power externally.

FYI: Instructions for turning on the internal power supply can be found under the following headings:

On the first read or write on a particular PIC device, the IDE/IPE may throw up an ominous message to the effect of:

"CAUTION: Check that the device selected in MPLAB IDE (PICxxxxxxxx) 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?"

This is a side-effect of the lack of the IDE/IPE's ability to read the device ID and use it to auto-magically determine what PIC device it's attached to (and subsequently select the proper supply voltage/programming voltage)—technology already owned by Microchip as evidenced by it's inclusion in the PICkit 2 & 3! The PICkit 3's issuance of this message is kind of like a visually impaired bystander warning that selecting a Smart Car if you're taller than 6 feet, might lead to the loss of limbs (unless, of course, you have clown credentials).

The following is a list of Target Circuit Design Precautions when interfacing a PICkit 3 to a PIC that might lead to a solution to whatever problems you are having or prevent the problems in the first place:

  • Do not use greater than 100μF capacitance on VDD: depending on the overall load, it will prevent the target from powering quickly when PICkit 3 is the source of power.
  • Do not use capacitors on MCLR: they will prevent fast transisitons of Vpp.
  • Do not use pull-ups on PGC/PGD: they will divide the voltage levels since these lines have 4.7 kΩ pull-down resistors in PICkit 3.
  • Do not use multiplexing on PGC/PGD: they are dedicated for communications to PICkit 3.
  • Do not use capacitors on PGC/PGD: they will prevent fast transitions on data and clock lines during programming and debug communications.
  • Do not use diodes on PGC/PGD: they will prevent bidirectional communication between PICkit 3 and the target PIC®MCU.
  • Do not exceed recommended cable lengths: refer to the Hardware Specification section of the PICkit 3 online help or user’s guide for acceptable cable lengths.

BTW: Judging by the Microchip Parametric Search Tool, every flavor of PIC in existence that can go to 5V, can also operate at 3.3V (with the possible exception of a number of "SST89Exxxx" devices, which are spec'ed to operate down to only 4.5V—I wonder what happens if an attempt is made to read them at 3.3V? Could a bogus result be returned that mimics the device ID of some other product? Could such a thing have led to trepidation, and then to hand-wringing and the decision to cancel support for auto device detection? Oh, to be a fly on the wall! But, then, a fly would be too stupid to understand their conversations!).

Anyway, if the SST89Exxxx series can be ignored, then why not, just, always read the device ID at 3.3V? And, if it's an SST89Exxxx, and an SST89Exxxx always returns, say, all zeros when read at 3.3V, then just throw up a "Sorry, the Device ID couldn't be read, would you be so kind as to enter it manually?" [wouldn't it be nice if messages were that polite?]

Using The PICkit 3 Clone With The MPLAB X IDE

Out of the box, the PICkit 3 clone is setup for use with the MPLAB X IDE (and also the IPE)—at least the one sold by tommyvdp is. But, if you've gone rogue and, in the past, reprogrammed your PICkit 3 clone, then you'll need to re-reprogram it for IDE use. Here's how:

Plug the USB cable, both into the PICkit 3 and into your PC and start the PICkit 3 app. If you see, in a field of yellow, “The PICkit 3 is in MPLAB mode. Use the Tools menu to download an OS compatible with this application,” then it's already set up for the MPLAB X IDE, so you need do nothing. Otherwise, under the Tools menu, select Revert to MPLAB Mode, and click OK when the message box appears, and OK again when the “The PICkit3 has been converted to MPLAB mode. Exiting GUI” box appears.

After that, it should be ready. Open MPLAB X IDE and either create a project, or open one.

Now, this is a very important thing to know—I spent several frustrating hours trying to get a part to program, until I discovered this crucial little detail following a Google search. If the PIC is not being supplied Vdd voltage externally, then, in order to get the PICkit 3 to Program [or to Read a PIC, or Verify it, or Blank Check it, or even to just Connect to it] you have to turn on it's Internal Supply!!!
Note: this doesn't always work and you may have to, after all, apply external power to the PIC.

Here's how to turn on the PICkit 3 clone's internal supply from the IDE:

  1. With a project open, go to the Run menu and click on Select Project Configuration/Customize...
  2. In the Categories: box, select PICkit 3
  3. In the Option categories: drop-down, select Power
  4. Make sure the Power target circuit from PICkit3 is checked
  5. Make sure the Voltage Level is set to the proper voltage (seems to automatically select the correct voltage based on the selected part—but still wise to check).
  6. Hit OK

You should, now, be able to Program your PIC from the IDE [assuming you have satisfied the persnickety power requirements].

Here's link to a pretty cool "poster" provided by Microchip for using the PICkit 3 with the MPLAB X IDE:
ww1.microchip.com/downloads/en/DeviceDoc/50002010B.pdf Here's another version: ww1.microchip.com/downloads/en/DeviceDoc/PICkit_3_poster_51792a.pdf

Using It With The PICkit 3 Standalone Application

If the PIC you want to program is supported by the PICkit 2 and you have a PICkit 2, use it! The PICkit 3 Standalone application uses the same Device File [in fact, it's even called PK2DeviceFile.dat], so it supports exactly the same devices [or lack, thereof]!! Yet, it has inferior features to the PICkit 2 Standalone application, and is much slower! But, if all you have is the PICkit 3 clone, then the PICkit 3 Standalone app [even with its degraded features] is still superior to using the MPLAB X IDE (or even the IPE), for any kind of “production” programming where all you want to do is load a HEX file and “burn” it into a PIC — as long as the PICkit 3 Standalone application supports the part you want to program. If it doesn't, then you have no choice but to use the IDE or IPE to program your part(s).

If all you've got is the PICkit 3 [clone] and you want to use the PICkit 3 Standalone application [and voiding the warranty is not a concern for you], then plug a USB cable, both into the PICkit 3 and into your PC and start the PICkit 3 Standalone Application. If you see, in a field of yellow, “The PICkit 3 is in MPLAB mode. Use the Tools menu to download an OS compatible with this application,” then do as it says. Under the Tools menu, select Download PICkit Operating System. It should open to the PICkit3 v3 folder (substitute “v3” with whatever version your PICkit Standalone App is at). If it doesn't, then navigate to the directory were the PICkit 3 Standalone App was installed—typically here:

  • C:\Program Files (x86)\Microchip\PICkit 3 v3

and select the PK3OSVxxxxxx.hex file (xxxxxx is the version number), and then click the Open button.

The status box should show “Downloading PICkit 3 bootloader”, then “Switching to PICkit3 bootloader” and finally “PICkit3 connected. ID=xxxxxxxxxxxx PIC Device Found” where “xxxxxxxxxxxx” will be some id alpha-numeric, like "ABC123456789".

The PICkit 3 clone will function very much like a PICkit 2, with exactly the same device coverage (as of this writing). Check the PICkit 3 Programmer Application ReadMe.txt file in the PICkit installation folder for a list of compatible parts (scroll down to the 6. Device Support heading).
BTW: the MPLAB X IDE/IPE support far more parts, but the IDE/IPE are less user-friendly than the Standalone App, so if your part is supported by the Standalone App, I'd use that if all you want to do is program a PIC from a HEX file [or course, if you are using the MPLAB X IDE for development, then, by-all-means, use the IDE to program the PIC].

Here's link to a pretty cool "poster" provided by Microchip for using the PICkit 3 with the MPLAB X IDE [contains information pertinent to the IPE as well]:
ww1.microchip.com/downloads/en/DeviceDoc/50002010B.pdf

Where To Find The PICkit 3 Standalone Application

The only place I have found, on the www.microchip.com website, to download a Windows Binary for the PICkit 3 Standalone Application is at the Microchip Archive (scroll down to “PICkit 3”):

www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023073&redirects=archived

Or, here's the direct link (but this won't point you to newer versions that might be released after this document is published):

http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit3%20Programmer%20Application%20v3.10.zip

The MPLAB X IPE

This is similar to the Standalone app, and, in fact, it is a standalone application, in that you can simply load a HEX file and program it into a PIC (without all of the overhead of loading the IDE), BUT, it lacks most of the automatic features of the application that is called The PICkit 3 Standalone Application. For instance, it doesn't automatically detect and select the PIC, you have to do that manually from a drop-down list. It also doesn't detect power on the PIC (or lack, thereof), so, if you want to program a PIC that isn't externally powered, you have to manually turn on the PICkit 3's internal power supply. The IPE, also, doesn't have that really cool Auto Import Hex feature. I use MikroC to do most of my development, so this really comes in handy. Whenever I generate a new HEX file from the MikroC IDE, the PICkit 2/3 Standalone App notices the file change and auto-magically programs the PIC!

The only advantage, that I can see, in using the IPE over using the Standalone App is the IPE will program a wider variety of PICs than the Standalone App will.

Here's how to turn on the PICkit 3 clone's internal supply from the IPE:

  1. Go to the Settings menu and select Advanced Mode.
  2. A dialog box will pop-up. Enter the password (default is 'microchip') [and click the Remember Password checkbox if you don't want to be entering that every time you want to access the Advanced Features!].
  3. Then click the Log on button.
  4. This will reveal a column of buttons. Click on the Power button, and check the box labeled Power Target Circuit from Tool.
  5. Also, check the VDD: setting to make sure it is the proper voltage (seems to automatically select the correct voltage based on the selected part—but still wise to check).
  6. Then click on the Operate button, to get back to the place where you can actually program a part. Note that you have to do this whenever you change the Device setting.

I have found that after selecting a device and hitting the Connect button, if there's an error, I can go ahead and Import a HEX file and hit the Program button, and it will program just fine. So, the thing cries wolf (or it's very good at recovering from “operator error”—not sure which)!


Bottom Line

  • If the PIC you want to program is supported by the PICkit 2 Standalone app, then use that [the PICkit 3 is feature-inferior in this context].
  • If you only have a PICkit 3, and the PIC you want to program is supported by the PICkit 3 then you have several options:
    1. If your PIC is supported by the PICkit 3 Standalone app, and all you want to do is program your PIC from a HEX file then the PICkit 3 Standalone app is ideal.
    2. If your PIC is supported by the PICkit 3 Standalone app, you can still use the IDE in a development cycle arrangement. You can also use the IPE, but you might be better off with the Standalone app in this case.
    3. If your PIC is NOT supported by the PICkit 3 Standalone app, then your only recourse is to use the IDE or IPE.
  • If the PIC you want to program is NOT supported by the PICkit 2, then use the PICkit 3 [clone] along with the IDE or IPE [forget the PICkit 3 Standalone application -- it won't support your part!]. And make sure to either power your PIC externally, or turn on the PICkit 3 [clone]'s internal power supply [doesn't always work, though].
  • To find out if the PIC you want to program is supported by the PICkit 2/3 one of the following methods:
    1. Look in the PK2DeviceFile.dat file which is likely in the following directory:
      C:\Program Files (x86)\Microchip\PICkit [2|3] v?
    2. Look in the PICkit 3 Programmer Application ReadMe.txt file in the PICkit installation folder [scroll down to the 6. Device Support heading]. This is probably located at:
      C:\Program Files (x86)\Microchip\PICkit [2|3] v?
    3. Or go here:
          ww1.microchip.com/downloads/en/DeviceDoc/PICkit 2 Readme v2-61-00 (a).txt

Troubleshooting

  • Target Device ID (0x0) does not match expected Device ID (0xnnnnnnnn):

    This happens both in the IDE and the IPE, usually on the first press of the Connect button—even when the device is powered externally. I just ignore it and proceed. On every occasion, I just went ahead and loaded a .HEX file and hit the Program button and it worked just fine despite the message of doom. I've also had 100% success with the Read button, as well.

  • Connection Failed:

    There may be more causes for this than covered here, but I will talk about the one's I've encountered.

    1. If ever you, in the Standalone Application, selected Download PICkit Operating System [under the Tools menuitem], i.e. if, in the past, you took the PICkit 3 [clone] out of MPLAB mode, then the IDE/IPE will not connect. To remedy this, Close the IDE or IPE and then Open the Standalone Application and under the Tools menu, select Revert to MPLAB Mode.
    2. I, once, forgot that I had the PICkit 3 Standalone Application open, and also opened the MPLAB X IPE. Whenever I clicked the Connect button, I would get a "Connection Failed" error in the Output box. I found that I had to not only close the PICkit 3 Standalone App, but also the IPE. Then, for good measure I also unplugged the PICkit 3's USB cable, waited a few seconds and then plugged it back in. Then I re-opened the IPE and, voila, I was able to connect.
    3. Occasionally, the PICkit 3 clone [and this probably happens with the Microchip unit, too, as it has the signature of a firmware problem] will get "stuck" and not respond to attempts to connect with it. This happened, once, after an attempt to connect to a PIC that wasn't externally powered. I applied power and tried again, and still got the "Connection Failed" error message. So, I unplugged the PICkit 3 clone, waited for the little green dot [next to the Device: drop-down list] to vanish [also, the Connect button goes gray], then plugged it back in. After that [and after the green dot re-appeared], I was able to connect [by clicking the Connect button].
    4. If you have the PICkit 3 clone's internal power supply turned on and the device you are trying to program shares supply lines with some other circuitry that either places a significant load on the PICkit 3 clone's internal supply, or demands a widely varying current load (the extent of significant and widely are unknown to this author), then the PICkit 3 clone may fail to connect. The remedy (I have found) is to turn off the PICkit 3 clone's internal supply, and power the device externally.
  • IPE - Updates to HEX File Not Porting To Device When Programmed:

    This was happening when I first started using the IPE. I was used to using the Auto Import Hex feature on the PICkit 2, and was expecting the same, marvelous, feature to be present on the IPE [even though I knew it wasn't, but hey, I'm a creature of habit]. When I realized my mistake, I fell in line with the IPE development cycle:

    1. Build the HEX file in the external IDE [I was using MikroC].
    2. Use the Source: Browse button to find and select the new HEX file.
    3. Hit the Program button.


PICkit 3 sucks! What a piece of junk! How can Microchip call it self a reputable company after producing such crap? PICkit 3 not working, PICkit 3 piece of crap, PICkit3, Fuck PICkit 3, Hate PICkit 3, PICkit 3 won't work, PICkit 3 doesn't work. Can't get the PICkit 3 to work. Can't get the PICkit 3 to program. PICkit 3 won't connect. Pickit 3 won't program. PICkit 3 won't supply power. PICkit 3 won't discover.