• AVR Freaks

Watch out for Low Voltage programming (LVP)

Author
joemickley
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2009/09/11 16:28:07
  • Location: 0
  • Status: offline
2012/03/15 14:41:45 (permalink)
4 (4)

Watch out for Low Voltage programming (LVP)

This just bit me again so I decided to post this note.  The following is for general info.  Anyone with similar experience or more
detail can fill in the blanks.
 
Pay attention to what you do with any PIC device that supports Low Voltage Programming (LVP).  Microchip ships the chips
with CONFIG set to enable LVP. (Unfortunate, but actually a good idea.)  If you do not connect that pin on the part to something
then it comes up at power-up as an input and flapping in the breeze.  The input Z of most PIC decives is 1 MEG ohm or higher as
inputs.  You can inadvertently meet the spec for entry into LVP mode (Quote from AN910 " When the PGC and PGD pins are held to
logic low at the same time as VDD is applied to both PGM and MCLR, the microcontroller enters Programming mode." due to noise
in the system.  If that happens, the device appears to be "locked up".  I have had this happen a number of times on different PIC devices (not often and not consistently).  If you change CONIFG to "LVP OFF" then the proplem goes away but you have to get hold
of the chip for ICSP at least once to load the new CONFIG word.
 
The real focus of the problem is the PGM pin.  If it is kept "well behaved" then the problem goes away.  (It is an "AND" condition to get to LVP.  If any one pin fails to meet the LVP requirement the device won't enter LVP mode.)  I have develiped a general practice of tying PGM off to GND with a 10K resistor, at least in my generic programming fixture  That keeps PGM from seeing a positive tranisent at
turn-on and seems to eliminate the problem.  I haveon occasion taken new chips and reprogrammed CONFIG to turn LVP to OFF and
then put them back into inventory just to get rid of the potential.  (I forgot today and had a brand new 18F2580 get cranky on me for
a first time use.  The 10K resistor and a clip lead made that go away.)
 
This is an inexact event.  It comes and goes with the tide and phase of the moon.  Some devices seem to show it more and others
less so.  When it does lock up there is absolutely no eidence that I can find as to what's going on.  I ran it down on a single chip with
much experimentation.
#1

16 Replies Related Threads

    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/16 03:29:11 (permalink)
    +1 (3)
    Hmm, I always use ICSP high-voltage, and use LVP pin normally after disabling it in code, and put a resistor to VDD at MCLR pin.
    everything ok Smile

    GENOVA :D :D ! GODO
    #2
    joemickley
    Starting Member
    • Total Posts : 35
    • Reward points : 0
    • Joined: 2009/09/11 16:28:07
    • Location: 0
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/16 08:15:35 (permalink)
    0 (2)
    Yep.  My standard implementation is a 6.2K pullup on MCLR and, like you, I use the high voltage programming from a PicKit.  I leave PGD and PGC open (PicKit doesn't like anything on those lines.).  Also, like you, I disable LVP in CONFIG.  This shows up on that very first access to a new part since the part, as shipped, has LVP enabled.  You have to get hold of the part (by its throat) one time to get that new CONFIG word loaded. 
     
    Some of this is ancient history.    Originally I left LVP enabled thinking it was a "don't care".  That caused all kinds of grief as the work/won't work problem came and went.  These days I kill it off. 
     
    It is a really frustrating bug (feature?)  When it shows up as there is no direct evidence as to what's going on, the part just doesn't work.
    #3
    Ian.M
    Super Member
    • Total Posts : 13268
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/16 13:49:05 (permalink)
    0 (2)
    Worse,some older devices cant be programmed reliably using HVP if PGM is high or floating.  Its easy with a PICkit 2 as the AUX pin will drive PGM as required, but for other programmers or target circuits without PGM connected to pin 6 of the ICSP header it can cause major problems.
    #4
    newfound
    Super Member
    • Total Posts : 1849
    • Reward points : 0
    • Joined: 2003/11/07 12:35:49
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/16 14:20:43 (permalink)
    0 (2)
    joemickley

    Yep.  My standard implementation is a 6.2K pullup on MCLR and, like you, I use the high voltage programming from a PicKit.  I leave PGD and PGC open (PicKit doesn't like anything on those lines.).  Also, like you, I disable LVP in CONFIG.  This shows up on that very first access to a new part since the part, as shipped, has LVP enabled.  You have to get hold of the part (by its throat) one time to get that new CONFIG word loaded. 


    In fact it shows up every time you erase the config word. This occurs for *most* 16F series parts that have this failed feature each time a bulk erase is performed. So in fact you are up against the LVP issue each time you reprogram a device, not just the first time - in most cases...


    #5
    mangozac
    Starting Member
    • Total Posts : 49
    • Reward points : 0
    • Joined: 2007/08/13 16:47:15
    • Location: Australia
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/26 21:52:59 (permalink)
    0 (2)
    I've just sorted out a similar issue with the help of a Field Sales Engineer and doing post-solving research came across this thread.

    We've just entered production with a new design that uses the PIC16F1826 - my first project using one of the new enhanced mid range devices. We us a PM3 and custom ICSP programming/test fixtures for production programming. The design was developed using an ICD3 which never had any issues, but the first attempts to program in the production setup were causing a verification failure on one bit of the configuration word: specifically the LVP enable bit.

    At first I thought this was a problem with the PM3, but after speaking to the FSE we got to the bottom of the problem: In the past I've used several PIC16 parts that support LVP but have never had an issue. Briefly referencing the datasheets confirms that these parts are LVP mode by default (from the factory). The configuration word(s) are always generated from the source file and embedded into the hex file, with the LVP set to disabled. It seems though that when configuring the PM3 for programming these older parts it defaults to high voltage programming as intended.

    As per the older devices, the 16F1826 also comes from the factory in LVP mode, but note that this LVP system is quite different from the older parts (there is no longer a PGM pin but instead a special sequence and bit pattern for the MCLR, ICSPCLK and ICSPDATA pins).

    The difference here is that for the 16F1826 (and I would guess the rest of the new enhanced mid range parts) the PM3 is defaulting to low voltage programming. This then caused a verify error because it was trying to program the LVP bit of the config word to 0, which can only be done during high voltage programming. So this bit would verify as a 1 instead of 0.

    The device had otherwise programmed correctly and would have operated just fine (although there could have been issues had I been using the MCLR pin as an input rather than reset), but any verification error in a production environment is unacceptable.

    The word from the FSE is that Microchip will gradually shift away from high voltage programming to the kind of low voltage programming incorporated in these newer enhance mid range parts. High voltages like the 13.6V that HVP presents to the VPP pin are no longer required for EPROM/EEPROM/flash memory programming, and newer, smaller process technologies are intolerant of such relatively high voltages.

    So the bottom line: whenever you can spare the MCLR pin use low voltage programming where possible on newer parts. Since it doesn't require a dedicated PGM pin anymore it's practically no different to standard high voltage ICSP.
    post edited by mangozac - 2012/03/26 22:04:06
    #6
    NKurzman
    A Guy on the Net
    • Total Posts : 18038
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/27 08:56:24 (permalink)
    0 (2)
    The New 61F1XXX parts use a VPP of 8 volts. It is still Not LVP.  LVP is programmed at Vcc.  It should always be disabled.  It is rarely used, And I assume those users know what they need.
    I do not think any of the ICD2 & 3 or the Pickit2 & 3 use LVP.
    #7
    mangozac
    Starting Member
    • Total Posts : 49
    • Reward points : 0
    • Joined: 2007/08/13 16:47:15
    • Location: Australia
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/03/27 13:39:13 (permalink)
    0 (2)
    That's correct, the 8V programming is still classified as HVP, but that's not what I'm talking about. The 16F1xxx parts have a new LVP mode supported by at least the ICD3 and PM3, which *should* be used where possible, and into the future is likely to become the preferred programming method.

    ICD3 and PICkit3 have variable voltage Vpp circuits so can program using 13.6V HVP, 8V HVP and past and current LVP mechanisms.
    #8
    NealR
    Super Member
    • Total Posts : 277
    • Reward points : 0
    • Joined: 2008/03/28 10:58:46
    • Location: Hollywood, FL
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/07/25 06:11:31 (permalink)
    0 (2)
    All,
    I currently have a posting that I believe relates to this issue.  It was some of the items that NKurzman mentioned that made me research this further.  I am currently using a PIC24F32KA301.  I have 1 questions and 1 comment.
     
    1.  What config bit sets LVP?
    2.  I placed a 10k resistor between the PGM pin on the PICKit3 and GND.
     
    This has not solved the problem fully.  But it has slightly improved the behavior.  In combination with an 8 inch long programming cable AND a 10k resistor between PGM and GND, I only have to cycle the power on/off 2 to 3 times rather than 5 to 6 times.
     

    Sincerely,
    Neal Rosenblum (KB8PFV) 
    MPLAB X IDE v2.35
    ICD3
    X16 Compiler
    #9
    newfound
    Super Member
    • Total Posts : 1849
    • Reward points : 0
    • Joined: 2003/11/07 12:35:49
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/07/25 06:51:36 (permalink)
    0 (2)
    The LVP issues discussed in this thread have nothing to do with any dsPIC, PIC24,  PIC32 or PIC18FJ at all.  Even the variations that support both a high and low voltage programming modes. None of these parts have a LVP config bit or PGM pin.
     
    The fact that you are getting some change with the pickit 3 is not related to the PIC24 as the PGM pin is not (should not) be connected to anything.  It serves no purpose.
    #10
    NealR
    Super Member
    • Total Posts : 277
    • Reward points : 0
    • Joined: 2008/03/28 10:58:46
    • Location: Hollywood, FL
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/07/25 06:59:56 (permalink)
    0 (2)
    Dear Newfound,
     
    Can this be from a reduction in programming cable length?
     
    --Neal

    Sincerely,
    Neal Rosenblum (KB8PFV) 
    MPLAB X IDE v2.35
    ICD3
    X16 Compiler
    #11
    newfound
    Super Member
    • Total Posts : 1849
    • Reward points : 0
    • Joined: 2003/11/07 12:35:49
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/07/25 07:23:54 (permalink)
    0 (2)
    Maybe, it does seem to be on the long side. I would try directly connecting the pickit 3 with a male - male header and see if that helps.
     
    In all honesty I know very little about the pickit 3 and how it is interacting with your target board.  I would only be guessing in the dark.  In fact reading what others have said I'm actually learning about it myself.
    #12
    PStechPaul
    Super Member
    • Total Posts : 2441
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/09/03 22:34:46 (permalink)
    -2 (1)
    I just spent several hours wrestling with this issue. I started a new project using the PIC18F2431 template which only has one sample CONFIG directive. I added others as needed but neglected to turn off the LVP which is on PB5 which is also one of the PWM lines. The other lines would sometimes work but not PB5. I thought it was the bridge driver but when I disconnected PB5 none of the lines worked. I suspected a missing ground and tried all sorts of things, but when I looked closely at the port B pins I saw that PB5 was LVP, and I recalled seeing that it was enabled. After changing the CONFIG all now seems OK.
     
    This is a supreme annoyance and I don't understand the logic behind having LVP as default when the pin is so vital to the operation of this PIC, especially, for three phase motor control. And in any case I think the default should be the most "generic" set of features. I think I had another similar issue with analog pins and a comparator in another PIC, perhaps the PIC16F684 which I have used a lot.
     
    Oh, well. I had hoped to spend my time working with this circuit but now I'm about done for the day. Perhaps the templates should be revised with all of the CONFIGs explicitly set and I think the LVP should be DISabled. I suppose ranting about it does no good but I felt this needed to be kept in the limelight as a "gotcha". [:-]

     
    #13
    PStechPaul
    Super Member
    • Total Posts : 2441
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2012/09/03 22:35:12 (permalink)
    -2 (1)
    sorry - duplicate - can't delete?
    post edited by PStechPaul - 2012/09/03 22:40:07
    #14
    narender
    New Member
    • Total Posts : 26
    • Reward points : 0
    • Joined: 2013/10/01 12:23:54
    • Location: 0
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2013/10/07 10:53:16 (permalink)
    0 (2)
    Debug error with pickit 3 debug express
    "device not ready to debug check configuration bits or program first"
    #15
    christou2c
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2015/03/27 15:08:21
    • Location: 0
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2015/06/30 16:56:42 (permalink)
    0
    i'm designing my pic32 board so where do the 6 = PGM (LVP) goes?? on the pic.
    #16
    ric
    Super Member
    • Total Posts : 24593
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re:Watch out for Low Voltage programming (LVP) 2015/06/30 16:59:37 (permalink)
    0 (1)
    christos christou
    i'm designing my pic32 board so where do the 6 = PGM (LVP) goes?? on the pic.


    Nowhere, it is not used. See post#10 above.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #17
    Jump to:
    © 2019 APG vNext Commercial Version 4.5