Electronic – Permanent damage to PIC16F877A

pic

enter image description hereenter image description hereI need a help for debugging the error in my 7 segment display based digital clock design. It consist of six 2 inch displays and sixty 1 inch displays. The power supply I am using is 12 V/2 A external SMPS adapter. A 9 V regulator and a 5 V regulator are used in this design. A 7805 is used for providing supply for PIC, RTC and 1 inch display driver circuitry. A 7809 is used for driving 2 inch displays driver circuitry and buzzer. For 1 inch displays BD140 (PNP) is used and for 2 inch displays (ULN2003 + BD140) is used. ULN2003 is used for level shifting pic signals from 5 V to 9 V. Also around 2 meter of 12 V LED strip is driving directly from adapter output.

The clock works fine during testing procedures before sale. After sales, we got many calls from customers with the same complaint. That is, display is fully off, LED strip and adapter is working fine. Then I try to reprogram the IC but failed. There is no specific interval for the damage, sometimes within 1 month, sometimes within one year like that. But whenever this happens, 95% of the complaints will be same.

Actually I don't know where to start. Software problem? Hardware problem? Power supply problem? 2 inch display driving section? We have lots of models with 1 inch displays and almost the same design, and they work satisfactorily).
Circuit Diagram

Best Answer

I assume from your description that the MCU is being damaged, and replacing the MCU solves the problem.

It looks to me like a layout issue, which is not captured in your schematic.

Without further information, I would suggest adding series resistors on the CLOCK and DATA lines, perhaps around 1K (depending on how high your clock frequency happens to be). The 74HC164s may be pulling those lines below ground when the high segment currents switch.

Rather than blindly doing that, you can put an oscilloscope on those lines and see if indeed there are transients that exceed the power supply limits in either direction. Such transients can cause latchup of the MCU and destruction from power supply current can ensue.


Edit-

Yes, your layout is pretty horrific, in particular the power connections are thin, long and meandering so they have a lot of inductance. A 2-layer or 4-layer board would be much better, but of course that costs money.