0
\$\begingroup\$

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.

\$\endgroup\$
6
  • \$\begingroup\$ We had a similar strange behavior with a microcontroller showing temperature dependence; make sure that you are using correctly all the input/output interfaces, because if they are left dangling, can be subject to environmental variations. \$\endgroup\$
    – clabacchio
    Commented Feb 29, 2012 at 9:27
  • \$\begingroup\$ Is each Vdd-Vss pair decoupled? \$\endgroup\$ Commented Feb 29, 2012 at 11:03
  • 1
    \$\begingroup\$ The usual stuff: All Vdd, Avdd, Vss, and AVss pins must be hooked up. All Vdd and Avdd pins must have bypass caps physically close with short loop distance back to Vss pin. MCLR must not be left floating. Watchdog must be off or regularly kicked. Power supply must not have occasional glitches going below the operating limit for the frequency you are trying to run at. All the frequency limits in the various clock dividers and PLL must be observed, you can't just use any combination. \$\endgroup\$ Commented Feb 29, 2012 at 13:33
  • 1
    \$\begingroup\$ @ThomasO - Have you tried it with a simple test program (e.g. flashing LED with no floating inputs), and the WDT off? Or running with the internal oscillator? If not give those a try to narrow things down a bit. Posting a picture of your layout, crystal part number and crystal decoupling cap values would help also. \$\endgroup\$
    – Oli Glaser
    Commented Mar 1, 2012 at 1:03
  • 1
    \$\begingroup\$ You could try changing crystals. In one product, we had similar behaviour based on temperature and a finger on the crystal to heat it up was enough to take it through a critical temperature at which it would stop oscillating. Analysis of crystals by the manufacturer showed a defect in the way the crystals were cut, putting them out of spec. We also used freeze spray to weed out bad units, but I'm not sure if the thermal shock is good for the crystals. \$\endgroup\$ Commented Mar 1, 2012 at 10:33

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.