Jim Robertson of NEWFOUND ELECTRONICS says
Here is the results of some experimenting with the new 16F87x flash parts. There is a hidden problem with programming these parts and it relates to the low voltage program mode and the low voltage program control pin RB3. The type of programming problems I found are similar to those reported on the piclist by several others.
When these parts a blank (like when new) or any other time the when the LVP config bit is programmed as a '1' the state of RB3 becomes an issue. It must NOT be tied high as VDD rises or unpredictable results occur. I could not get any satisfaction trying to read or program a part in this condition. Exactly why I cannot say. It appears that the chips cannot enter either the low or high voltage programming state. This condition is not documented in the programming specs so we are left to wonder.
If RB3 is low there is no problem.
It would not be a good idea to leave RB3 floating as it is an input. I believe this may also cause unpredictable results but based on my tests they are not as common as when RB3 is held high.
The implications of this are:
- Some programmers will not be able to program these flash parts unless modified. Three programmers in this boat include the propic II, Multi picpro and the first release of my own warp-13 (there are details of work arounds on my web page. The newer Warp-13a has a hardware fix.) No doubt there are other programmers in this group.
- Most programmers should have a resistor fitted to ground on RB3 to prevent this input from floating.
- ICSP will need to be modified to allow for the role of RB3. For many apps 5-wire ICSP will need to became 6-wire ICSP with RB3 also connected. If the target circuit holds RB3 low this will not be required.
- Care must be taken to ensure that the circuit on a target board ICSP allows for RB3 to be pulled low via the programmer.
I believe when these considerations are taken the problems with programming the flash parts will disappear as they have for me.
Octavio (PROPIC II) also had discovered this problem independently from myself and Tony's solution is actually originally from Octavio who told me in private email (after I had posted the above) and I told Tony in a phone conversation. My solution was to add a separate transistor switching stage to the RB3 pin.
[Ed: NOBODY knows how to program these chips like Jim. Period. If he says it (and many others have confirmed this finding of his) then it is. I would listen to the advice on this page over datasheets, FAE's, Microchip enginners, or just about anyone else.]
Now, Microchip has documented the problem, albeit not in the datasheets and not very clearly, in the following errata:
http://www.microchip.com/10/lit/suppdoc/errata/er870871/index.htm PIC16F870/871 Rev. A1 Silicon (30 K) 6/7/2000
http://www.microchip.com/10/lit/suppdoc/errata/er16f872/index.htm PIC16F872 Rev. A2 Silicon (32 K) 6/7/2000
Jim Robertson of NEWFOUND ELECTRONICS comments on the errata:
The fact that it is not mentioned for later silicon versions for the 16F874/6/7 does not mean it has been fixed, it means that at the time the errata was written they did not know about the problem.
Have a look at the dates of the errata sheets. The fact is that the 16F870/1/2 errata sheets are later than the 16F874/6/7 and even though the silicon has a lower revision number the fact is that it is later silicon and still has the problem.
I have 16F877s with date code 9924 and these certainly have the problem and yet it is not mentioned on a later errata sheet.
Also: Programming Modes
Byron A Jeff provides a nice FAQ on this subject:
> Can someone simply say whether I can or can NOT use the RB3 pin on a = > PIC16F876 as a general purpose output? Yes. Under certain conditions... > > To program I pull it high with a 10k resistor on my PICPRO16 ? (Yes/No) Yes. > > I can do what I like with it after power up (Yes/No) No. The pin has 4 different modes: 1) Programming mode with LVP config bit on. Should be pulled high to indicate programming mode. 2) Programming mode with LVP config bit off. Should be grounded. Do this even though LVP isn't set. Do this even though you're programming with high voltage. I know it shouldn't matter, but empirical evidence on the list indicates that it does matter unfortunately. 2) Run mode with LVP config bit on. Must be pulled low otherwise will go into programming mode. 3) Run mode with LVP config bit off. It's now a general purpose bit that you can do anything you wish. Note that the LVP config bit must be off for this to occur. You should never have a problem if you follow the rules above. Also in state 2 it programs properly most of the time even if the LVP pin is left floating. But it's better to ground it (through a resistor of course) if you can. > > The "PIC16F872 Silicon Errata Sheet" on the subject of ICSP and the LVP = > pin says.... > > "If Low Voltage Programming is not required in the application, it = > should be disabled" =20 > Q: How?, just by programming it once with RB3 pulled high to turn it = > off? No by setting the LVP config bit off. > > "All future programming cycles will not require pin RB3 to be pulled or = > driven low after LVP is disabled"=20 > Q: Does it mean all future cycles of the current programming sequence or = > any future new programs to be loaded at some date later, i.e. in the = > field? This is the iffy one. In theory once the LVP config bit is off RB3 should revert to normal usage in both programming and run mode. It does in run mode, but unfortunately some versions of the chip still responds to that pin as an LVP input pin in programming mode. Driving it low is the only way to guarantee proper programming operation for all chips, all the time. And the answer to your question is all programming cycles after the current one is completed. But to be safe it's best to ground the pin when programming it externally even if using high voltage programming. Of course if you're using a bootloader, then the point is moot. > > I've read conflicting threads about LVP and RB3. Some say don't use it = > (Jim I think) but yet the data sheet says I can? What have I missed? The different modes. The critical mode is LVP config bit off and programming mode selected (via high voltage on MCLR). You need to be aware of RB3 even though it's no being used. Once you turn off the LVP config bit, RB3 becomes normal in run mode. > > What I want to do is program my PIC and use RB3 as a clock output = > (manually clock a serial to parallel 74HC595 chip) Fine. Turn off the LVP config bit and use it normally. > If I can't I'll use another pin on a spare port but what do I do with = > RB3, just keep it pulled high with a 10k resistor? Always pull it low if you're not sure how it's going to be used or unsure of the state of the LVP bit of the chip. Because it will go into programming mode if that MVP config bit is on, and the RB3 bit is high. > > So many questions I know, sorry. I've used the 16F84 for ages and it's = > never given me a problem but the 16F876 is causing a few head aches. BTW your absolute best bet is to load a bootloader, turn RB3 off then proceed to program the chip thereafter using the bootloader. You don't have to move it from its socket, and you never have to worry about RB3 again.
David A Cary Says: " John Andrews of Microchip has a few more details " +
Says: " VPP, applied to the MCLR pin is 13.07V and rises in less than 200 ns. " +
|file: /Techref/microchip/16F877/hvprog.htm, 10KB, , updated: 2010/12/21 23:27, local time: 2018/12/13 06:36,
|©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/microchip/16F877/hvprog.htm"> Can't program 16f8xx in traditional high voltage programmer?</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20181213 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Neil, Isaac M. Bavaresco, Bob Blick, Harold Hallikainen, AB Pearce - UKRI STFC, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!