View previous topic :: View next topic |
Author |
Message |
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
Microcontroller freeze/dead problem need advice |
Posted: Tue Jan 07, 2014 4:10 am |
|
|
Hi all,
Here is a project using 16F887 controller.
ccs c compiler version - 5.015.
I am using a little large capacitor at the input 1000uF.
This is used so as to prevent error writing to ds1307 RAM area.
When i recycle power if the voltage does not fall below 1V or so
then the controller freeze happens and even MCLR does not work.
I have brownout fuse turned on at 4.0V.
Any help will be great.
Regards,
Jai. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19568
|
|
Posted: Tue Jan 07, 2014 4:42 am |
|
|
Difficult to know without knowing a lot more about the circuit.
The most likely thing though is that the oscillator is not starting. You could try adding a large (few hundred KR) resistor across the crystal (assuming that this is what you are using). The circuit that runs this _requires_ the initial 'kick' on power on, to start the oscillator. A very slow rise time (which a big capacitor will give), combined with things not actually being completely 'off' can cause problems....
Best Wishes |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Tue Jan 07, 2014 4:49 am |
|
|
Thank you Ttelmah for your reply.
I did check with the oscilloscope the 8Mhz crystal pins and the oscillator is indeed oscillating.
At this point even if i ground the MCLR pin nothing happens.
this happens if i keep recycling power and suddenly it happens.
The only way to get it to work is if i get the input voltage all the way to zero. and then turn the power on.
wonder why the brownout detector does not kick in.
regards,
Jai. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19568
|
|
Posted: Tue Jan 07, 2014 5:06 am |
|
|
The brownout detector only ensures that the chip doesn't stay running in a condition where the supply is inadequate. As you have seen, your chip is in a 'can't run' condition.
As I say difficult to know without seeing the circuit, but you can take CMOS pins into 'latch up' conditions, if power is outside the rail voltages as the chip powers up/down.
If this happens complete removal of the power is the only way to clear the condition.
Big capacitors (especially close to the PIC), can cause other problems. For instance, if this is on the output of a 7805 type regulator, this can destroy the regulator. Holding it's output voltage significantly above the input voltage (more than 4.2v), will damage the regulator eventually.
I think you need to post the actual supply circuit, and why you need so much capacitance (suggests you may be fighting another problem to do with noise) so we may be able to suggest a better way of doing things.
Best Wishes |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Tue Jan 07, 2014 5:36 am |
|
|
Dear Ttelmah,
I did try 220uF cap also. Same problem exists. The capacitor is only at the
input of the regulator. Does not happen all the time. It locks up only when i keep recycling power by turning on and off the power switch rapidly.
Regards,
Jai. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Tue Jan 07, 2014 6:41 am |
|
|
The 'standard' 7805 type power supply that's always worked for me is 1000mfd on the input side(+17), 100 mfd on the output(+5),1N4002 from output(anode) to input(cathode) 'reverse protection' diode. Also have .1mfd caps as well AND another .1 close to PIC.
There's a GRN LED and resistor on the +5v side as a 'power on' indicator which also dischages the caps.
hth
jay |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Tue Jan 07, 2014 6:59 am |
|
|
Is it possible since I am accessing internal eeprom and ds1307 chips in the code. This rapidly recycling power may be the cause for the hang or freeze?.
regards,
Jai |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Tue Jan 07, 2014 7:05 am |
|
|
Yes, if you don't take proper EMI protection. 'Noise' ( electrical 'glitch') from the on/off switch could cause the PIC to get 'hung'. That's one reason why you need 'bypass' capacitors near the PIC. Typically .1mfd caps are used near the PIC power pins, mclr to gnd, the DS1307 and any other peripherals (like an LCD module).
'Noise' can get to the PIC 2 ways. Either through the wiring or airborne.
Also you should have 'PUT" enabled as a fuse. This is the Power Up Timer, helps to get the PIC properly up and running.
hth
jay |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Tue Jan 07, 2014 7:08 am |
|
|
I have 0.1uF capacitor on all IC's including pic, and on the MCLR pin to GND.
This latch up is funny, the controller goes dead and not even connecting the MCLR to ground helps to reset controller.
The thing is under normal conditions where there is a few seconds between power recycle this problem does not happen.
Only when i rapidly recycle power this latch up occurs. Wonder whether i am pushing controller too much.
regards,
Jai. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1636 Location: Perth, Australia
|
|
Posted: Tue Jan 07, 2014 10:18 am |
|
|
jaikumar wrote: | Is it possible since I am accessing internal eeprom and ds1307 chips in the code. This rapidly recycling power may be the cause for the hang or freeze?.
regards,
Jai |
I bet your problem is you do not have a battery connected to the terminals of the DS1307. If this is true then you either need to add a pulldown in place of the battery or a pull-up to Vcc of the DS1307. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19568
|
|
Posted: Wed Jan 08, 2014 2:24 am |
|
|
Big alarm bell also ringing for me, with the comment about 0.1uF on the MCLR pin.
Have a look at Microchip application notes, and their recommended reset circuit. Note the resistor and diode.
Problem is that if you have a capacitor directly connected to the MCLR pin, this will hold the pin _above_ the supply rail when you switch off. The MCLR pin has no internal effective diode structure to prevent this.
Result could be anything......
Best Wishes |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Wed Jan 08, 2014 3:19 am |
|
|
I do have a battery connected to ds1307 and its voltage level fine.
I have a external watchdog ds1232 and its pin connected to the MCLR.
[url]
http://www.maximintegrated.com/datasheet/index.mvp/id/2650
[/url]
Question
Do i need still need the 0.1uF at the MCLR.
I am turning on a few relays and afraid noise might get to the MCLR pin.
Regards,
Jai. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19568
|
|
Posted: Wed Jan 08, 2014 5:34 am |
|
|
You most definitely do not want a 0.1uF on MCLR if it is being driven by a watchdog chip. A good way of trying to kill the chips....
It wants a nice solid pull up resistor to Vdd (perhaps 2K2R), and to go to the /RST connection on the chip. The 10K shown in the data sheet is a bit large, and the pin is capable of driving lower resistances if you want to reduce the impedance of the line to help prevent noise.
As a comment, if you are 'turning on a few relays', the place to start is with good snubbing at these. With all things to do with RF noise it needs to be controlled at source. Good design of the board, and snubbing to prevent arcing on the contacts, together with trap diodes on the coils.
Will just add, that one way you _can_ hang a PIC, is to have relay coils operating with no flyback trapping. Then when the driver switches 'off' the voltage across the coil will exceed the Vcb of the driving transistor (not may, _will_), and a significant pulse will then flow into the PIC pin, which can lock/kill the chip. Depending on the ratings of the parts, bits may get destroyed, but often enough current flows through the PIC to stop other things being damaged....
Last edited by Ttelmah on Wed Jan 08, 2014 5:52 am; edited 2 times in total |
|
|
jaikumar
Joined: 15 Dec 2006 Posts: 109
|
|
Posted: Wed Jan 08, 2014 5:48 am |
|
|
thanks Ttelmah for the information.
Will give it a try.
Regards,
Jai. |
|
|
|