1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Programming a PIC with PICkit2 Error

Discussion in 'Microcontrollers' started by hugoender, Jun 28, 2008.

  1. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    I am having a problem reprogramming my PIC with my PICkit2.

    I get the following error:

    PK2Error0027: Failed verify (Address = 0x0 - Expected Value 0x25 - Value Read 0xBE0)

    This happened to me once before and I am not quite sure how I fixed it (since all I did was click a bunch of buttons until it worked). Now that it has happened a second time, I think it is time to figure out why. I searched the forums but the other people that have this same problem just posted "nm, figured it out" but don't post what they did to fix it :(

    If anyone can help me out with this that would be great.
     
  2. eng1

    eng1 New Member

    Joined:
    Apr 7, 2006
    Messages:
    951
    Likes:
    19
    Location:
    Italy
    Is the PIC powered by the PICkit2? If that's the case, what Vdd output do you have on the PICkit2? If it is too low (Vdd<4.5 V), that might cause the PIC not to erase properly.
     
    Last edited: Jun 28, 2008
  3. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    erm do you mean that you program the pic once and it works and then when you try to program it again it won't recognise the pic ?

    if thats the case follow these steps from the microchip forum:


    Thanks to Toley for sending me a few of the problem PIC16F88 parts. This problem is unique to 18-pin parts that share the Timer1 oscillator with the PGx programming pins. Parts included are the PIC16F88, 87 and possibly the 818, 819, 62xA, & 648A.

    The problem occurs when the device is programmed so that:
    1) It uses the internal oscillator
    -and-
    2) The MCLR pin is turned off to use as a digital input instead
    -and-
    3) The program code enabled the Timer1 Oscillator in the T1CON register. (The sooner this is enabled after the reset vector the more likely the problem is to occur.

    This problem can be prevented by avoiding one of the 3 conditions above.

    It is possible to recover parts with this issue. To do so, follow these steps in the PICkit 2 Programmer software:

    A) Put the part on a breadboard or other jig where it is only connected to the 5 PICkit 2 programming signals.
    B) Open the PICkit 2 Programmer application v2.40 (or later). Select "Device Family > Midrange"
    C) Set the PICkit 2 Programmer VDD voltage box to 3.0 Volts
    D) Select "Device Family > Midrange" again; it should now detect the part
    E) If the part is not detected in D), reduce the VDD by 0.1 volts and try again. Repeat until the part is detected.
    F) Select the WRITE button. It should now erase the part.

    You will now be able to program & use the part normally at 5.0 Volts VDD.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL

    Thanks a lot for the extremely quick responses!

    I got it to work (before I read your responses). This is what I did:

    1. Since I was getting the error while trying to program the PIC using the MPLAB IDE program, I decided to try and do it using the PICkit 2 standalone program.

    2. As soon as I opened the PICkit 2 program, it could not detect the device so I selected my PIC from the Device drop down menu. Once I did this, it downloaded some firmware for it (i think) and it found the device. I then checked the box for VDD (5V) and imported the hex file that MPLAB had created. This got the PIC working and everything was fine.

    3. I then went back to MPLAB IDE and tried programming it there and it worked.

    So, I don't know if it was that firmware upgrade or what. I do not think so because I was able to program it before without the firmware update.

    @Thunderchild:
    I do not meet any of those 3 requirements you outlined so I don't think that is my problem. I will post here if I encounter the problem again. For now it is resolved.
     
  6. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    well they are the basic setups recomended in the template file from microchip so if your as unfortunate as me to be trying to start up on the 16F88 you run into this often
     
  7. Boomslang

    Boomslang Member

    Joined:
    Mar 3, 2007
    Messages:
    253
    Likes:
    4
    Location:
    South Africa
    I get the same error once in a while, I just reseat (reset) the PICKIT and it works OK again.
     
  8. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    Well it just happened to me again. It seems like once you program it successfully once, the second time you try, it gives you the error.
     
  9. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    Oh just wonderful. I think I broke my PICkit2 :(

    I went to update the OS (since it told me to in the PICkit2 program) and by mistake clicked on the PICkit2 User Guide PDF. Now everytime I open PICkit2 program, it hangs and the busy light on the PICkit2 blinks.
     
  10. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    WHEW!!!! I was able to recover it using MPLAB IDE. I loaded MPLAB IDE and in there I went to Programmer > Update OS. This was the ONLY thing that was able to wake it up (stop the red busy light from blinking) and communicate with the device. Once I did this, I was able to go back into PICkit2 program and manually update the OS. Wow what a relief. I thought I had destroyed my PICkit.
     
  11. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    thats is the pricise problem that I had and found those instructions for.
     
  12. Thunderchild

    Thunderchild New Member

    Joined:
    Jul 3, 2005
    Messages:
    2,294
    Likes:
    9
    Location:
    UK
    erm you flashed a PDF file in to the Pickit2 as the OS ? that was clever well glad to know ya got it back they are mighty exspensive to buy (considering you are quoted 17 £ and end up paying nearly 40 after VAT at 30 % and handling and postage)
     
  13. AllVol

    AllVol New Member

    Joined:
    Nov 22, 2005
    Messages:
    956
    Likes:
    9
    Location:
    Tennesee, USA
    If you look very carefully, on the right side of your M-sPasm IDE screen, next to where you download to the PICkit, there is a very tiny little picture of the PICkit. Sometimes, if you are having problems, clicking on this icon will straighten things out.

    The error is very common, especially if you are trying to program devices that are not compatable with PICkit, such as the popular 16F84A. When you select your target device in MPasm, be sure the green or yellow dot shows next to PICkit2. If not, you will always get the error.

    Also, problems with the Master reset or Vpp will cause this error.

    I'm still trying to figure it all out, also. These are just a few hints I've discovered.

    Don't be too concerned with harming your PICkit2. They are tough, designed to be used by we dummies. LOL!

    G'luck.
     
  14. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    lol yes I know... I feel dumb... but I did not do it on purpose. I misclicked (double clicked the pdf instead of the hex).
     
    • Like Like x 1
  15. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    I am becoming much more comfortable using the PICkit2 and it's software now. I have realized that the software and hardware do some things without telling you when you change certain things.

    What I mean by this is for example:
    When you go to MPLAB and click on Programmer > VDD Off and then turn it back on, it holds the PIC on reset. Basically, you can turn off the reset through the Programmer menu but when you turn VDD back on, it automatically turns the reset on again. This is something that if unless you know this is happening, you would not know that the PICkit2 is holding your PIC on reset and that is why it is not working.
     
  16. Boomslang

    Boomslang Member

    Joined:
    Mar 3, 2007
    Messages:
    253
    Likes:
    4
    Location:
    South Africa
    :D:D:D:D The funniest thing I've read in a long time!
     
  17. AllVol

    AllVol New Member

    Joined:
    Nov 22, 2005
    Messages:
    956
    Likes:
    9
    Location:
    Tennesee, USA
    Mine does not. I control the PICkit simply by using the buttons on the toolbar of MPlab. Never have any problems. Perhaps there is a problem with your demo board. Which one are you using?
     
  18. hugoender

    hugoender New Member

    Joined:
    May 20, 2008
    Messages:
    167
    Likes:
    1
    Location:
    Miami, FL
    I do not use a demo board. All I have is the PICkit2 programmer. I program the PICs on my breadboard. And you cannot control whether to turn the VDD off or on through the toolbar of MPLAB. You have to go to the Programmer menu up at the top. The only reason I want to control whether VDD is on or off is for when I am disconnecting components while the PICkit2 is still connected to the board.

    But don't worry... there is no problem with anything. As of right now I am fine. Everything is fine :) I am able to program PICs just fine and I was able to bring my PICkit2 back to life after uploading a pdf instead of a hex file for it's OS lol
     
  19. donotbug

    donotbug New Member

    Joined:
    May 14, 2009
    Messages:
    3
    Likes:
    0
    I solved it as follows:
    • Programmed through MPLAB: failed verify
      • (PK2Error0027: Failed verify (Address = 0xF80006 - Expected Value 0x310F - Value Read 0x10F)PK2Error0027: Failed verify (Address = 0xF80006 - Expected Value 0x310F - Value Read 0x10F))
    • Erased the part through MPLAB
    • Checked if blank through MPLAB: failed blank verify
    • Used PICkit II to erase the part
    • Checked if blank through PICkit II: passed blank verify
    • Went back to MPLAB; passed blank verify
    • Programmed through MPLAB: passed verify
    So, it appears that MPLAB is unable to erase the configuration, while PICkit II has no problem doing so.

    (The target was not powered, the part is the PIC30F5011.)
     

Share This Page