Pierce Oscillator: How to verify - Page 1
Forum section: electronics / projects

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 18, 2013, 12:43:03 am
content: Ten questions in one.I have just made up some prototype STM32 based boards and in the standard fashion they and some peripherals are using pierce oscillators for the clock generation.They all seem to work ok but I am wondering the best way to verify that they are working properly. Obviously with the Cro tips at around 16pf any probing I do near the crystal will be effected.What is the best way to ensure that I have laid out my oscillator circuit correctly? Apart from it works. Is there anything else I can or should verify.I was thinking just check the frequency is correct. Is this enough?Also in the interests of utilising as many common parts as possible, I want to use the same value of capacitance for 2 separate crystals one is 3.5??Mhz and the other is 8Mhz. One is 22pf and the other 18pf. If I use the same value on both then I would need to verify again.A follow up question is when to use a load resistor to damp the ringing, how to choose the value and whether series or parallel. Currenly my methodology is to copy out the reference circuit, but I need to go the next step.I would imagine most experienced designers dont spend a lot of time on this so if anyone has a quick workflow of how they design and verify the oscillator then that would be good.I have read a couple of documents on this circuit but any other links to documents that anyone thinks are useful would be appreciated.http://www.abracon.com/Support/facn_abracon_jul2011.pdf]http://www.abracon.com/Support/facn_abracon_jul2011.pdfhttp://www.statek.com/pdf/tn31.pdf

author: c4757p
author_rank: Super Contributor
timestamp: May 18, 2013, 01:30:06 am
content: Quote from: HackedFridgeMagnet on May 18, 2013, 12:43:03 amJust probe the output signal. If it can drive a microcontroller input, it can drive your probe. The only reason I can think of to bother probinginsidethe oscillator circuit is if it doesn't oscillate, in which case you won't really care if the probe loading shifts the frequency.QuoteYou may be interested in jitter as well, depending on what you're doing. Other than that, if you can buffer it up to a digital signal, who cares what it looks like?QuoteDepends on how accurate you need the frequency to be. A shift from 18pF to 22pF won't make too much difference.If you have other capacitors in your circuit, you could use a series combination. 22pF in series with 100pF is very close to 18pF, so if you've got any 100pF (HF decoupling or something) on your BOM, just whack one in series with a 22pF capacitor.QuoteNot confident enough to answer that, sorry. Hopefully someone else knows.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 19, 2013, 11:52:54 pm
content: Thanks c4757pHows the weather? it's fine and cold here, first frost of the year.A few good suggestions in your post.It turns out my external oscillator wasn't actually working anyway. My STM code defaulted to the internal 8mhz clock and continued anyway.I had flipped the footprint of the 4 pad oscillator upside down, Newb mistake. Anyway It's fixed now rotated slightly and looking like the kludge that it is.If anyone else can outline their Xtal layout and part selection methodology that would be appreciated.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 20, 2013, 03:58:08 am
content: Ok well my 8mhz oscillator works, it oscillates on the output pin at between 3.3v and 0.9 volts and on the input pin betweem 3 and 1 volt. Roughly sinusoidal. (probably square with ideal probes).My RTC Xtal seems to be working too. Code wise the clock is incrementing. I would still like to know how to verify it is going to work reliably.It uses 6pf load caps.According to my scope it oscillates on the output pin at between 600mv and 0.9 volts .Very roughly sinusoidal.As I put the probe(16pf) on the input I initially get an oscillation but my probe then seems to kill it within half second. After this it is just noise with a dc bias of 50mV.Any way the long and the short of it is both oscillators are working but as to how well they are working I have no idea.

author: Paul Price
author_rank: Super Contributor
timestamp: May 20, 2013, 01:36:13 pm
content: Crystal oscillator waveforms can be sniffed by the tip of your probe, just put the probe very close to the wire without touching it and you will see the waveform clearly. Xtal manufacturers specify an optimal level of capacitor to load the crystal, use this value and you can't go wrong. With the probe proximal to the xtal leads you can clearly see if the xtal osc waveform.Most MCU's use two pins for the xtal, and use xtals made to work in series resonant mode.Of all the problems I have troubleshooted with MCU's, xtal osc problems have been the fewest. Use a cap. value closest to that recommended for loading by most mfg's and you won't experience any problems. Forget about damping resistors, can you show me any MCU osc circuit that uses one?How to be sure:Step(1) Halve the capacitor you are using and see if the circuit oscillates, if it does, your cap value is large enough and it might be close to the optimal value.Step(2) Double the capacitor value you are using and see how it oscillates. If it does, the original cap. value was correct.Step(3) Lower and raise the power supply within the expected possible limits of your device. If the oscillator functions, you have a reliable xtal oscillator that is not going to be affected by power supply variations.Step(4) Use a hair dryer to raise the temperature of your circuit to summer Sahara Death Valley temperatures. If you oscillator is functioning, it can take the heat in hell's kitchen.Step(5)Use Freon freeze spray or put your entire circuit in your fridge freezer for a few hours. Take it out and quickly check the oscillator. If it still works, your device can be sold to Eskimos.Step(6)Slam your circuit board onto the floor several times with a force enough to scare your cat but not sufficient to damage your floor. Check the osc. If it still works, you can certify your oscillator is fit to be used aboard Space Shuttles and Wild West Stage Coaches.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 21, 2013, 06:01:48 am
content: There floor's ok but the cat has got the shakes.Thanks for the tips.

author: Paul Price
author_rank: Super Contributor
timestamp: May 21, 2013, 10:31:03 am
content: Steps 1 to 5 are sufficient to verify clock oscillation reliability, occasionally a xtal is damaged by step using vibration testing above, and while some cats will continue to suffer for years from Pet Experiencing Enhanced Poor Oscillation Stress Test Trauma (PEEPOST), most will recover with a few kind words and a lot of petting.The steps requiring you to change the capacitance by doubling and halving the value ensure you are in the midpoint of capacitance for xtal loading and assure you will have reliable oscillator operation.Be aware that a solderless breadboard will often provide sufficient capacitance to make you might think no capacitor load is necessary at all, and you might not be aware of this error until you solder assemble your device on a perfboard where the lower inter-pin capacitance is too low and will not start the oscillator.Some xtals, like those used in watches permit only a microwatt of drive and excess xtal current can damage some delicate xtals but Xtal oscillators on MCU's are carefully designed ensure xtal oscillation will be very reliable with the proper load capacitance specified by the xtal mfg.Some amount of capacitive Xtal loading is always specified and required. Often, stray capacitance is enough on breadboarded circuits.Too much capacitance and the xtal will not start at all or only after several seconds.It has been my experience that loading the xtal input pin with a 10x xtal probe is sufficient to kill the oscillator.My apologies and best wishes to the cat.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 22, 2013, 01:24:40 am
content: Thanks for the excellent suggestions Paul, I'm glad you could spell them out for me.It makes sense that these steps would be the only way to seriously test an oscillator circuit.I guess the damping resistor value is less critical.I also guess the topology can probably be either in series or parallel although the resistance values would change accordingly.From what I gather the acceptable resistance range is partly dependent upon board layout anyway.

author: Paul Price
author_rank: Super Contributor
timestamp: May 22, 2013, 01:43:40 am
content: Damping resistors are almost never used, the oscillator circuit built into MCU's has already been optimized for the fewest external components by MCU product design engineers to make their product as easy to use as possible.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: May 22, 2013, 12:51:53 pm
content: Good to know Paul, thanks for the tips.