Strange Crystal Problem

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a 16Mhz crystal hooked up to an Xmega and I can't get it working right. It works fine with the internal oscillator but when I try to get it to use the external crystal it just doesn't do anything.

I tried to probe it and I discovered that it will start working while my probe is touching a particular lead of the crystal. The scope shows a nice 16Mhz sine wave, but as soon as I pull the probe away it stops working again.

I've built several of these boards already and I've never had this problem so I know it's not a design issue. Any ideas?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GordonFreeman wrote:
I have a 16Mhz crystal hooked up to an Xmega and I can't get it working right. It works fine with the internal oscillator but when I try to get it to use the external crystal it just doesn't do anything.

I tried to probe it and I discovered that it will start working while my probe is touching a particular lead of the crystal. The scope shows a nice 16Mhz sine wave, but as soon as I pull the probe away it stops working again.

I've built several of these boards already and I've never had this problem so I know it's not a design issue. Any ideas?


What model crystal and how big are your capacitors on it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think that I recall reading that the XMegas were mote picky about crystal ESR (they want lower ESR). IIRC, most crystals meet the requirement, but some don't.

However, from the symptoms, it sounds like one of the caps is missing, has a poor connection, or wrong value. Adding the scope probe just adds 10pf to 15pf to that node.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did this a couple years ago. So am fuzzy. Seem to remember there were software and configuration register hoops, if missed, it defaults back to 2 MHz internal. I think I used the Atmel application notes for examples, and the usart to check for the correct rate. Not simple like non Xmega.

It all starts with a mental vision.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gordon,

Have you tried another Xtal, yet?

In addition to the above comments, note that you could also have a bad/flaky Xtal. Not common, but certainly known to occur.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah like I said I've built at least 10 identical boards and they all worked fine. I tried replacing the crystal twice as well as the caps once and I verified that they were connected correctly.

Crystal is 16Mhz, caps were 10pf.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, you have pretty well ruled out code, PCB layout, Xtal & caps.

I assume you have the other by-pass caps in place, and a clean power supply.

Perhaps a cold solder joint on the Xtal pins, or some residual flux on the board at those pins?

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GordonFreeman wrote:
Yeah like I said I've built at least 10 identical boards and they all worked fine. I tried replacing the crystal twice as well as the caps once and I verified that they were connected correctly.

Crystal is 16Mhz, caps were 10pf.


The fact that all the others work does not mean it's not a design problem. It could just be that you're on the very edge of being functional. What is the model number of the crystal?

You should give the PCB a thorough cleaning and make sure the soldering looks good as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've not dealt with XMegas, so I am on shaky ground here, but 10pf seems a bit small. The value to use will depend on the load capacitance spec'd for the crystal. If the load is C, then each cap should be 2C - Cstray where Cstray is typically 3-6pf. Thus, if the crystal were spec'd for 10pf load, you would use two caps, each 14pf-17pf.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Agree with Jim - probe has some extra 10+ pF which add to create necessary capacitance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a really good app note about cap selection and crystal operation in general.

http://www.ecsxtal.com/store/pdf/quar_des.pdf

Science is not consensus. Science is numbers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It sounds like GordonFreeman has followed the datasheet. e.g. Table 7.5 of the XMega32A4 datasheet says that 10pF capacitors should be used with 12-16Mhz crystals.

Is the datasheet wrong, or have I got things the wrong-way around... rather than choose capacitors to go with a crystal, we now have to choose a crystal to go with capacitors?!

Nigel Batten
www.batsocks.co.uk

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't trust the writers of an MCU datasheet to know the exact requirements of any given crystal. Atmel provides "suggestions" based on general crystal properties. Why not listen to the crystal manufacturer instead?

Science is not consensus. Science is numbers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most 12-16MHz parallel resonant crystals have a load capacitance of around 18pF, which means you would need about 30pF per cap.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, using the formula in the pdf linked earlier (thanks hobbss), the load capacitance of a crystal connected to an XMega using the recommended capacitors of 10pF must be...
(CL1 * CL2) / (CL1 + CL2) + Cstray
which comes out at 10pF, assuming 5pF Cstray.

@GordonFreeman: Does your Crystal have a 10pF load capacitance?

Nigel Batten
www.batsocks.co.uk

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Again, not sure how you can do that calculation without looking at the crystal data sheet. The crystal data sheet, not the Atmel data sheet will give you the desired CL. From that, you get your C1 and C2 values (I doubt his crystal wants a 10pF load)

Science is not consensus. Science is numbers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm just running the given calculation backwards to work out what the 'ideal' crystal should be for the stated 10pF capacitors. If GordonFreeman's crystal doesn't match that calculation, it could be the cause of his problem.

I'm interested in what the resulting fix is. I'd guess that crystal in question has either 18pF or 30pF load capacitance, hence larger capacitors (20-50pF?) are called for. I'd like to know what side-effects might result from (significantly) exceeding Atmel's recommended capacitor values.

Nigel Batten
www.batsocks.co.uk

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The extra capacitance load will have virtually no effect on the AVR itself, the first thing it plugs into inside the chip is an inverter gate. Too low capacitance will prevent the crystal from oscillating, too high capacitance will just slow down the oscillation by a few KHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Yeah like I said I've built at least 10 identical boards and they all worked fine.

Actually you had not mentioned it in the original post, but I am sure you thought it! :)
Just a thought....not sure if you are using SMD caps, but it it has happened to me where a wrong value cap had got mixed up with known values somewhere in the process somewhere. :oops: Try replacing each cap with a known value.

Talking about identification stuff ups, I once had a manufacturing issue, where we were supplied a faulty batch of 74LS00's and the boards would not work. Fault showed that the QUAD NAND gates were actually HEX INVERTORS, but branded 74LS00! :evil:

Edit..typo

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

Last Edited: Wed. Jun 22, 2011 - 12:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Talking about identification stuff ups,...
I seem to remember a lot of trouble shortly after 1974 differentiating the part number from the date code on a bunch of bargain ICs that we got.

Don

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies everyone. Today was the first time I could get back into lab.

16MHz crystal was 9B-16.000MAAJ-B made by TXC.

I did end up replacing the problem capacitor with a 15pf and now it works great. I then decided to also change the second cap to 15pf which then made it not work again! :shock:

So I now have it working, albeit with a 10pf on one side and a 15pf on the other. If I try to match either side then it stops working. I also realized that my 'magic' probe only performs its magic on 10x setting so that would explain the extra capacitance. Probing at 1x does nothing.

I'm really at a loss here as to what is causing this. I've replaced the caps and the crystal twice and its the same result. :evil:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You probably need MORE capacitance, like 2x more. Try 2x 22pf or 30pf caps. You can also try to stick a 1M resistor in parallel with the crystal, it sometimes helps it to start up.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could be that you have more parasitics in the circuit on one side of the crystal than the other (i.e., the side that "needs" the 10pf).

Science is not consensus. Science is numbers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Probe capacitance is MUCH higher on 1X. Maybe as high as 30-40pf.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hugoboss wrote:
You probably need MORE capacitance, like 2x more. Try 2x 22pf or 30pf caps. You can also try to stick a 1M resistor in parallel with the crystal, it sometimes helps it to start up.

Yep - looks like his crystal is speced for a load capacitance of 18pf. So by my math 27pf or 30pf sounds pretty good.