Loss of OSCCAL value during programming

Author
tmig
Senior Member
  • Total Posts : 163
  • Reward points : 0
  • Joined: 2007/04/18 09:34:33
  • Location: cape cod
  • Status: offline
2008/01/22 08:19:22 (permalink)
0

Loss of OSCCAL value during programming

My engineering group uses a lot of 629s,675s,630s,676s. Occasionally we loose the OSCCAL value during reprogramming; this happens just often enough and is just annoying enough so that I have gotten into the habit of writing down the OSCCAL value before reprogramming. If I forget to write it down then I use the old version of the PICKit software 1.21 to regenerate it, but that's a tedious process.
I have seen this behavior with these parts on other programmers, including the PM3s we use in production programming, but the group here claims the incidences have increased since I got them to switch to using the PK2. (Note this has NOT been my experience - I think they just like to complain) The parts are programmed in circuit directly from the PK2 software, not from inside MPLAB, which can be problematic itself. The circuits are carefully designed to allow ICSP, and like I said this is a relatively rare occurrence. Has anyone else experienced this issue, and can anyone explain the exact mechanism that would cause the OSCCAL to be lost during an otherwise normal programming cycle; but most importantly, is there a reliable way to prevent it?

Thanks

#1

6 Replies Related Threads

    Olin Lathrop
    Super Member
    • Total Posts : 7463
    • Reward points : 0
    • Joined: 2004/02/26 17:59:01
    • Location: Littleton Massachusetts
    • Status: offline
    RE: Loss of OSCCAL value during programming 2008/01/22 08:38:10 (permalink)
    5 (1)
    can anyone explain the exact mechanism that would cause the OSCCAL to be lost during an otherwise normal programming cycle; but most importantly, is there a reliable way to prevent it?

    The OSCCAL value is erased along with everything else when a bulk erase is performed.  Good programmer software would read the value first, do the bulk erase, then reprogram it as quickly as possible.  It is possible for something to go wrong, like communication lost, power glitch, etc, after the bulk erase but before the value is restored.
     
    While this scenario is theoretically possible, I've never actually seen it happen.  Just in case, my programming software shows the OSCCAL value to standard output before doing the bulk erase.  If something gets screwed up, then you might still be able to recover manually if you see what the program wrote out before something went wrong.
    #2
    PICkit2Dev
    Super Member
    • Total Posts : 994
    • Reward points : 0
    • Joined: 2006/09/27 08:41:47
    • Location: 0
    • Status: offline
    RE: Loss of OSCCAL value during programming 2008/01/22 09:43:06 (permalink)
    0
    tmig,
     
    The PICkit 2 software version 2.40 will prompt the user before a Write operation to abort it if the OSCCAL value is invalid.  This prevents loss due to an improper read of the value during a WRITE operation.
     
    The only mechanism I'm aware that would resut in loss of the value is if a WRITE operation was begun that failed to complete - something interrupted it after erasing the part but before programming completed.  This could be disconnecting the PICkit 2 during programming or some other interference.
     
    Check if the group sees this after a failed programming operation.
    #3
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Loss of OSCCAL value during programming 2008/01/23 05:22:55 (permalink)
    0
    That is why it is good to bring back the OSCCAL calibration value regeneration feature back from the V1.x software. It is in the wish list thread.
    http://forum.microchip.com/tm.aspx?m=260540

      USB_Links and libusb
    #4
    tmig
    Senior Member
    • Total Posts : 163
    • Reward points : 0
    • Joined: 2007/04/18 09:34:33
    • Location: cape cod
    • Status: offline
    RE: Loss of OSCCAL value during programming 2008/01/23 09:40:56 (permalink)
    0
    I know its a tough question with few details, so the lack of a definitive answer is not big surprise. My own thoughts were related to the USB interface communications and power supply, and some interruption related to them as you mention. One thing I forgot to mention was that we use laptops, and I know that some USB ports can be problematic. I guess nobody has seen any failures they can trace to this.

    If you trace xiaofan's thread back far enough you might find my request for the OSCCAL calibration value regeneration feature to be returned too.Smile

    Thanks 
    #5
    Ian.M
    Super Member
    • Total Posts : 13114
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re: RE: Loss of OSCCAL value during programming 2012/02/08 09:12:09 (permalink)
    5 (1)
    I've resurrected this very old thread, because it is the clearest statement of the problem with no unrelated junk and mistaken conclusions that I have seen.

    I have been experiencing OSCAL corruption with a PIC12F675 and MPLAB 8.83 using a PICkit 2 programmer.
    The application uses GP0 and GP1 for PWM output with /MCLR disabled and MPLAB frequently corrupts the OSCAL value EVEN THOUGH THE PIC VERIFIES OK IN MPLAB.   Fortunately the PICkit 2 standalone software version 2.61 HAS got the OSCAL regeneration feature and it DOES work.

    If you have forgotten to write down your OSCAL value, here is the procedure to regenerate it successfully:



    N.B. you *MAY* need to enable 'Use VPP First Program Entry'.  The extra erase step gets rid of the offending code that caused OSCCAL to be lost in the first place.


    Attached Image(s)

    #6
    Ian.M
    Super Member
    • Total Posts : 13114
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re: RE: Loss of OSCCAL value during programming 2013/02/05 08:55:59 (permalink)
    5 (2)
    Hardware method to find OSCCAL value for non-PICkit 1 or 2 owners.

    The PICkit 1 Classic software has an OSCCAL regeneration option.  Read the chip, check the OSCAL value displayed is of the form 0x34nn and if not, read sections 2.2.7-2.2.10 of the PICkit 1 user manual for instructions.
    post edited by Ian.M - 2014/02/03 06:49:34
    #7
    Jump to:
    © 2018 APG vNext Trial Version 4.5