Unstable oscillator using dsPIC

oscillatorpic

I've built up a small PCB with a dsPIC33FJ128GP804 microcontroller and a 7.3728 MHz crystal, among other components.

While testing it last night I had no problems at all getting it working. It fired right up and the PLL locked at 36.864 MHz (x5) and all was good.

This morning though, I powered it up and I found that it would run for a couple of seconds, then lock up. Or the crystal would start oscillating but then the oscillations would collapse after a few tens of milliseconds. Or, it would power up and run, but would occasionally glitch, then keep running (for example, the 20 Hz blinking LED might seem to miss a few flashes.)

Now I've been able to get it working again, and I'm not sure why. I used some upside down compressed air as freeze spray to see if I could get it to do it again, and that seemed to affect it. However, my freeze spray may be conductive and causing problems with the oscillator because of that. It didn't crash right away; it took about 10 seconds before it started skipping a beat here and there, before finally locking up.

When it tries to start oscillating the current consumption goes up from 20mA (mostly power LED) to around 40mA. Because I have a milliammeter (DMM) in series with the circuit, this makes the supply voltage drop by around ~0.1V, so I can visibly see the power LED flickering when this happens. However, it seems to still have problems with no ammeter. The spikes in current seem random, but once every few seconds – slow enough to capture on a 4 Hz digital multimeter.

I have a hunch that it's something to do with my layout. The original design which I have the PCBs for has the ground for one of the load caps in a non-optimal space, due to a design error. (I initially designed the oscillator section to have a local ground, but I moved some traces and the grounds got split, aside from a small join between them.)

However, I have no idea why this would be temperature dependent. I would thought it would be a go/no-go thing.

Best Answer

I've run into similar issues with other Microchip parts like their real-time clock. In our case the crystal we selected did not meet the Microchip requirements. We saw very similar results in that sometimes it would run fine for a while then stop or run slow all the time.

Many of Microchips new low power designs use very low power oscillators that require very low capacitance crystals. Check the datasheet for your part and crystal to make sure they are compatible. If you still have any doubts check with an applications engineer at Microchip.