PICKit2 Error Message

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
Here's my code for writing to a serial LCD.

Rich (BB code):
'****************************************************************
'*  Name    : Serial LCD.pbp                                    *
'*  Author  : tracecom*
'*  Notice  : Copyright (c) 2013 Trace Communications           *
'*          : All Rights Reserved                               *
'*  Date    : 3/5/2013                                          *
'*  Version : 1.1                                               *
'*  Notes   : PIC16F84A                                         *
'*          : Modern Device LCD117 Serial Adapter & 2x16 LCD.   *
'****************************************************************
Include "modedefs.bas"
serout PORTB.0,T9600,["?BFF"] ' Set LCD backlight to maximum brightness.
PAUSE 200 ' Pause to allow LCD EEPROM to program.
SEROUT PORTB.0,T9600,["?G216"]' Configure the LCD geometry: 2x16.
PAUSE 200 ' Pause to allow LCD EEPROM to program.
main:
pause 1000 ' Wait for the LCD to startup.
serout PORTB.0,T9600,["?f"] ' Clear the screen.
pause 1000 ' Wait one second.
serout PORTB.0,T9600,["Wherever you go,"] ' Send the string "Wherever you go,".
serout PORTB.0,T9600,["?m"] ' Move the cursor to the second line.
serout PORTB.0,T9600,[" there you are."] ' Send the string " there you are.".
pause 1000 ' Wait one second.
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.
 

ErnieM

Joined Apr 24, 2011
8,377
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:

Rich (BB code):
#CONFIG
__CONFIG _CONFIG, _XT_OSC, _WDT_OFF, _PWRTE_OFF, _CP_OFF 
;Set HS osc, watchdog timer disabled, power-up timer off, Code-Protection disabled
#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.
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
See if that helps and holla back.
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.

Rich (BB code):
#CONFIG
  __config _XT_OSC & _WDT_ON & _CP_OFF
#ENDCONFIG
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.

Rich (BB code):
#config
 __config _XT_OSC & _WDT_ON & _PWRTE_ON & _CP_OFF 
#endconfig
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.
 

ErnieM

Joined Apr 24, 2011
8,377
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.
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.
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
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.
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.
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
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:

bance

Joined Aug 11, 2012
315
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. ;-)
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
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. ;-)
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:

ErnieM

Joined Apr 24, 2011
8,377
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.)
 

Thread Starter

tracecom

Joined Apr 16, 2010
3,944
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.
 

Robert Webb

Joined Dec 20, 2014
18
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
 
Top