What are the reasons of this undesired effect:

I have a PIC with RTC (Real time clock) connected to an external 32.768kHz crystal for auto-calibration (according to PIC Manual handbook). The crystal is also connected with two 12.5pF capacitors (to ground).

Just after start up of the PIC, the flow of the time given by PIC is wrong (a second given by the PIC are 4 real seconds more or less) and it keeps so until I touch the cover of the crystal with the finger, then the time flow right. After shutdown and restart the problem appears again. I mean it is a problem with electrostatic charge. but why and from where comes the charges?

  • The PIC pins for the crystal are defined according compiler rules for external clock, could the problem comes from the PIC pins? (due to float possible state)
  • Is it a signal that some capacitor is broken? Or maybe the 12.5pF are not enough...
  • The crystal is placed only 1 cm from the pins, should it be even closer?

Note: question was updated following comments bellow - original capacitors were 22pF, now I have changed to 12,5pF but the problem persist.

  • 1
    \$\begingroup\$ What is the part number and manufacturer of your crystal? Please include a datasheet link if possible. It may also be helpful to have the part number for your PIC. Your capacitors are probably too big. \$\endgroup\$
    – Tut
    Jun 26, 2014 at 19:04
  • 3
    \$\begingroup\$ It might not be electrostatic at all. It could be that the oscillator starts up in a weird sub-harmonic mode of oscillation, and the mechanical damping provided by your fingertip kills that mode and allows the proper mode to dominate. How do you have the crystal physically mounted to the board? \$\endgroup\$
    – Dave Tweed
    Jun 26, 2014 at 19:29
  • \$\begingroup\$ In the next days, I will change the capacitors to 12,5 pF ( you are right according datasheet the value is lower). In that moment, when I built the board I had only 22pF capacitors and I decided to try it with them, everything including RTC ran correctly, but the problem began a week ago when I have modified a little the board and updated the PIC software (PIC24FV302), but the routine for RTC didn't changed. Any case, I will give you my feedback about the result with new capacitors. I hope this is the reason. \$\endgroup\$
    – Alf
    Jun 26, 2014 at 21:04
  • 2
    \$\begingroup\$ It is also normal to ground the crystal can, to screen the crystal and minimise interference to the oscillator. \$\endgroup\$
    – user16324
    Jun 26, 2014 at 21:10
  • 1
    \$\begingroup\$ I doubt the soldering or any break in capacitors....when you have any dry soldering or bad soldering pressing or touching things will work...... \$\endgroup\$
    – user19579
    Jun 27, 2014 at 5:59

4 Answers 4


22 pF sounds really high for a small 33 kHz watch crystal. This excessive capacitance is probably causing the PIC and crystal to oscillate at some sub-harmonic. But the loop gain is low and the oscillator is unstable. A little jolt when you touch it causes it to jump to the intended frequency.

This is a good example of the trouble one gets into when building a circuit without having read the datasheets. Go read the crystal datasheet and see what a appropriate load capacitance is.

  • \$\begingroup\$ I have changed the capacitors to 12,5pF according crystal manufacturer specifications but the problem persist, even the time period of the crystal increased. \$\endgroup\$
    – Alf
    Jun 28, 2014 at 10:21

According to Microchip documentation, the PIC must be configured in LP mode and the capaitor values range from 68 - 100 pF. Here is a snip from their manual.

So that suggests that your capacitors may be too light (small). Looking at the Epson data sheet for THAT recommended crystal datasheet you see that they are saying at least 6 pF and probably more.

enter image description here

Your touching the can is probably coupling in stray e-field and that it kicks the oscillation into a higher mode. So play around with different values.

Having the can 1 cm away from the package is probably not safe, as you've demonstrated with your finger.

  • \$\begingroup\$ Thank for your answer, it is good to take into account there are differences between the recommendations of the Cload of the crystal manufacturer and PIC manufacturer. But I think in this case that you write, it is for the operational PIC oscillator, and in my case the problem was with an external secondary oscillator for RTC. My PIC (24FV32KA302) run in HS mode with internal oscillator to 8MHz without problem with this. \$\endgroup\$
    – Alf
    Jun 29, 2014 at 9:10

The PIC pins for the crystal are defined according compiler rules for external clock, could the problem comes from the PIC pins?

Could be.

An external clock is just that; a stand-alone oscillator with a high-level output designed to drive a clock input all by itself, and if the compiler thinks that's what's out there, it'll shut down the unneeded crystal drive.

Unless, of course, it's differentiating between its own internal clock oscillator and an external crystal, in which case the drive will be there.

Is it a signal that some capacitor is broken?

Not likely.

Or maybe the 12.5pF are not enough...

Very, very, likely.

In the common CMOS-driven Pierce oscillator, the capacitors are actually in series with the crystal, so if the crystal manufacturer specifies a load capacitance of 12.5pF, the capacitors should be 25pF each.

Read this for a better understanding of how the Pierce oscillator works.

The crystal is placed only 1 cm from the pins, should it be even closer?

"As close as possible" is good, but I don't think 1 cm VS 1 µm is going to make any difference as long as you get the proper drive to it.

  • \$\begingroup\$ Thanks for your comments, finally the problem was the crystal. \$\endgroup\$
    – Alf
    Jun 29, 2014 at 9:02

Thanks to all the answer above, they have given me ideas to try different attempts; first changing to smaller ( according comment from Olin and Tut) and bigger ( according comments from placeholder and EM Fields) capacitors but all attempts without success ( so many desoldering and soldering in a small place was not special good for my poor board). Then I have tried to change the software to force the OSC pins to ground for a short time before they change to OSC mode. All this without success too.
Finally i decided to ask a good friend for an oscilloscope ( I don't have one, it is too expensive for me), and the result was that the crystal was very unstable with the frequency and changing randomly more or less.
I have changed the crystal and now everything run perfect.
For future readers, who experience the same problem, I recommend you to make some measures with a oscilloscope before anything, better to invest a little time to get someone and get this information, it would save you time and work.


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.