Electronic – Oscillator will not start up reliably

crystaloscillatorpic

I have designed a PCB using a PIC18F6520 and a 32MHz crystal. Using a breadboard with a PIC16F877A, my code works great. But when I load a simple LED blinking program onto my PCB, the LED flickers when I touch around the crystal and does nothing otherwise. The capacitors are 22pF, which gives a load capacitance of 11pF (the crystal specifies 12pF)

The relevant section of my PCB is attached below (please note that I have turned off the ground pour for better visibility, but it is there):

PCB

And here's the corresponsing section of schematic:

Schematic

Best Answer

The maximum crystal frequency that you can use with the PIC18F6520 depends on whether you have the PLL enabled. With it disabled you can use a crystal up to 25MHz (page 320 of the datasheet). With it enabled you are limited to the range 4 to 10MHz.

This certainly explains why the 32MHz crystal does not work reliably. I'm not sure why the 20MHz crytal doesn't work, but perhaps you have the PLL enabled? Or you are running the PIC from a much lower Vdd than 3.3V?