Best low noise XTAL layout for AVR/PIC

Discussion in 'Embedded Systems and Microcontrollers' started by ping, Sep 16, 2009.

  1. ping

    Thread Starter New Member

    Sep 16, 2009
    13
    0
    Hi this is my first post here.

    I have a question to which I have not found a conclusive answer from searching across the internet.

    When making a PCB for a circuit that uses a standard MCU like a PIC16F84 or an AVR (AtMega family) running up to a maximum of 20Mhz. What are the best practises for PCB layout of the crystal.

    I have seen it said by some that there should not be a ground trace under the crystal while others say there should be. I have done several single sided boards without any problems and I am designing my first double sided board using an AtMega AVR, using a through hole crystal.

    I aim to connect the oscillator caps (22pf) directly to the AVR ground pin/decoupling cap. And then connect this ground pin to the overall ground pour. This keeps the oscillator ground, isolated from the overall ground.

    Should I:

    1. Leave empty space on both the top and bottom layer under the crystal?

    2. Leave empty space on top layer under crytal and space on bottom layer as well, but extend the capacitor ground as a guard ring track around the crystal?

    3. Do a ground pour on the bottom layer under the crystal and leave space on top layer under crystal?

    Should I leave emptyspace on on both layers under the crystal or should I leave a ground pour under the crystal only on the on the bottom layer, ie only but leave a gap under the crystal on the top layer. Or


    I am wanting the best possible layout, its not critical, but I would like to have a robust design because. Instead of reinventing the wheel perhaps people who have found the best results could share some advice. Thanks
     
  2. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    Hi,
    the basic idea is keep everything short and neat and connect the grounds directly.
    I usually have a ground pour under the crystal can, and if using a cylindrical style lay it down & solder the 'top' to the ground plane.

    You can use a guard track on the solder side if there will be any analog or high speed signals near the oscillator tracks to minimise crosstalk either way, but this is not normally critical if you use short tracks & reasonable spacings.

    For some example info from Microchip, see figure 7-4 (around p75) in this datasheet:
    http://ww1.microchip.com/downloads/en/devicedoc/30487c.pdf
     
  3. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
  4. ping

    Thread Starter New Member

    Sep 16, 2009
    13
    0
    Hi thanks guys. I have read through those docs already, comeing here is my last resort.

    I have seen so much contradictory views and was hoping to get a shortcut to the best answer from someone who has gone through all the trouble already :)

    Even the two Atmel Docs contradict eachother. If you look at doc8128(AVR186) on page 2 you see the capacitor are closer to the MCU and they are connected to the ground plane that acts as a guard ring.

    Whereas if you look at doc2521(AVR042) on page 13 they show what seems to be through hole, but the capacitors are on the other side of the crytal and there is a pour under the whole crystal/cap setup.

    I have seen it mentioned that one should not do a ground plane on the top layer under a crystal because it can induce noise in the crystal and load the oscillator circuit, I have also seen it said that having a groundplane on the bottom layer is bad too because it affects the load capacitances of the capacitors and also can cause noise to be picked up and coupled into the crystal causing it to stall.

    I am using an HC 49 through hole crystal, I am not using surface mount. In Eagle PCB the program I am using crystal package has a "keepout" on the top layer, which seems to not be happy with tracks and even a ground pour under the crystal on the top layer. So I guess this means no pour on the top layer which is fine for me.

    That leaves me with the bottom layer, should I go for a guard trace from the MCU ground or should I just take a chance and pour a ground plane. My ground plane will be coming directly from the MCU ground sort of like a spoke coming from a hub, it doesnt connect to anything else.
     
    Last edited: Sep 17, 2009
  5. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    A ground plane under the crystal cannot induce noise, it just prevents the can floating and the capacitance being influenced by proximity of other wiring / objects.

    As I mentioned earlier, if I want to be sure of stability I solder the crystal can to the ground plane. Grounding the can is common practice in high quality commecial gear where stability is important. Good grounding practices also reduce EMC problems.

    Use top side groundplane / copper fill, keep everything short and neat and you will not have any trouble.

    Unless you are making a clock it's not all that critical, and for a clock you should allow a trimcap at the oscillator input for fine tuning, or use a TCXO module rather than a cheap crystal which is inherently temperature sensitive..
     
  6. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    The caps can go on either side of the crystal osc -- the most important thing is that the traces are short and neat as Robert mentioned. I have never had a problem with the AVR not oscillating. When you choose a xtal read the datasheet to determine the recommended parallel capacitance. The two appnotes show layouts for a double-sided board and a multilayer board. The AVR042 shows a device that has only 1 ground pin and the copper pour is to connect the decoupling caps near VCC with a wide ground return. The other appnote AVR186 shows an example with a TQFP part which usually has multiple ground pins. The layout has the xtal caps returning to the ground pin closest to them. If you use small caps (0603 or 0402 SMD) then you will have to put them like AVR042 unless you use very thin traces (not recommended for higher frequencies).
     
    Last edited: Sep 17, 2009
  7. gimpo

    Member

    Jan 27, 2016
    119
    7
    Hello, I resume this old post because I have the same four doubts of the starter of this thread (namely the #1)

    Reading the answers I understood that a guard ring is not strictly necessary, it reduces mainly crosstalk effects with high speed traces running around. At the same time a separated ground pour is highly suggested.

    Here my case: I'm dealing with a STN1110 IC and the datasheet reports a strange configuration for the oscillator. All I have is this paragraph:
    oscillator_pins.jpg

    It seems like a guard-ring but is not because it is also driving ground for the two caps. It's a very strange solution. o_O
    The empty region is on the TOP and BOTTOM layer both or not?
    Would you go for manufacturer instructions?
    (The oscillator used is a crystal 16Mhz in metallic can and HC49/US package)
     
  8. JohnInTX

    Moderator

    Jun 26, 2012
    2,339
    1,022
  9. gimpo

    Member

    Jan 27, 2016
    119
    7
    Thanks, I will check that docs.
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The purpose of the guard ring is to prevent surface effects or stray currents from affecting the oscillator pins 9 and 10. Any stray currents get shunted to ground.

    Since these pins are only on one side you cannot guard the bottom side.

    When you do this your first time there is a tendency to over think this given so many sources of seemingly contradictory information. The good news is this just ain't as critical as you fear. Given the right crystal and correct caps it will chug along just fine.

    These things even work well when stuck into a solder less breadboard. The frequency may shift a small bit but it still works.
     
    JohnInTX likes this.
  11. gimpo

    Member

    Jan 27, 2016
    119
    7
    Thanks Ernie, as usually happens to me, I'm overthinking about details until my brain fries.

    Actually that is not an SMD chip, it is mounted through holes. So I could design the same ring on the bottom layer too (it costs nothing to me).
    Oh no! I'm overthinking agaaaaaain! :eek:
     
Loading...