MacGyverS2000
Electrical
- Dec 22, 2003
- 8,504
Some background...I have a PIC chip on a 1.5" x 3" board, several switches (with RC networks for debouncing), and multiple PWM outputs. PIC chip is smack dab in the middle, crystal is directly above (top of board, middle), and voltage regulator is in the top left. Vdd for the chip is brought down the left side of the board, along the bottom, then back up towards the PIC once it hits the middle (a sizable length track, about 3" long). This supply also powers the keypad.
I just finished transferring the code, which worked reasonably well on a different chip and board layout, to this new setup. Once in a blue moon the old setup would lock up after a keypress, but it happened so infrequently as to let me ignore it. The new setup, however, exhibits the symptom more readily if I stress it (repeatedly press the buttons quickly), so I needed to track it down.
Contamination from the PWM lines has been ruled out as I shut them off for the time being. Contamination from contact bounce has been ruled out as the signals look quite clean (10kohm resistor, 1uF cap for a 10ms debounce time, along with the chip inputs being Schmitt triggers). If there is any contamination from the clock, it's so small as to be lost in the surrounding noise.
Last thing to check was the Vdd line. At the regulator output, ripple is minimal (10mV?), but it definitely increases as I get further from the regulator...at the point where it powers the PIC, static noise levels (no buttons) are much closer to 200mV+
But I wanted to know if those buttons were doing anything to that line, over and above what the background noise was at that point. As I set my trigger level lower and lower, I began to think something was wrong with my scope...I was able to trigger a wave capture at voltage drops as low as +4.0V!!! A couple of good hits to the button made the Vdd line drop an entire volt, which no doubt is wreaking havoc with the PIC itself and sending it into La-La Land.
-----
Soooo, my question is how do I mitigate some of this noise? Some possibilities I'm thinking of (and I'd like your feedback on):
1) A decoupling cap near the Vdd and Vss line of the PIC (scary, but I JUST now thought of this...have NO Earthly idea why I never put one on before). A 0.1uF should do it.
2) Shorten the distance between the regulator and PIC (seems like a no-brainer, and I've done so already on the production board gerbers).
3) Increase the cap value on the regulator's output. I currently have a 0.1uF per datasheet suggestion, but it seemed a bit low to me (it's a 100mA max part).
4) This one is for those knowledgable in PIC design. Evidently the MCLR pin is quite touchy to noise on some chips (from what I read). I currently have a 10kohm resistor from Vdd to MCLR and use the internal Power-On Reset option...should I add a low value cap for an RC network? I chose to leave it out so my In-Circuit Serial Programmer would work without the need for a diode (space is tight).
Your thoughts/opinions welcome...
I just finished transferring the code, which worked reasonably well on a different chip and board layout, to this new setup. Once in a blue moon the old setup would lock up after a keypress, but it happened so infrequently as to let me ignore it. The new setup, however, exhibits the symptom more readily if I stress it (repeatedly press the buttons quickly), so I needed to track it down.
Contamination from the PWM lines has been ruled out as I shut them off for the time being. Contamination from contact bounce has been ruled out as the signals look quite clean (10kohm resistor, 1uF cap for a 10ms debounce time, along with the chip inputs being Schmitt triggers). If there is any contamination from the clock, it's so small as to be lost in the surrounding noise.
Last thing to check was the Vdd line. At the regulator output, ripple is minimal (10mV?), but it definitely increases as I get further from the regulator...at the point where it powers the PIC, static noise levels (no buttons) are much closer to 200mV+
But I wanted to know if those buttons were doing anything to that line, over and above what the background noise was at that point. As I set my trigger level lower and lower, I began to think something was wrong with my scope...I was able to trigger a wave capture at voltage drops as low as +4.0V!!! A couple of good hits to the button made the Vdd line drop an entire volt, which no doubt is wreaking havoc with the PIC itself and sending it into La-La Land.
-----
Soooo, my question is how do I mitigate some of this noise? Some possibilities I'm thinking of (and I'd like your feedback on):
1) A decoupling cap near the Vdd and Vss line of the PIC (scary, but I JUST now thought of this...have NO Earthly idea why I never put one on before). A 0.1uF should do it.
2) Shorten the distance between the regulator and PIC (seems like a no-brainer, and I've done so already on the production board gerbers).
3) Increase the cap value on the regulator's output. I currently have a 0.1uF per datasheet suggestion, but it seemed a bit low to me (it's a 100mA max part).
4) This one is for those knowledgable in PIC design. Evidently the MCLR pin is quite touchy to noise on some chips (from what I read). I currently have a 10kohm resistor from Vdd to MCLR and use the internal Power-On Reset option...should I add a low value cap for an RC network? I chose to leave it out so my In-Circuit Serial Programmer would work without the need for a diode (space is tight).
Your thoughts/opinions welcome...