2
\$\begingroup\$

I have designed a PCB for a PIC32MX795 chip. (Datasheet) I want to use an external crystal (Link to datasheet in PDF) but when I solder the crystal to the board, I can't get my PLL to lock to 80MHz. I can get 80MHz using the internal RC but I don't know if that will be stable enough to run a CAN network at 128kBit/s in extreme conditions (50°C)?

I have tried various values of caps but that didn't help.

The caps are connected between the 2 crystal pads and ground.

The 2 remaining pads of the crystal (lid and ground) are both connected to ground. I don't know if it is OK to connect the lid to ground?

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Post the schematic. \$\endgroup\$ – Leon Heller Jun 12 '13 at 12:54
  • \$\begingroup\$ IMO The layout could be better. The capacitance "added" each osc pin aren't equal. And this means unstable oscillation. It would better place the capacitors between the crystal and the PIC. Moreover, you could connect the GND Pin of the capacitors straight to the pin 41 of the PIC. \$\endgroup\$ – Jesus Castane Jun 12 '13 at 13:26
  • \$\begingroup\$ @JesúsCastañé: I connected the ground plane to pin 45 (VSS in the PIC32MX795F512L) and moved the caps closer to both pins. \$\endgroup\$ – Delusion Jun 12 '13 at 15:10
  • 2
    \$\begingroup\$ @Delusion You might find this thread useful. \$\endgroup\$ – Nick Alexeev Jun 12 '13 at 15:36
5
\$\begingroup\$

I haven't looked at that PIC datasheet, but here are some possibilities from experience with PICs in general:

  1. Incorrect electrical connection. This is actually unusual. It's really not that hard to connect a crystal and two load caps. Do make sure that the whole loop is short and that the ground connections of the load caps is a straight and short path back to a Vss pin of the PIC. However, failing to do that usually won't keep it from oscillating, just pick up noise and maybe run at the wrong frequency.

  2. Wrong oscillator setting. Various PICs have various modes for driving crystals, usually called something like LP, XT, and HS, for low power, external crystal, and high speed. You have to use the right one for your crystal. LP is for low power crystals as used in watches for example. Those are intended to be only a few 10s of kHz, usually 32768 Hz. That doesn't apply here. XT and HS provide increasing drive levels to the crystal. Roughly, for 8 MHz or more you probably need the HS drive level over the XT drive level. This is not only to allow conserving power, but you don't want to overdrive a slower and more sensitive crystal.

  3. Messed up clock chain. The clock chain on some PICs can be pretty complicated. There is no general answer except to read the datasheet very carefully and make sure all the setting are right and that all the frequency ranges for the various parts have been observed. There is usually a diagram of the whole clock structure in the oscillator section of the datasheet. It can help to print that out, highlight the path you intend to use, and write down the intended frequencies at each step. Each one must be within spec.

\$\endgroup\$
  • \$\begingroup\$ I just measured at the clock terminal and ground and instead of seeing 12MHz on the scope, I see 50Hz. I guess the caps are the problem. \$\endgroup\$ – Delusion Jun 12 '13 at 12:52
  • \$\begingroup\$ @Delusion: Sounds like you forgot to connect the ground lead of the scope and you are picking up stray coupling from the power line. Since you didn't give you location in your profile, I'll assume you are in a place with 50 Hz power. Rememeber, your profile information isn't really for you, it's a courtesy to us. \$\endgroup\$ – Olin Lathrop Jun 12 '13 at 12:53
  • \$\begingroup\$ #1 isn't so unusual, especially if hand soldered and .4mm pitch. After following advice #3, check with scope to confirm proper oscillation as well. \$\endgroup\$ – Erik Friesen Jun 12 '13 at 14:47
  • \$\begingroup\$ @OlinLathrop: I thought it was strange but I connected the plug to the ground plane. I'll check again. \$\endgroup\$ – Delusion Jun 12 '13 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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