| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			aaronik19
 
 
  Joined: 25 Apr 2011 Posts: 297
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| Capacitors and crystal | 
			 
			
				 Posted: Fri Mar 20, 2020 3:28 pm     | 
				     | 
			 
			
				
  | 
			 
			
				| 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
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Fri Mar 20, 2020 4:46 pm     | 
				     | 
			 
			
				
  | 
			 
			
				You are using capacitors 1000 times larger than the specified value.
 
Yes, that will cause a problem. | 
			 
		  | 
	
	
		  | 
	
	
		
			temtronic
 
 
  Joined: 01 Jul 2010 Posts: 9589 Location: Greensville,Ontario 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Fri Mar 20, 2020 4:53 pm     | 
				     | 
			 
			
				
  | 
			 
			
				| 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: 19967
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Mar 21, 2020 1:13 am     | 
				     | 
			 
			
				
  | 
			 
			
				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: 297
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Mar 21, 2020 11:00 am     | 
				     | 
			 
			
				
  | 
			 
			
				| 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: 19967
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Mar 21, 2020 11:58 am     | 
				     | 
			 
			
				
  | 
			 
			
				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. | 
			 
		  | 
	
	
		  | 
	
	
		 |