Author Topic: Measuring XTAL (XI, XO)  (Read 17847 times)

0 Members and 1 Guest are viewing this topic.

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Measuring XTAL (XI, XO)
« on: April 15, 2013, 05:58:10 am »
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.
 

Offline Andlier

  • Contributor
  • Posts: 22
Re: Measuring XTAL (XI, XO)
« Reply #1 on: April 15, 2013, 06:17:36 am »
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.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #2 on: April 15, 2013, 06:55:33 am »
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.

Ah ok. I was able to measure the frequency with an oscilloscope but didn't know why I couldn't with a DMM.
Thanks.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #3 on: April 16, 2013, 08:24:25 am »
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?
 

Offline KJDS

  • Super Contributor
  • ***
  • Posts: 2442
  • Country: gb
    • my website holding page
Re: Measuring XTAL (XI, XO)
« Reply #4 on: April 16, 2013, 09:18:02 am »
What does the datasheet of the microcontroller you are using suggest?

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #5 on: April 16, 2013, 09:28:28 am »
What does the datasheet of the microcontroller you are using suggest?

Actually I'm using an MMC controller chip. It requires a 12Mhz crystal along with 18pF capacitors.
 

Offline Codemonkey

  • Regular Contributor
  • *
  • Posts: 235
  • Country: gb
Re: Measuring XTAL (XI, XO)
« Reply #6 on: April 16, 2013, 10:18:31 am »
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
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #7 on: April 16, 2013, 10:46:47 am »
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

Thanks 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?
 

Offline KJDS

  • Super Contributor
  • ***
  • Posts: 2442
  • Country: gb
    • my website holding page
Re: Measuring XTAL (XI, XO)
« Reply #8 on: April 16, 2013, 11:17:55 am »
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.

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #9 on: April 16, 2013, 06:02:52 pm »
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.

I'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?
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #10 on: April 16, 2013, 06:13:11 pm »
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.
Keyboard error: Press F1 to continue.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #11 on: April 16, 2013, 06:27:44 pm »
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.

I'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:


 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #12 on: April 16, 2013, 06:46:44 pm »
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?
Keyboard error: Press F1 to continue.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Measuring XTAL (XI, XO)
« Reply #13 on: April 16, 2013, 07:00:55 pm »
You might try using mismatched capacitor values.  Supposedly crystal oscillators can lock-up in noisy environments.

This is from an Atmel application note:

Quote
5.4 Unbalanced external capacitors

In noisy environments the oscillator can be affected crucially by the noise. If the noise is strong enough the oscillator can “lock up” and stop oscillating. To make the oscillator less sensitive to noise the size of the capacitor at the high impedance input of the oscillator circuit, XTAL1 can be increased slightly. Increasing only one of the capacitors does not affect the total capacitive load much, but unbalanced capacitors can affect the resonant frequency to a higher degree than the change of the total capacitive load. However, unbalanced capacitive loads will affect the duty cycle of the oscillation and therefore one should in general not use unbalanced capacitive loads.
This is especially critical if running the Atmel®AVR® close to its maximum speed limit.

You 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.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #14 on: April 16, 2013, 07:04:02 pm »
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?

I 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..

 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #15 on: April 16, 2013, 07:12:07 pm »
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.
Keyboard error: Press F1 to continue.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #16 on: April 16, 2013, 07:18:46 pm »
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.

The ground from the capacitors are connected to the ground of the mmc. I have a top and bottom layer ground plane.

 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #17 on: April 16, 2013, 07:38:28 pm »
The ground from the capacitors are connected to the ground of the mmc.

It's not easy to see how, you can just try a short wire to see if it works.
Keyboard error: Press F1 to continue.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #18 on: April 16, 2013, 07:45:25 pm »
The ground from the capacitors are connected to the ground of the mmc.

It's not easy to see how, you can just try a short wire to see if it works.

The 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..
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #19 on: April 16, 2013, 07:55:03 pm »
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?
Keyboard error: Press F1 to continue.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #20 on: April 16, 2013, 09:06:33 pm »
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?

Ah 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?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Measuring XTAL (XI, XO)
« Reply #21 on: April 16, 2013, 10:47:12 pm »
Judging from your layout (autorouter?) I'd say you've got quite a bit of stray capacitance.  I'd try using smaller caps.
 

Offline caliper15Topic starter

  • Contributor
  • Posts: 23
Re: Measuring XTAL (XI, XO)
« Reply #22 on: April 16, 2013, 11:51:47 pm »
Judging from your layout (autorouter?) I'd say you've got quite a bit of stray capacitance.  I'd try using smaller caps.

lol. 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.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Measuring XTAL (XI, XO)
« Reply #23 on: April 17, 2013, 02:39:57 am »
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.
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5437
  • Country: nl
Re: Measuring XTAL (XI, XO)
« Reply #24 on: April 17, 2013, 07:02:51 am »
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?
Keyboard error: Press F1 to continue.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf