32.768KHz Crystal Placement In The Board

Thread Starter

PIC-User

Joined Sep 25, 2015
63
Hi all,

I have a design where I'm putting a 32.768KHz crystal and the two 12pF caps about 1.2 inches away from the microcontroller. I don't have much space on the PCB board and I want to avoid putting the crystal on top of the circuit antenna coil that you see in the right upper corner of the picture below. Is this a good design practice to place the crystal on the board the way I'm doing it? Is this going to cause any trouble or noise in the design? Any suggestion?

Thank you,

Robert

CrystalPCB.png
 

Papabravo

Joined Feb 24, 2006
21,158
The traces have inductance and normally you want the crystal as close to the amplifier as possible. What frequency is the antenna working with? Do you imagine that interference will actually be a problem?
 

jpanhalt

Joined Jan 18, 2008
11,087
I don't know what's right or wrong. My last design used an SMD oscillator for that frequency. Keep leads short and don't run other signals under it is advice from the datasheet. Looks OK to me.

Edit: Didn't notice the distance. As PB said, keep that as short as practical.

Edit: added emphasis
 
Last edited:

Thread Starter

PIC-User

Joined Sep 25, 2015
63
The traces have inductance and normally you want the crystal as close to the amplifier as possible. What frequency is the antenna working with? Do you imagine that interference will actually be a problem?
The coil is an NFC antenna working at 13.56 MHz. It is rarely used. When you say interference, do you mean the crystal interfering with the coil or the other way around? Do you think that the coil antenna might cause the crystal to malfunction?
 

Papabravo

Joined Feb 24, 2006
21,158
The coil is an NFC antenna working at 13.56 MHz. It is rarely used. When you say interference, do you mean the crystal interfering with the coil or the other way around? Do you think that the coil antenna might cause the crystal to malfunction?
I wasn't sure there was an a priori conclusion. The farther apart in frequency the crystal and the antenna are the less likely they will interfere. I imagined that the antenna was entirely on the board, but that seems unlikely since the wavelength is just over 20 meters. The problem with long traces on a crystal is that it changes the impedance seen by the crystal which may affect either the startup or the actual frequency of oscillation. You won't know until you get your boards back because there really is no way to know unless you can measure what is going on. If it were me I would strain to put that crystal right next to the processor.
 

Thread Starter

PIC-User

Joined Sep 25, 2015
63
How do you measure the signal at the crystal oscillator? Do you use an oscilloscope? What to look for?

Yes, I will get the crystal closer to the microcontroller.
 

jpanhalt

Joined Jan 18, 2008
11,087
The load from an oscilloscope directly attached to a crystal can affect its frequency, but might work. I test/tweak my crystals with code. For example, output a pulse on every rollover, then measure that with you oscilloscope or counter. If you just want to know whether it is working you can use an LED.

You didn't mention which MCU. Some devices (maybe most) will have a register bit to indicate oscillator is functioning. you can just check that bit.
 

MrChips

Joined Oct 2, 2009
30,706
Don’t connect the oscilloscope to the crystal in order to measure the frequency. That will disturb the crystal.

You need to use code in the MCU to generate a square wave on an output pin. Examine that signal on the oscilloscope.
 
I also join the chorus of advising to move the crystal *as close as possible* to the microcontroller.
To reduce the footprint, place the crystal can vertically.

I believe that in many microcontrollers you can assign a pin as a buffered crystal output. Otherwise, you need a home made sniffer, bassically a small loop of wire soldered to the end of a coax which you then connect to the scope. The signal will be low but discernible.
 

Thread Starter

PIC-User

Joined Sep 25, 2015
63
I managed to get the crystal closer to the microcontroller. Is this acceptable now? I know that this is not the ideal case, but I don't have too many options here. All the other pins in the microcontroller are taken. I'm using a PIC16F19197.

Another option is to use this crystal,
https://www.mouser.com/ProductDetai...UqGVbwDk99bELjVGLakJbn7uWZehNe82ZMNUhD9uTPQ==
but it is going to be on top of the coil antenna and I can't run the necessary ground patches that you usually use around any crystal.

Crystal-02.png
 

Thread Starter

PIC-User

Joined Sep 25, 2015
63
I see lots of room for a xtal and two capacitors.
Thanks, I will definitely go that route if what I'm doing now fails. I found this design guidelines for the layout of oscillators in a PCB board. It is very instructive.

http://ww1.microchip.com/downloads/...out-of-Oscillators_ApplicationNote_AVR186.pdf

This guidelines were made for a different type of oscillator than the one I'm using, but I have a question about the following note,

Reduce the parasitic capacitance between XTALIN and XTALOUT pins by routing them as far apart as possible

As you can see in the PCB layout above, I'm routing the two crystal lines close to each other, 10 mills apart. Is this correct? Should I put those two line farther apart?
 

Deleted member 115935

Joined Dec 31, 1969
0
As you are asking the question, I guess you know the problems. 32.768 KHz are notorious for not oscillating, they are very sensitive to the parasitic of layout.

Looks like the antenna is on the bottom, the crystal on the top, is there a plane between them ?
 
Top