I'm designing an Atmega328P-AU based WiFi development board for my school project, and as you know, crystal oscillators may take some effort to layout, especially when we have a WiFi module. I've been reading AVR PCB LAYOUT for OSCILLATORS practice file, but I still don't know if my design is correct. Any advice or suggestion is appreciated!
Amin, Figure 1-1 in the AVR186: Best Practices for the PCB Layout of Oscillators you linked in your question gives this layout recommendation:
Why do you do it differently? Your layout has the caps behind unnecessarily long tracks, which adds inductivity and diminishes the effect of the caps. It may even introduce weird oscillation modes of the crystal.
Please place the caps between the µC and the crystal and keep the tracks as short and wide as possible. Also, use a guard ring (local ground plane) around the crystal which is connected to ground only by one single thick lead near the µC. Do not connect other GNDs to that ring.
The ground fill improves susceptibility but if it also couples input and output signal across crystal then it reduces gain margin so the gap to tracks should increase.
Load capacitors should be low leakage and stable across temperature (NPO or COG type)
- The load capacitors should be placed close to each other
- The load XTAL IN capacitor should be placed first and closest to the XTAL IN pin and ground
Parasitic capacitance will reduce gain margin. Keep this to an absolute minimum. For example typically: – XTAL IN to ground: 1pF – XTAL OUT to ground: 2pF
XTAL IN to XTAL OUT : 0.5pF ( on a good design.)
- These values are slightly package dependent.
- Reduce the parasitic capacitance between XTAL IN and XTAL OUT pins by routing them as far apart as possible
- A ground area should be placed under the crystal oscillator area. This ground land should be connected to the oscillator ground.
- Connect the external capacitors needed for the crystal and the ceramic resonator operation as well as the crystal housing to the ground plane
- In case there is only one PCB layer, it is recommended to place a guard ring around the oscillator components and to connect it to the oscillator ground pin