2
\$\begingroup\$

I have a programmer and it works fine with PICKit2v2. As you see in the below images, I read my PIC16F877A memory and write to it successfully :

enter image description here

But the problem appears when I want to use my programmer in MPLAB-X-IDE :

enter image description here

As you see above, It say that The programmer could not be started : Failed to program the Device! Why?

Contents of Project loading warning tab :

Warning: Project "FirstProject-FlashingLight" refers to file "C:\Users\Amir Ebrahim\MPLABXProjects\FirstProject-FlashingLight.X/myMain.c" that contains spaces or odd characters in its name or its path.
Some of the files in this Project "FirstProject-FlashingLight" contain spaces or odd characters in their name or their path. This could potentially cause issues during the build process. This is a limitation of GNU Make tool that we use as part of our build process. Removing spaces from all file and folder names included in this project will eliminate this potential issue.

Contents of PIC Kit2 tab :

Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:40:36
PK2Error103: Unexpected device ID: Aborting as requested
PK2Error103: Unexpected device ID: Aborting as requested
Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:40:57
PIC16F877A found (rev = 0x8)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x7f8 - 0x7ff)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x7f8 - 0x7ff)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:41:19
PIC16F877A found (rev = 0x8)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x7f8 - 0x7ff)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x7f8 - 0x7ff)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:43:35
PIC16F877A found (rev = 0x8)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x7f8 - 0x7ff)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x7f8 - 0x7ff)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:56:45
PIC16F877A found (rev = 0x8)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x7f8 - 0x7ff)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x7f8 - 0x7ff)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
Found PICkit 2 - Operating System Version 2.32.0
Target power detected ( 4.99V)
2015-01-01 20:57:42
PIC16F877A found (rev = 0x8)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x7f8 - 0x7ff)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x7f8 - 0x7ff)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)
PK2Error0027: Failed verify (Address = 0x7f8 - Expected Value 0x3fff - Value Read 0xbf2)

Note that the project that I tried to program it to my MCU, is an empty project (I mean it has only an empty main() and nothing else- I just did the primary steps to create a project as mentioned in Quick start section of MPLAB X IDE). I also tried another project that was worked fine in another computer with another reader, But I received the same error (So there is no problem with the project.)

I appreciate your time and your consideration.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

The PICkit2™ only has partial (i.e., beta) support in MPLAB-X. If your PICkit2™ isn't a genuine Microchip one then chances are it won't work with the driver in MPLAB-X.

I have used for many years now a cheap PICkit2™ clone (one of the yellow heatshrink wrapped ones from eBay). It works perfectly in everything else, but MPLAB-X won't work with it at all.

The PICkit2™ is now considered an end-of-life product and as such they haven't spent much time or money porting the driver to MPLAB-X. They have done enough to support the basics of the official ones, but not enough to make it work with other's clone devices.

It may, in part, have been an attempt to curb the use of unauthorized clones and drive up sales of official ones, but that's probably just the cynic in me talking.

I always use pk2cmd or pic32prog with my PICkit2™ from the command line - both work flawlessly. If I need to program or debug direct from MPLAB-X then I use a PICkit3™ instead.

\$\endgroup\$
4
  • \$\begingroup\$ I've been using a yellow clone of the PICkit2 as well and it doesn't work with MPLABX either... Prolly because it's a clone yeah. \$\endgroup\$
    – Sohail
    Commented Jan 1, 2015 at 11:49
  • \$\begingroup\$ I second this. I use MPLAB X only when I really need to debug my application or when I am using the PK3. In my experience the PK2 standalone application works quicker, and you have access to the logic/serial tool which can be handy on certain PICs where you can redirect I/O pins to same as the ICSP pins. \$\endgroup\$
    – Hans
    Commented Jan 1, 2015 at 13:49
  • \$\begingroup\$ Dear Majenko, I add the line#define _XTAL_FREQ 12000000 in the second line after #include <xc.h>! And now, The MPLAB X works fine with the programmer!! Do you know why?! Note that if I change it to #define _XTAL_FREQ 6000000 ,then I receive the same error again! \$\endgroup\$ Commented Jan 2, 2015 at 13:44
  • \$\begingroup\$ Oops, It doesn't works again! It is random! :\ \$\endgroup\$ Commented Jan 2, 2015 at 13:53
0
\$\begingroup\$

I have had similar problems using PICkit 2 with MPLAB X. It's one of two kosher PICkit 2's bought a while back and used a fair amount. Two different target chips, different projects all sorts of operations. Eventually went back to MPLAB 8 (better UI and design than X, clear and concise - AND has proper control stuff for PICkit 2 easily available). So, downloaded a new PICkit 2 OS. No improvement. Played with programmer config on PICkit 2... no actual change made... but on leaving with OK, the problem is fixed. I suspect the driver has cached configuration state which gets corrupted. Uninstalling and re-installing the driver (classic Windoze idiocy) would probably have a similar effect. So the conclusion is: probably buggy driver, inadequate control of PICkit 2 from MPLAB X.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.