CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with programming the fuses

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Problem with programming the fuses
PostPosted: Thu Jun 24, 2004 8:07 pm     Reply with quote

PIC16F870-I/SP, PCWH3.190
XTAL:4.00MHz
Fuses:XT,WDT,NOLVP,PUT,BROWNOUT

I just received a few sample boards of one of the circuits I've designed from the manufacturer. When I try to program any of the boards, it appears to program fine, but after than the ICD.EXE (or the debugger inside PCWH) reports a fuse verfication failure: The PIC is always LVP. It seems the ICD can not program it to NOLVP.
I am not using the LVP feature and the Low Voltage Programming pin of the ICD is not even connected to anywhere in the circuit.
This happens to all the sample boards. Just to be sure, I took one of the PICs out, put it in a different board (different design, but exactly the same circuitry around MCLR,RB6 and RB7) and programmed it with the exact same code. It programmed with no problem. Then put the PIC back in the new sample boards and the same problem happened again.
Does anyone know the reason for this?
I've made sure the VCC and both the ground pins of the PIC are connected properly, the 4MHz XTAL is working fine and VCC is a solid 5v.
I'm out of ideas...I appreciate any help...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 1:46 am     Reply with quote

What you're saying is, you cannot program the LVP config bit
in a certain set of new PCB boards. But you can move a PIC
from one of these boards to an older, different board, and
the ICSP works just fine.

That indicates the problem is very likely in the circuitry of
the new boards.

Things to try on your new board:

1. Connect a 10K resistor between Ground and the PGM pin (RB3)
of the PIC. Watch it with an oscilloscope while programming is in
progress. Does it stay at 0 volts ? Does this cure the problem ?

2. CCS doesn't post any manuals for their ICD units. They're very
secretive about them. Is the CCS ICD really a High Voltage
programmer ? I've always assumed so, but who knows, since
they don't say anything about it. The symptoms you're seeing
(can't program the LVP bit) are exactly what you'd see with a LVP-
mode programmer. You can verify if it's a HVP programmer by
looking at the MCLR pin during programming. Does it go up to
about 13 volts ?

3. Does the ICD provide power to your board ? Or is your board
self-powered ? What I'm concerned about is the number of
bypass caps on the Vdd pin of the PIC. Is there any difference
between the two boards, in this respect ?

4. Verify with an ohmmeter that the PGM pin on the CCS ICD is not
shorted to any other pin inside the ICD.

5. Possibly, if nothing else works, buy a Microchip ICD2 for $159 (US).
This is the price without the external power supply, which you don't
need if your board is self-powered. (ie., it runs off a battery or wall-
wart during programming, instead of taking power from the ICD2).
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 3:21 am     Reply with quote

Thanks for your reply...RB3 is connected to a LED via a resistor. Therefore I need to use NOLVP. Because the LVP fuse doesn't program properly, ICD refuses to allow me debug the code.
It is Friday evening in Australia now and I'm not at work anymore. But to answer a few of your questions:

1.As I said RB3 is going to a LED and not to ICD at all. So I don't think this is the problem...however I'll monitor it's voltage just to see how it behaves.

2.I'll monitor the programming voltage. But the same ICD works with the same PIC on a different board with a differet design.

3.The board is self-powered, but...the stupid people who laid out the board put the PIC's decoupling capacitor on the oposite edge of the board, far from the PIC (about 6cm). Can this be the problem? I actually suspected this, but I looked at the Vdd with a scope during the programming and it looked fine. The working board has the bypass cap propely located.
Actually this is one of the reasons that working with this board is so hard...I had no control over the board lay-out and production. The company decided to manufacture it overseas just to 'save costs'. Yes we got it cheap but...It is a surface mount board, but the components are all soldered by hand, sitting crooked and looking suspicious. I have already found a diode inserted backwards, and a RJ12 socket also wired backwards. God knows how more are waiting to be found. The board looks so bad I don't even know where to start debugging it. I need to figure out the reason for this LVP problem before I can get to the manufacturer and request new boards with all the problems fixed...

4. I have done this. PGM Looks fine.

5. My ICDs are Microchip ICDs but running CCS code. I'll drop the Microchip code in one of them and try MPLAB to see if it makes any difference...


I don't even know if the chips is programming alright or not (the code)...maybe there are flash verification failures too but they are not reported because ICD verifies the fuses first. Therefore I'll also program the PIC with a simple code that flashes one of the LEDs, to check this.

Please let me know if you have any other ideas/comments. I appreciate your help.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Another clue
PostPosted: Sun Jun 27, 2004 6:29 pm     Reply with quote

Good morning from Australia...

Well I got another clue. I tried some more PICs in the board, and ICD can not detect some of them at all. So out of all the PICs I've put in the board some fail programming (LVP & NOLVP), and the others don't even respond to the ICD. All these PIC work fine in the different design board. Any ideas...?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 27, 2004 7:02 pm     Reply with quote

I would use an X-acto knife and soldering iron to make the new
boards look as much like the old boards as possible, in an electrical
sense. For example, you said that the new boards do not have
a bypass cap (or caps) mounted near the PIC. I would tack a
100 nF cap on each Vcc pin.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Sun Jun 27, 2004 10:44 pm     Reply with quote

I found the problem.

I started testing all the tracks exhaustively and noticed that there was a connection bewteen MCLR and a voltage divider I had in the circuit (the draftman's mistake). So basically aside from the usual circuitry, there was also a pull-up of 2.2k and a pull down of 3.9k present on the MCLR pin, and that was what was causing the trouble.
PCM Programmer was close when he suggested that something is not allowing the programing voltage to rise high enough.

On a seperate note, I noticed that they have made another mistake. For the PIC's bypass cap (aside from the fact that it is located too far, this will be fixed), they have used an electrolyte 10uF capacitor instead of the usual 100nF I had put on the schematics. Is this still ok, or do I need to tell them to change it? The problem is that have already bought the parts for taking this thing to mass production, and I prefer not to change any component values if I don't need to (although it is their fault). So are there any implication in using a 10uF electrolyte as the PIC's bypass capacitor? Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 28, 2004 12:21 am     Reply with quote

Quote:

They have used an electrolyte 10uF capacitor instead of the usual 100nF
I had put on the schematics. Is this still ok, or do I need to tell them to
change it?

I think of aluminum electrolytics as basically audio-frequency capacitors.
That's a bit of an exaggeration, but they're really only good up to about
100 KHz. After that, they stop acting as capacitors. They act like
resistors (impedance doesn't change, regardless of frequency change),
or even like inductors. On this Panasonic page, download the data
sheet for the FK series of SMT aluminum electrolytic caps.
http://www.panasonic.com/industrial/components/electrolytic_smt.htm
On page 4, there's a graph titled "16WV". The top plot is for the 10 uF
cap. Above 100 KHz, the line is flat.

For some reason, the Panasonic data sheets for their MLCC caps
don't have frequency graphs. Look at this Kemet page instead.
Download the doc called "Ceramic chip performance characteristics".
http://www.kemet.com/kemet/web/homepage/kechome.nsf/vabypagename/pdfcat
For a Z5U, 0.1 uF, which is probably a typical low-cost bypass cap, they
show it's good up to about 10 MHz. (See Figure 6 on page 5. Look at
the plot labeled 1206 104 Z5U).

The ceramics are far better at high frequencies and that's why it's
standard practice to use them for bypass caps on IC power pins.

You should have some bulk capacitance on the board. On a small board
with a linear regulator (LM340T-5.0) I put a 10 or 22 uF Tantalum
capacitor on the output pin of the regulator. This takes care of whatever
requirements the regulator has for an output cap, as well as taking care
of the "bulk" capacitance for the rest of the board.

Even though some of the data sheets for linear regulators claim you
don't need an output cap, or they recommend just a 0.1 uF cap, I think
that's basically a lie. One time, I decided to believe them and left off
the output cap on a proto board of a new design. Result: Tons of noise
all over the +5v bus. I tacked a 10 uF / 16v Tantalum onto the regulator
output pin and the noise went away. Never again.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Jul 01, 2004 10:03 pm     Reply with quote

Thanks for the reply. I think I'll stick with the 10uf caps since it is an audio circuit.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jul 02, 2004 10:40 am     Reply with quote

I think you are missing the point PCM-programmer was making. The fact that your circuit is an audio circuit has nothing to do with the value of the bypass capacitor. A 10uF cap is filtering to about 100kHz. Yes, this is audio range, but the bypass cap is meant to filter the spikes from the pic-processor which is running somewhere between 1MHz to 40MHz? So basically, a 10uF electrolyte capacitor is definately not the same as a bypass cap! You can put the 10uF into the circuit, always better than throwing them into a box for later usage, but it will do nothing for your high frequency noise on the power supply lines.

Then the question remains: Is a bypass capacitor really required?

I've always designed one in, so haven't experienced the effects from leaving one out. Can someone with more electronics experience shine a light on this?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group