PICKit2 Error Message

Discussion in 'Embedded Systems and Microcontrollers' started by tracecom, Mar 6, 2013.

  1. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    Here's my code for writing to a serial LCD.

    Code ( (Unknown Language)):
    1. '****************************************************************
    2. '*  Name    : Serial LCD.pbp                                    *
    3. '*  Author  : tracecom*
    4. '*  Notice  : Copyright (c) 2013 Trace Communications           *
    5. '*          : All Rights Reserved                               *
    6. '*  Date    : 3/5/2013                                          *
    7. '*  Version : 1.1                                               *
    8. '*  Notes   : PIC16F84A                                         *
    9. '*          : Modern Device LCD117 Serial Adapter & 2x16 LCD.   *
    10. '****************************************************************
    11. Include "modedefs.bas"
    12. serout PORTB.0,T9600,["?BFF"] ' Set LCD backlight to maximum brightness.
    13. PAUSE 200 ' Pause to allow LCD EEPROM to program.
    14. SEROUT PORTB.0,T9600,["?G216"]' Configure the LCD geometry: 2x16.
    15. PAUSE 200 ' Pause to allow LCD EEPROM to program.
    16. main:
    17. pause 1000 ' Wait for the LCD to startup.
    18. serout PORTB.0,T9600,["?f"] ' Clear the screen.
    19. pause 1000 ' Wait one second.
    20. serout PORTB.0,T9600,["Wherever you go,"] ' Send the string "Wherever you go,".
    21. serout PORTB.0,T9600,["?m"] ' Move the cursor to the second line.
    22. serout PORTB.0,T9600,[" there you are."] ' Send the string " there you are.".
    23. pause 1000 ' Wait one second.
    24. goto main ' Do it again.
    The code compiles fine, downloads, and runs. However, the PICkit2 gives me this error message.

    Verification of configuration failed.

    What does this mean, and how should I correct the problem?

    Thanks.
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    The PICkit 2 (and any decent programmer) will first write the information, then read it back and check it for accuracy.

    The checks do keep code space and configuration bits separately. "Verification of configuration failed." means the configuration bits did not read back as intended... the code may be OK, but I believe as soon as a verify error is noted it stops... I think code is checked first but I'm not 100% sure. Anyway, fix the problem you have.

    As long as there are no other messages or warnings present it may just be a configuration problem... by that I mean I do not see how the PBP code is setting these bits, if at all. I hardly ever use PBP anymore, but this may be the config code:

    Code ( (Unknown Language)):
    1. #CONFIG
    2. __CONFIG _CONFIG, _XT_OSC, _WDT_OFF, _PWRTE_OFF, _CP_OFF
    3. ;Set HS osc, watchdog timer disabled, power-up timer off, Code-Protection disabled
    4. #ENDCONFIG
    First, you need to set the config (that should work for an external crystal), and if you don't set it you may be sending bits that are not used and thus cannot be set/reset and can't be verified.

    See if that helps and holla back.
     
  3. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    Thanks for your input; I believe that puts me on the right track.

    Here is what I think I understand. PBP3 automatically sets the configuration bits if no config block is included in the code. But an included config block overrides the default settings in PBP3. Here are the default settings.

    Code ( (Unknown Language)):
    1.  
    2. #CONFIG
    3.   __config _XT_OSC & _WDT_ON & _CP_OFF
    4. #ENDCONFIG
    5.  
    I tried that, and still got the error message. There are only four options in the config for the 16F84A: oscillator selection, watchdog timer, power up timer, and code protection. So I tried the following.

    Code ( (Unknown Language)):
    1.  
    2. #config
    3.  __config _XT_OSC & _WDT_ON & _PWRTE_ON & _CP_OFF
    4. #endconfig
    5.  
    But I still get the error message. Of course, my code still runs fine, but my pedantic nature won't let me rest until I understand what's going on.
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    I have the same pedantic nature so I would be doing just the same. Are you programming from inside Microcode Studio (of which I know little) or from the PICkit 2 stand alone app? In the stand-alone you can load the hex file, then play with the config bits. That may clear up the error.
     
    tracecom likes this.
  5. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    In Microcode Studio, the program command actually calls the standalone PICkit2 software, and then one must load the appropriate hex file before writing to the PIC, so it's the same either way. I'll try it again and see if there's anything I can spot in the PICkit2 software.
     
  6. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    OK, here's the answer.

    The PIC16F84A has a 14 bit configuration word. Bits 13-4 all control code protection and should be high when code protection is disabled. PBP3's #config command to disable code protection is _CP_OFF, but it does not compile to make all bits 13-4 high; bit 4 is left low. Thus, code protection is enabled and verfication of the code is impossible, so the error message Verification of configuration failed. is correct.

    Using the configuration word editor in the PICkit2 software to change bit 4 from 0 to 1, and then writing the code to the 16F84A results in a Programming Successful message.

    So, apparently I have just found my first bug in PBP3. I can't help but wonder how many more there are. :confused:
     
    Last edited: Mar 6, 2013
  7. bance

    Member

    Aug 11, 2012
    315
    34
    Well done! Now try to report it to the PBP3 dev's so they can sort it....

    That way you'll help all other users. ;-)
     
  8. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    I just sent an e-mail, but I wonder if it will have any effect.


    And a big THANK YOU to ErnieM; I never would have figured it out on my own.
     
    Last edited: Mar 6, 2013
  9. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    Ah, code protect. If they actually read your email they will toss it.

    By design code protected parts fail the code check. If they didn't someone would be exploiting the "peek at the code" backdoor to extract the source code.

    Glad you got it... I've had things like this hang me for days. (I spent most of January worrying out a bad build till I discovered one very crucial wire not attached to where my schematic said it was.)
     
  10. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    Now I have to eat a little crow. It turns out that I had the compiler set for a 16F628 instead of a 16F84A, so the whole thing was my stupid error.

    On the positive side, I learned something about configuration words.
     
  11. bance

    Member

    Aug 11, 2012
    315
    34
    I've done that !!!!!!!!!! :p
     
  12. Robert Webb

    New Member

    Dec 20, 2014
    18
    0
    Hi
    I just wanted to thank you for the information I have just read in a PICkit2 discussion regarding the "Verification of configuration failed." message.
    I am not a programmer but need to program some chips for some clocks I am making and have a program written by somebody else that allows me to I fiddle with the numbers to change space between output electronic pulses which I use to activate a coil in the clock.
    Until I read this thread I had assumed that that dreaded message meant that the programmer had failed. My problem is that I sometimes get the message interspersed with the programming successful message. It has been a bit frustrating.
    This has been an incredibly helpful forum for me and I just wanted to record my thanks.
    Bob
    Brisbane
     
Loading...