CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

20MHz Crystal Oscillator Fails on Brownout

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kuriken



Joined: 21 Oct 2006
Posts: 19

View user's profile Send private message

20MHz Crystal Oscillator Fails on Brownout
PostPosted: Tue Jan 15, 2008 2:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 15, 2008 2:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 15, 2008 2:48 pm     Reply with quote

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







PostPosted: Tue Jan 15, 2008 3:49 pm     Reply with quote

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








PostPosted: Tue Jan 15, 2008 3:55 pm     Reply with quote

It is a crystal.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 15, 2008 4:53 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 15, 2008 5:01 pm     Reply with quote

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








PostPosted: Tue Jan 15, 2008 6:20 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 15, 2008 6:41 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jan 16, 2008 11:09 am     Reply with quote

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 Smile
Ttelmah
Guest







PostPosted: Wed Jan 16, 2008 11:32 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jan 17, 2008 5:13 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jan 18, 2008 8:16 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group