Measuring XTAL (XI, XO)  - Page 1
Forum section: electronics / beginners

author: caliper15
author_rank: Contributor
timestamp: April 15, 2013, 05:58:10 am
content: I'm trying to measure the frequency of a crystal oscillator I have hooked up to a microcontroller with a DMM.My question is, should you be able to measure the same frequency on both XI and XO?I can't seem to get a frequency measurement, but I do measure 3.3V on XO and 0V on XI.

author: Andlier
author_rank: Contributor
timestamp: April 15, 2013, 06:17:36 am
content: You are probably stopping the crystal oscillations by touching the terminals with a multimeter. You need special high impedance, low capacitance probes, < 1pF scope probes for example. When the oscillations are stopped, what you measure will be typical, one side low, while the other is high. The oscillator circuit is essentially an inverter connected across the crystal with some compensation resistance/capacitance in parallel. Look up pierce oscillator.

author: caliper15
author_rank: Contributor
timestamp: April 15, 2013, 06:55:33 am
content: Quote from: Andlier on April 15, 2013, 06:17:36 amAh ok. I was able to measure the frequency with an oscilloscope but didn't know why I couldn't with a DMM.Thanks.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 08:24:25 am
content: I've tried measuring the crystal with an oscilloscope, but it's not oscillating. Now I'm measuring 3.3V on XI and XO with 0V.The crystal I'm using is 12Mhz with 18pF load capacitance. I have 2 18pF capacitors hooked up to it. Are my capacitors too small?

author: KJDS
author_rank: Super Contributor
timestamp: April 16, 2013, 09:18:02 am
content: What does the datasheet of the microcontroller you are using suggest?

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 09:28:28 am
content: Quote from: KJDS on April 16, 2013, 09:18:02 amActually I'm using an MMC controller chip. It requires a 12Mhz crystal along with 18pF capacitors.

author: Codemonkey
author_rank: Regular Contributor
timestamp: April 16, 2013, 10:18:31 am
content: If your crystal requires a load capacitance of 18pF, then you're going to require bigger capacitors since the load capacitance is specified as being in parallel with the crystal. Since you have effectively 2 capacitors connected in series, you need to take account of this, and also the capacitance of the pads and traces to and from the crystal (you have effectively a load capacitance of 9pF at the moment plus whatever the pads & traces add).You can read more about it all in this application note:http://www.foxonline.com/pdfs/xtaldesignnotes.pdf

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 10:46:47 am
content: Quote from: Codemonkey on April 16, 2013, 10:18:31 amThanks for the link!So from the equation: CL = (CL1 * CL2) / (CL1 + CL2) + Cstray, and assuming CL1=CL2 and that typical Cstray is 5pF, the capacitors I would need would be 26pF?If the wrong capacitance is chosen, will there be no oscillation at all? Or will the frequency just be less?

author: KJDS
author_rank: Super Contributor
timestamp: April 16, 2013, 11:17:55 am
content: I've only ever seen a slight shift in frequency unless the caps are missing, however some devices could be more sensitive than those I've played with. You could try adding a little finger capacitance rather than getting the soldering iron out.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 06:02:52 pm
content: Quote from: KJDS on April 16, 2013, 11:17:55 amI've tried using 22pF capacitors and even tried changing the crystal but it still won't oscillate. Is it possible that the MMC controller is no good? If I apply 3.3V to XI and connect XO to ground (without the MMC controller) would the crystal oscillate?

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 16, 2013, 06:13:11 pm
content: No, a crystal is not an oscillator, it is a frequency determinating device, it will not do anything without an oscillator.Are you trying to build or fix something? Did it ever work?And yes, everything can be broken of course.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 06:27:44 pm
content: Quote from: PA0PBZ on April 16, 2013, 06:13:11 pmI'm trying to fix a board I built. Strange thing is I got it to work once or twice. The board is an MMC reader. You plug it into the computer and it gets recognized as a storage device.On one of the boards with the same layout I noticed when I first plugged it in with a USB cable the XO pin had a 12Mhz frequency on it, then reverted to 3.3V after about 2 seconds. I can't figure out why it would stop oscillating..This is what I have setup:

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 16, 2013, 06:46:44 pm
content: Ok, I understand what you are trying to do now. Could it be that the board layout is giving you these problems? Normally the caps and the Xtal should be as close as possible to the XI and XO pins, and the ground should be firmly connected to the ground of the mmc.Pictures?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 16, 2013, 07:00:55 pm
content: You might try using mismatched capacitor values. Supposedly crystal oscillators can lock-up in noisy environments.This is from an Atmelapplication note:QuoteYou would typically mitigate this noise in your PCB design, as PA0PBZ mentions. In addition to keeping the traces as short as possible you also want to isolate the xtal signals from other signals. Just keeping some distance between the traces might work. Guard rings are even better. A guard ring basically just sandwiches a low impedance (= low noise) source (GND or VCC, for example) between the xtal signals and any others.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 07:04:02 pm
content: Quote from: PA0PBZ on April 16, 2013, 06:46:44 pmI thought it could be the way I routed to XO/XI traces so I tried desoldering the crystal from the board and soldered them directly to the capacitors. It still didn't oscillate.The two capacitors are the top right pads. Do the XI/XO traces need to be the exact length?I would think that even it my layout was improper and introduced emi, I should still get oscillation.. just not an accurate one..

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 16, 2013, 07:12:07 pm
content: The length of the traces is not an issue normally, but where is the ground from the capacitors going? And where is the via in the top right corner of the crystal going to?Try to put a wire from the ground of the capacitors to the ground of the mmc and see what happens.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 07:18:46 pm
content: Quote from: PA0PBZ on April 16, 2013, 07:12:07 pmThe ground from the capacitors are connected to the ground of the mmc. I have a top and bottom layer ground plane.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 16, 2013, 07:38:28 pm
content: Quote from: caliper15 on April 16, 2013, 07:18:46 pmIt's not easy to see how, you can just try a short wire to see if it works.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 07:45:25 pm
content: Quote from: PA0PBZ on April 16, 2013, 07:38:28 pmThe ground pin for the mmc controller is underneath the chip. I've checked with a DMM and there is continuity between the capacitor ground pins and the top left mmc pin which is connected to the gnd pad underneath. I've also just tried connecting it with a wire and still nothing..

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 16, 2013, 07:55:03 pm
content: It's not about continuity but about a short path, but if you tested the wire I guess that is not the problem. It could be that the chip is bad, hard to tell from here. The oscillator in the chip is really basic, it should run when you apply power to the chip, it's not that it needs some kind of initialization.Which MMC is it?

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 09:06:33 pm
content: Quote from: PA0PBZ on April 16, 2013, 07:55:03 pmAh I see. I tried resoldering a new chip but I still have the same problem. The mmc uses the D+ D- differential pair data signals from the usb. When I routed these signals I didn't route them as a differential pair. Is it possible that those signals are corrupt and in turn the mmc controller won't oscillate the crystal because of this?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 16, 2013, 10:47:12 pm
content: Judging from your layout (autorouter?) I'd say you've got quite a bit of stray capacitance. I'd try using smaller caps.

author: caliper15
author_rank: Contributor
timestamp: April 16, 2013, 11:51:47 pm
content: Quote from: TerminalJack505 on April 16, 2013, 10:47:12 pmlol. I actually manually routed the board.But even if the capacitance is a bit off, would the crystal not oscillate?I've tried bigger capacitances but it still doesnt oscillate. I'll try looking for a smaller one.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 17, 2013, 02:39:57 am
content: The oscillator is going to have a narrow range of capacitance values that it will work with. Google "crystal oscillator safety factor" for more information as well as some techniques to determine the safety factor of your oscillator. The crystal's ESR is a big factor in how much of a capacitive load the oscillator will tolerate.Keep in mind that your oscilloscope probe(s) are adding probably 15 to 20 pF of capacitance to the circuit so I hope you aren't expecting the oscillator to start-up and run when they're connected.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 17, 2013, 07:02:51 am
content: Something totally different which could be a problem (thinking of what you said about oscillating for 2 seconds and then stopping): is the reset line of the mmc maybe floating?

author: caliper15
author_rank: Contributor
timestamp: April 17, 2013, 08:56:27 am
content: Quote from: PA0PBZ on April 17, 2013, 07:02:51 amThe mmc doesn't have a reset or enable pin. I've checked all the power input pins and they have the correct values (3.3V and 1.8V) and have decoupling capacitors. I have a previous board using this same circuit and I can measure 12Mhz from both XI and XO. The only real difference I can think of is the different board layout.