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

Having PIC16F872 Failures

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







Having PIC16F872 Failures
PostPosted: Thu Jun 24, 2004 8:23 am     Reply with quote

Sad

Has anybody had chip failures due to the chip program memory being corrupted when #fuse NOPROTECT is being utilized?

We are seeing complete chip failures after several days of use in a temperature control system.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 24, 2004 1:01 pm     Reply with quote

What do you mean by "complete chip failures" ?

If you left the chip in LVP mode and left the RB3
pin as an floating input, the chip could appear to
mysteriously lock up.

Post your #fuses statement and your version of the compiler.
bassplayer
Guest







reply to fuses statement
PostPosted: Thu Jun 24, 2004 2:32 pm     Reply with quote

The fuses statement are as follows:

#fuses XT, NOWDT, NOLVP, PUT, NOPROTECT, NOBROWNOUT, NOWRT

I am driving a IRL540 MOSFET on RC2 and driving a led on RC7.

RB0 thru RB8 have a DIP switches connected.

RA0 has a NTC thermistor connected.

The failures I am seeing are a distorted sinewave clock signal and excessive current cusumption in the PIC device - approx 250 ma at 5 VDC.

I am utilizing an AT strip cut crystal with 15 pf bypass caps.

The failures happen after the units have been running for a period of time
bassplayer
Guest







version of compiler
PostPosted: Thu Jun 24, 2004 2:35 pm     Reply with quote

The version of compiler:

IDE Version 3.26
PCB Version 3.148
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 24, 2004 2:58 pm     Reply with quote

First thoughts:

1. Latch-up. What's your MCLR circuit ? Do you have a series
resistor on it ? Any diodes on it ?

2. Do you have a series resistor between pin C2 and the gate of
the Mosfet ?

3. Do the DIP switches have series resistors ?
(ie., what if an input pin somehow was re-programmed to
be a high-level output pin ?)

4. Is your circuit running in an electrically noisy environment ?
How much noise is on the +5v rail ?

Could you trouble-shoot the problem by:
1. Disconnecting the FET from the PIC.
2. Putting all Dip switches into the OFF state.

I'm looking for anything weird on the PIC pins that could be
putting it into latch-up. My major suspicions are MCLR and the FET.
Bassplayer
Guest







More Design Data
PostPosted: Thu Jun 24, 2004 3:54 pm     Reply with quote

Your technical input is most graciously appreciated!!!

Here are answers to your latest questions:

1) The MCLR circuit has a 6.02K Resistor tied to +5 VDC. There is a 0.1 uf ceram mono cap tied from the MCLR pin to gnd.

2) DIP switch situation: VCC is tied to one end of the DIP with a 272 ohm resistor network. The other end of the DIP switches are tied directly to the RBx Pins. In addition a 2,720 ohm resistor network is tied to gnd and the RBx Pins.

3) There is no series resistor between pin C2 and the gate of the MOSFET. There is a 5.1 V zener diode tied from gnd to the gate of the IRL540. There is also a 768 ohm pullup resistor tied to 5VDC. I am using a 255 Hz PWM signal from the PIC micro to control the MOSFET. The MOSFET drives a 12VDC 1.8 AMP heater element.

4) The circuit is not running in an electrically noisy environment, but I have picked up a small image of the PWM signal on the other RCx lines that are not being used.

Once the chips have failed I cannot get them working again under any circumstances. This includes disconnecting the FET from the PIC and putting all DIP switches in the OFF position.

Thanks again for your input into this perplexing matter!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 24, 2004 4:47 pm     Reply with quote

Quote:
1) The MCLR circuit has a 6.02K Resistor tied to +5 VDC. There is a 0.1 uf ceram mono cap tied from the MCLR pin to gnd.

Are you using a reset button on MCLR ? The cap will slow the rise time
on MCLR. I don't use a cap or diode in any of my designs. I just use
a 10K resistor to Vdd.

Quote:
2) DIP switch situation: VCC is tied to one end of the DIP with a 272 ohm resistor network. The other end of the DIP switches are tied directly to the RBx Pins. In addition a 2,720 ohm resistor network is tied to gnd and the RBx Pins.

This seems like a very odd setup, and I'm wondering if it's part of
the problem. I don't like the idea of a lot of small value resistors as
pull-ups on the PIC pins. A PIC can be "powered" through a positive
voltage coming in through the input protection diodes under some
circumstances. I would have used the internal Port B pull-ups.
Then I would have used an R-pack of eight individual series resistors
(100 ohms), with one resistor connected between each Port B pin,
and each DIP switch section.
The purpose of this is to protect against a PIC pin "accidently"
changing from an input to an output (at logic '1' level), and thus
shorting the PIC pins to GND. If this did happen, the resistors
would limit the current.

Quote:
3) There is no series resistor between pin C2 and the gate of the MOSFET. There is a 5.1 V zener diode tied from gnd to the gate of the IRL540. There is also a 768 ohm pullup resistor tied to 5VDC. I am using a 255 Hz PWM signal from the PIC micro to control the MOSFET. The MOSFET drives a 12VDC 1.8 AMP heater element.

What is the purpose of the zener ? I would have put a 47 to 100
ohm series resistor between the PIC and the Gate.

Quote:
4) The circuit is not running in an electrically noisy environment, but I have picked up a small image of the PWM signal on the other RCx lines that are not being used.

Are the unused pins being left as floating inputs ?
If so, program them as outputs, and set them low.
ie:
output_low(PIN_C0);

Quote:
#fuses XT, NOWDT, NOLVP, PUT, NOPROTECT, NOBROWNOUT, NOWRT

I would haved enabled the Brownout fuse. To my mind, this protects
against some flakey half-on/half-off state from occuring.
Ttelmah
Guest







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

PCM programmer wrote:
Quote:
1) The MCLR circuit has a 6.02K Resistor tied to +5 VDC. There is a 0.1 uf ceram mono cap tied from the MCLR pin to gnd.

Are you using a reset button on MCLR ? The cap will slow the rise time
on MCLR. I don't use a cap or diode in any of my designs. I just use
a 10K resistor to Vdd.

Quote:
2) DIP switch situation: VCC is tied to one end of the DIP with a 272 ohm resistor network. The other end of the DIP switches are tied directly to the RBx Pins. In addition a 2,720 ohm resistor network is tied to gnd and the RBx Pins.

This seems like a very odd setup, and I'm wondering if it's part of
the problem. I don't like the idea of a lot of small value resistors as
pull-ups on the PIC pins. A PIC can be "powered" through a positive
voltage coming in through the input protection diodes under some
circumstances. I would have used the internal Port B pull-ups.
Then I would have used an R-pack of eight individual series resistors
(100 ohms), with one resistor connected between each Port B pin,
and each DIP switch section.
The purpose of this is to protect against a PIC pin "accidently"
changing from an input to an output (at logic '1' level), and thus
shorting the PIC pins to GND. If this did happen, the resistors
would limit the current.

Quote:
3) There is no series resistor between pin C2 and the gate of the MOSFET. There is a 5.1 V zener diode tied from gnd to the gate of the IRL540. There is also a 768 ohm pullup resistor tied to 5VDC. I am using a 255 Hz PWM signal from the PIC micro to control the MOSFET. The MOSFET drives a 12VDC 1.8 AMP heater element.

What is the purpose of the zener ? I would have put a 47 to 100
ohm series resistor between the PIC and the Gate.

Quote:
4) The circuit is not running in an electrically noisy environment, but I have picked up a small image of the PWM signal on the other RCx lines that are not being used.

Are the unused pins being left as floating inputs ?
If so, program them as outputs, and set them low.
ie:
output_low(PIN_C0);

Quote:
#fuses XT, NOWDT, NOLVP, PUT, NOPROTECT, NOBROWNOUT, NOWRT

I would haved enabled the Brownout fuse. To my mind, this protects
against some flakey half-on/half-off state from occuring.


What is trapping the flyback pulse when the FET switches off?. A 'heater element', could be quite inductive, and you may simply be generating a spike that is killing the PICs.
The proposal of adding a 47ohm resistor in series to the gate, slightly slows the switching edges, and can help to reduce this problem, as well as helping to limit the maximum current needed from the drive output when switching (remember the input to the FET, has a very large capacitance), which could be overloading the PIC output pin.
If the zener is added to try to trap some spike back through the gate, it is worth remembering, that in general, zener diodes do not operate fast enough to provide such protection. A tranzorb, or trap network using fast diodes, and a capacitor, is more likely to work.
How is the PIC supply generated?. How is it smoothed?.

Best Wishes
bassplayer



Joined: 24 Jun 2004
Posts: 6

View user's profile Send private message

More Data
PostPosted: Fri Jun 25, 2004 8:20 am     Reply with quote

Your input is greatly appreciated! Very Happy

a) I am more inclined to think that the PIC is being blown by driving the IRL540 N Channel MOSFET. I am trying to verify this with more testing. We could easily be experiencing failures due to the lack of a resistor between the Port RC2 Pin and the Gate of the MOSFET. At this point in our re-design I am more inclined to buffer the PIC with a MOSFET driver so there is no chance of flyback voltage spikes reflecting back into the PIC, or the PIC Pin being overdriven. (Do you have any recommendations on MOSFET driver/buffers for the IRL540N?)

b) All unused pins are set as outputs and set low.


c) The DIP switch situation: I just want to make sure that I am understanding you. First, I would utilize the PORT B Pull-Ups. Secondly, 100 ohm resistors would be connected between the Port B Pins and one side of the DIP switches. Thirdly, the other side of DIP switches would be connected to gnd? The 100 ohm resistors would be an RPACK of 8 individual resistors.

Question: How could the existing DIP switch situation fail the PIC?


d) We will enable the brownout fuse.


e) The PIC voltage supply is via a UL spec'd Power Supply. I utilize a LM7805 to provide further regulation along with a 0.1 ufd ceram cap to catch any voltage transients. I will probably include an additional electrolytic cap in the next design.

Thanks Again for your kind assistance!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 3:53 pm     Reply with quote

Quote:
c) The DIP switch situation: I just want to make sure that I am understanding you. First, I would utilize the PORT B Pull-Ups. Secondly, 100 ohm resistors would be connected between the Port B Pins and one side of the DIP switches. Thirdly, the other side of DIP switches would be connected to gnd? The 100 ohm resistors would be an RPACK of 8 individual resistors.

Yes. You could also use two RPACKs with 4 individual resistors each.

Quote:
Question: How could the existing DIP switch situation fail the PIC?

I don't know. I was just noting any anomalies that I found in your design.

Quote:
Do you have any recommendations on MOSFET driver/buffers for the IRL540N?)

I haven't used MOSFET drivers. We have run an IRLIZ44N N-channel
FET directly from a PWM pin on a 16C77, by using a 10 ohm series
resistor. This was used to drive a motor. To eliminate inductive effects
(overshoot, as I recall), we put a 1N5818 Schottky diode on the output
pin of the FET (ie, on the drain). The anode of the diode went to the
drain, and the cathode went to the motor power supply (+12v).
I don't think you're PWMing your heater, so I don't think you'll need
such a diode. But, look at the waveform when the heater switches
on and off.

Here are some links to Microchip resources for MOSFET drivers:
http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=9010&mid=11&lang=en&pageId=79
http://ww1.microchip.com/downloads/en/AppNotes/00799a.pdf
bassplayer



Joined: 24 Jun 2004
Posts: 6

View user's profile Send private message

Found switching anomaly with the FET
PostPosted: Mon Jun 28, 2004 6:41 am     Reply with quote

I found a potential problem. When the FET switches to the OFF state,
there is a -0.740 V transient that lasts for approximately 70 nanoseconds. Could this negative going switching transient be enough to fail the device?
Haplo



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

View user's profile Send private message

PostPosted: Mon Jun 28, 2004 6:25 pm     Reply with quote

Quoting from the datasheet:

Quote:

Absolute Maximum Ratings †

Voltage on any pin with respect to VSS (except VDD, MCLR. and RA4) : -0.3 V to (VDD + 0.3 V)

Voltage on VDD with respect to VSS : -0.3 to +7.5 V

† NOTICE: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for
extended periods may affect device reliability.


So it is possible that your chip is getting damaged because of the negative spike (which in amplitude is more than twice the absolute minimum, although it may be very short).
MGP



Joined: 11 Sep 2003
Posts: 57

View user's profile Send private message

Re: reply to fuses statement
PostPosted: Wed Jun 30, 2004 3:34 pm     Reply with quote

bassplayer wrote:
I am utilizing an AT strip cut crystal with 15 pf bypass caps.

The failures happen after the units have been running for a period of time


Check the datasheet for your crystal. AT strip cut crystals are normally much lower powered devices than regular AT cut crystals (uW vs. mW). If you overdrive them for some length of time you can actually kill them with too much power or see distorted oscillator waveforms like you're seeing.

Do you have a series resistor from your OSCOUT pin to the crystal to limit the drive level?
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