View previous topic :: View next topic |
Author |
Message |
kuriken
Joined: 21 Oct 2006 Posts: 19
|
20MHz Crystal Oscillator Fails on Brownout |
Posted: Tue Jan 15, 2008 2:28 pm |
|
|
Hello,
I'm having a problem where I cannot get the oscillator to start up following brownouts. The oscillator is able to start out on Debug, Power Off Reset (I short PWR TO GND) and after software Sleep. I'm using a 18LF6722 chip powered at 3.3V with a 20MHz oscillator from Abracon Corporation and 22pF capacitors as recommended in the datasheet. Listed below are my fuse settings.
Any insight into the problem would be appreciated.
Code: |
#include <18F6722.h>
#device ICD=TRUE
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV27 //Brownout reset at 2.7V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOLPT1OSC //Timer1 configured for high-power operation
#FUSES MCLR //Master Clear pin enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES BBSIZ1K //1K words Boot Block size
#use delay(clock=20000000)
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 15, 2008 2:38 pm |
|
|
Quote: | I short PWR TO GND |
You should not do this. I haven't tried it with PICs, but with
programmable devices such as GALs (16V8 or 20V8), if I accidently
shorted power to ground, it would erase or scramble the programmed
code. I then had to re-program the GAL. Don't ever short power to
ground. Just disconnect the power or switch it off.
To fix your problem, try changing the NOPUT fuse to PUT. |
|
|
kuriken
Joined: 21 Oct 2006 Posts: 19
|
|
Posted: Tue Jan 15, 2008 2:48 pm |
|
|
Thanks for the reply. I tried enabling the Power Up Timer. It did not fix the problem.
I only short PWR to GND after I switch the power off when there is hardly any voltage (0.3V~0.1V) on the PWR line. Somehow that makes the PIC startup correctly. Any more ideas? |
|
|
Ttelmah Guest
|
|
Posted: Tue Jan 15, 2008 3:49 pm |
|
|
Is this an _oscillator_, or a _crystal_. You say 'oscillator', yet you speek about loading crystals?. If it is an oscillator, then _this_ will have it's own specifications for brownout, maximum rise times for it's supply, etc. etc.. You may need to add a hardware supply monitor IC, which removes power from this, when the supply falls below a particular voltage, and re-applies it, when the rail is stable, or it won't reliably start....
Best Wishes |
|
|
Guest
|
|
Posted: Tue Jan 15, 2008 3:55 pm |
|
|
It is a crystal. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 15, 2008 4:53 pm |
|
|
There is an errata on one version of the silicon for the Brownout voltage.
Just as a test, try a different setting. Try BORV25. |
|
|
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
|
Posted: Tue Jan 15, 2008 5:01 pm |
|
|
kuriken wrote: | I only short PWR to GND after I switch the power off when there is hardly any voltage (0.3V~0.1V) on the PWR line. Somehow that makes the PIC startup correctly. |
This is probably because you don't get a solid Power Off reset if there is too much residual voltage held up on the power pins by capacitance. Not a solution, just a comment. If you waited longer after powering down normally you should also get a good reset. |
|
|
Guest
|
|
Posted: Tue Jan 15, 2008 6:20 pm |
|
|
Thanks for the suggestions, I've tried the BORV25 fuse setting but that did not work. The point about waiting after power off is correct. If I power off, wait 10 seconds and turn the power on, the PIC restarts without a problem.
kuriken |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 15, 2008 6:41 pm |
|
|
If this is just a test board used for developing software, then consider
reducing the size of the bulk capacitors used on the output of the Vdd
supply. For example, you may have a 1000 uF electrolytic cap on the
output of the voltage regulator. Try changing that to a 10 uF Tantalum.
You likely don't need 1000 uF.
Also, consider adding a bleeder resistor. This is just a resistor connected
between Vdd and ground. It "bleeds off" the voltage on the capacitors
more quickly, when power is turned off, because it presents an additional
load to the power supply. |
|
|
SET
Joined: 15 Nov 2005 Posts: 161 Location: Glasgow, UK
|
|
Posted: Wed Jan 16, 2008 11:09 am |
|
|
bwhiten wrote: | kuriken wrote: | I only short PWR to GND after I switch the power off when there is hardly any voltage (0.3V~0.1V) on the PWR line. Somehow that makes the PIC startup correctly. |
This is probably because you don't get a solid Power Off reset if there is too much residual voltage held up on the power pins by capacitance. Not a solution, just a comment. If you waited longer after powering down normally you should also get a good reset. |
A common problem this - the PIC (and other circuits) take virtually no current when the supply drops to around 0.3v, so that voltage bleeds away very slowly - and then when power reapplies the POR doesnt work right. Reducing supply capacitance and/or bleed resistor is the best solution, as PCM says.
Its amazing how common this is - I get into the habit of 'count to 5' when cycling power on electronics. Someone should invent a 'reverse zener' that conducts *below* a voltage |
|
|
Ttelmah Guest
|
|
Posted: Wed Jan 16, 2008 11:32 am |
|
|
Realistically, the 'best' way of dealing with this, is probably to use a proper supply supervisor IC, and feed power to the PIC, via a FET, which is turned off, and the reset line dropped, when the supply goes below a critical value. With less capacitance on the PIC rail, and the reset line held low for a few mSec after the supply is restored, wakeup should be totally reliable.
Best Wishes |
|
|
kuriken
Joined: 21 Oct 2006 Posts: 19
|
|
Posted: Thu Jan 17, 2008 5:13 pm |
|
|
Thanks for the suggestions.
The bleed resistor would work well for my development board but I will need an alternate solution for the final product. The final product needs to be able to sleep without drawing siginificant amounts of current. The bleed resistor would kill the batteries while the PIC is sleeping.
I am leaning toward adding a supply supervisor IC. Ttelmah, Is there a suggested supply supervisor IC? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Jan 18, 2008 8:16 am |
|
|
I am in the habit of using a MAX809 or MAX810 on my PIC RESET pin. If I am going to be using ICD programming I use a MAX810 driving a 2N7002 FET pulling MCLR to GND and a 47k pull-up on MCLR. Otherwise a MAX809 can drive MCLR directly. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|