PDA

View Full Version : Unexpected Reset



netstranger.nz
- 23rd May 2009, 23:05
Hi Everyone,
I am PIC hobbyist. Working through different projects I noticed that the most difficult problem to solve is unexpected PIC reset. I browsed the forum and found that people had similar problems. Here are some links:
http://www.picbasic.co.uk/forum/showthread.php?t=7926
http://www.picbasic.co.uk/forum/showthread.php?t=5650
There was another one where the guy was designing ignition coil driver but I could not find the thread.
I came across the project where PIC resets quite regularly and I am not able to fix it. Attached files are the circuitry and the code.

MCLR is configured as an input. Pic runs of internal Oscillator
PIC resets almost every time when you press the button. Debugging “S” indicates it. It could be any PIC providing MCLR is cofigured as an input.
Any help is appreciated. If you came across similar problem in the past can you please share your experience.
I would like to thank all the helpers on this forum and give my best regards to DarrelTaylor for his Basic Extensions and all the posts.

Melanie
- 23rd May 2009, 23:27
It'll only be one of three things in my guess...

1. Your MCLR pin has NOT been configured as INPUT properly. Your appended code doesn't show anything in that department. so, we assume you are setting it manually (and correctly) in your programming software. As a test, put some blinky LED code in (to show that your code is working) and then ground GROUND the MCLR pin. If it doesn't blink, there's your problem.

2. Your Pin 4 (I/O 4) is shorted. When you toggle it in software you could be connecting it to Vdd or 0v and pulling your Supply rail down.

3. Your supply is crap and connecting the other end of your Pull-Up Resistor (which is way too low a value - or indeed could be dud) to 0v is enough to cause a glitch and Brown-Out the PIC. Try a 10K Resistor here.

bogdan
- 24th May 2009, 02:28
you have it on breadboard ?

netstranger.nz
- 26th May 2009, 19:41
Hi Melanie and Bogdan
Thanks for your reply. I attached the screen shot of the configuration fuses and corrected the circuitry (I moved 100Om resistor on the other side of the ceramic capacitors because this is how it is on the board. I apologize for the mistake).
You are right Melanie I don’t set configuration fuses in software even though it is more convenient. This is because I use MPASM assembler which in turn requires PicBasic include files to be corrected. So I decided I will go the hard way.
This is the link I found very useful: http://www.picbasic.co.uk/forum/showthread.php?t=543. Thanks to Melanie for her time and effort.
The code does work because on the power-up the letter S is debugged, LED comes ON then the switch is polled in a loop and the LED changes state when you operate the switch. Sometimes though when you operate the switch Pic resets. Reset is indicated by debugged S on the screen of the computer.
The circuitry is assembled on two circuit boards. One with the PIC and the other with the switches, LEDs and other testing gear. Circuit boards are connected through the header pin plug. I think it is good enough to switch one LED ON and OFF
Power supply is of the wall (220 to 13v 1A) through the bridge and through LM7805 to the rest of the circuitry with 10uF capacitors on each side of the voltage regulator. Let’s estimate the maximum current needed by the circuitry. LED line will draw 5/470 = 11mA (if we consider LED being a short). Switch (when closed) will draw 5/330 = 15mA or after amendment that we performed 5/10000 = .5mA. PIC itself draws 4mA. RS232 line has 1k resistor and draws (if shorted to ground) 5/1000 = 5mA. 15 + 11 + 4 + 5 = 35mA in total or after rising the switch pull-up resistor .5 + 11 + 4 + 5 =20.5mA. Power supply provides 1000mA at 13V. I think power supply is out of concern.

netstranger.nz
- 26th May 2009, 19:56
http://www.picbasic.co.uk/forum/showthread.php?t=7814
Just found the thread where the guy is building ignition coil driver. His PIC resets (intermittently) when coil is fired. PIC doesn’t reset if uses resistive type high tension lead which is suppressing the amplitude of the interference. Would we very nice to shine some light on unexpected reset and how to protect PIC from resetting. I am sure that many people came across the problem. If they could share their experience it would be of a great help.

netstranger.nz
- 13th June 2009, 19:54
Hi,
I decided to modify the circuitry to make the reset more obvious. I removed 100Om MCLR series resistor. The resistor was put there to comply with “Microchip MCLR use warning”(see attachment).
I’ve also gathered more information:
PIC resets only if you use MCLR pin as an input. If you move the sense wire to any other pin (and change the code accordingly) there is no problem no matter how hard you try.
If you remove capacitors than everything works fine. I attached MCLR voltage traces(Reset-NoReset).

One 0.1uF capacitor (we use two make reset more frequent) is crucial for it filters the input line. 0.1uF capacitor ensures that there will be no false triggering.
It looks like the decision is not to use MCLR as an input. But then we face unexpected reset problem. PIC will reset randomly when you are close to the interference source (ignition systems, welding, heavy contactors and many more) which is no good if you design hart pace makers.
One solution is to place 5v TVS (RS p.n. 1017823) to earth right at the MCLR pin. If you place it at the button-capacitor unit(in my case it is 5 inches away) there will be no effect and PIC will reset. I attached the scope trace(TVS NoReset). Unfortunately I can’t see from the scope traces how TVS prevents PIC reset or why PIC resets in the first place. I think without such understanding no reliable projects can be built. I’ll carry on my research and post any results :).