Menu

PIC partial failure

2020-12-16
2020-12-21
  • David Stephenson

    Almost 10 years ago I made a clock using (obviously) a clock crystal (32768 Hz). It has now been working continuously for 9 years 10 months. The external oscillator has failed, it has decided to use the LFINT oscillator instead, so is going slowly.
    I've changed the crystal then I changed the capacitors. It runs correctly for a few hours on the external oscillator then changes back to the LFINT. I changed the battery as the 3V lithium was down to 2.96V (not surprising after 10 years) and it made no difference.
    The chip I was using is a PIC16LF1517 so (as I had no more of these) I replaced it with a 16F887 (a pin for pin replacement) and now it is back to working correctly.
    So my conclusion is that the external oscillator driver has failed. Is this common? Has anybody experienced failure in a PIC that has been running continuously for a long period?

     
  • David Stephenson

    Interesting link, but these failures seem to be initial. Mine failed after 10 years. It's a bit worrying as I, almost routinely, attach a clock crystal to every project that requires some type of timing.
    I can't say I've had a commercially produced clock where the crystal oscillator has failed (they have failed in many other ways mostly the display failing).

     
    • Anobium

      Anobium - 2020-12-16

      It is one failure? If so, replace the crystal.

       
  • stan cartwright

    stan cartwright - 2020-12-16

    Could it be that ram has only so many write and re writes?

     
  • David Stephenson

    As I said I replaced the crystal ( and the caps) and it still gave the same problems. It is working perfectly with the replacement 16F887.
    The original crystal looks like I scavenged it; the new one is from RS.
    I am thinking maybe when I programmed the chip initially (10 years ago) I was using a homemade programmer which was maybe providing a little too much "flash voltage" to the LF chip, but for it to have worked for so long and only the external oscillator to fail seems like a stretch.

     
  • Hugh Considine

    Hugh Considine - 2020-12-17

    I had a PIC16F877A fail this year after being in service continuously for about 15 years. It failed with the MCLR pin internally shorted low, the 20 MHz crystal oscillator was still running, but no code execution because of the chip being held in reset. Very odd, the board also had several PIC16F819s that were running from the same power supply and have not had any issues, so probably something internal to the chip. Replaced it with another 16F877A from the same batch that's been in a storeroom for 15 years, and it's been running fine since.

     
  • Haroen

    Haroen - 2020-12-19

    I've read online once that the firmware program degrates over time.
    After some decades.
    Maybe temperature, overvoltage, surge spikes, etc. can reduce/damage this.
    Solution: Have you re-programmed the old chip?

     

    Last edit: Haroen 2020-12-19
  • David Stephenson

    Yes I did re-programme it - it made no difference. The flash memory is supposed to be retained for 40 years, but maybe other things fail first.
    I have found another 16F1517 (after much searching) and it works perfectly.

     
  • Chris Roper

    Chris Roper - 2020-12-19

    I had a few boards with PIC32 devices fail with the MCLR pin internally shorted.
    It turned out to be voltage spikes on the MCLR pin itself.
    A 100K resistor in series with the reset circuitry solved it in my case.
    Not a single board has failed since and most are located next to HT Power transformers.

     
  • David Stephenson

    I don't think I've ever used the MCLR pin for its intended purpose (it's a waste of a pin as far as I am concerned). Generally I find the safest thing is to set it as a digital input and tie it to ground with a 100k. Leaving it floating, even with MCLR off, tends to cause problems such as unintended resets and fluctuating current draw.

     
  • Haroen

    Haroen - 2020-12-20

    Some of my projects are near(20cm) by induction AC motors but not yet had problems.
    Could be the motor speed, distance or the pcb routing-method copper picking up more magnetic fields.

    In the PICkit2 manual Figure 3-1 there's a MCLR circuit with 10K, 0,1µF, 470R or Schottky.
    Where did you put your 100K resistor?

     
  • Chris Roper

    Chris Roper - 2020-12-20

    Surface mounted directly on the pin pad.
    The Device could accept an external reset under hardware control and we suspected that the wire that carried that reset request from the Panel was getting an induced signal of greater than 3V3.
    A 100K resistance in series allows the internal Diodes to safely conduct the excess voltage to supply or ground as needed.

     
  • Haroen

    Haroen - 2020-12-21

    Thanks, I'll keep that in mind, 100K instead of 10K Pull-Up.

     
    • Chris Roper

      Chris Roper - 2020-12-21

      It is NOT a 100K Pullup.
      it is 100k in series to protect the Internal Clamping Diodes in case of a voltage spike.
      You can and probably should still use the 10K Pull-up, put it between the MCLR pin and The 100K resistor.

       

      Last edit: Chris Roper 2020-12-21
  • Davor Šikić

    Davor Šikić - 2020-12-21

    Sorry for intrusion by one long-time lurker, but if you put 10k pull-up between the MCLR pin and the 100k resistor, then MCLR pin will always be high.
    Better would be: MCLR pin, then serial resistor, then pull-up.

     
  • David Stephenson

    Yes I agree that the accepted wisdom is to pull MCLR high with a 10k, but I've had better results pulling it low with a 100k. But don't forget you should only do this if MCLR = OFF in the config files.
    Most of the things I make are battery powered so I try to get the current draw as low as possible (10-100 uA) if you don't condition the MCLR pin the current will fluctuate depending on where the chip is placed (putting a finger on top of the chip often has a dramatic effect on the current draw).

     

Log in to post a comment.