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

Capacitors and crystal

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



Joined: 25 Apr 2011
Posts: 296

View user's profile Send private message

Capacitors and crystal
PostPosted: Fri Mar 20, 2020 3:28 pm     Reply with quote

Just a quick question...i know that on the datasheet it is requested to use 22pf capacitors on 20MHz crystal, but instead i used 22nf since i only had those on my shelf. Now the delay of my first draft project is taking 4x more. Could be that these capacitors are causing the problem? Just asking...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 20, 2020 4:46 pm     Reply with quote

You are using capacitors 1000 times larger than the specified value.
Yes, that will cause a problem.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 20, 2020 4:53 pm     Reply with quote

If you don't have 22pfd, you can probably use 15pfd as 22 (or whatever value they say), includes board capacitance...
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sat Mar 21, 2020 1:13 am     Reply with quote

Yes, in fact with 22nF I'd be surprised if the crystal will actually run at all.
It's possible that FSCM is cutting in. Quite a lot of PIC's have 'Fail
Safe Clock Monitor', where if the crystal does not start the PIC will fall
back and use it's internal oscillator. So perhaps run at something like
4MHz, rather than 20MHz. Other possibility is that with such a massive
overload it may be resonating at an undertone frequency.
Better no capacitors at all (generally the PCB will get much closer to
the right value, than this factor of 1000+), than to overload this much....

It's worth understanding that the capacitors used do not want to be the
'load capacitance' value. The crystal actually 'sees' as it's load capacitance,
the two capacitors, each in parallel with the tracks and pin capacitances,
_in series_.

So if you have a crystal with a specified load capacitance of (say) 22pF,
and tracks that give (say) 5 to 7pF capacitance, and PIC pins that give
perhaps 5pF, you would want capacitors:

(22*2)-(5+5) = 34pF

What happens is you have the 34pF, in parallel with the pin capacitance
and track capacitance, giving 44pF, and two 44pF 'loads' in series across
the capacitor, will give 22pF 'seen' by the crystal.

The datasheet use of 22pF capacitors is actually for a crystal designed
for 18pF load capacitance. With pin capacitance of 5pF, and track
capacitance of 7pF, the crystal sees:

(22+7+5)/2 = 17pF.

You need to use the right capacitor combination for the crystal you have
or accuracy will be poor...
aaronik19



Joined: 25 Apr 2011
Posts: 296

View user's profile Send private message

PostPosted: Sat Mar 21, 2020 11:00 am     Reply with quote

Thanks for your feedback. In fact I never thought that change in that value would make so much difference. As Ttelmah said, I also tried to remove the capacitors and with just the capacitance of the pcb, the clock became quite accurate.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sat Mar 21, 2020 11:58 am     Reply with quote

Unlike something like a smoothing capacitor, this is a resonant circuit.
Values here are very important.
With no capacitors assuming your PCB has a reasonable capacitance,
it'll probably run just a tiny bit fast, but within a small fraction of a percent.
Some crystals are actually deliberately made to be close to 'right' with
just the track/pin capacitance.
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