5
\$\begingroup\$

I'm at my wit's end trying to get a 32.768 kHz tuning fork crystal to work and I don't know what I'm doing wrong.

First, some background: I'm using a 16MHz crystal in conjunction with an Atmega 328P-PU microcontroller and that's working fine and I'm trying to run an RTC chip off a 32.768 kHz crystal which is where I'm hopelessly stuck. I'm using 10-20 pF ceramic load capacitors and of course I'm using an oscilloscope to verify everything.

I'm trying to run this RTC chip with this inexpensive crystal. However I cannot get it to work whatsoever, either on my PCB or a solderless breadboard. I've used several different load cap values and my crystal is wired up as the RTC datasheet specifies. I've replaced the chips, the caps, and the crystals, and that didn't fix anything.

I even tried connecting the tuning fork crystal to the Atmega chip XTAL pins instead of the 16MHz crystal and that didn't help either.

Do tuning fork crystals need a special circuit to work, or did am I inadvertently damaging every single one I touch...? I even tried different crystals of a similar design from different manufacturers.

Help is greatly appreciated.


EDIT: I solved my problem by switching to a non-tuning fork crystal and getting new capacitors. I think the root cause was the use of low-quality ceramic capacitors that I had bought in a assortment kit online.

\$\endgroup\$
4
  • 6
    \$\begingroup\$ Beware, an oscilloscope can change the load capacitance by a significant amount, so don't necessarily trust what you see there. \$\endgroup\$
    – vicatcu
    Commented Sep 8, 2018 at 17:24
  • 4
    \$\begingroup\$ You should say what the scope is telling you. \$\endgroup\$
    – gbarry
    Commented Sep 8, 2018 at 19:03
  • \$\begingroup\$ My scope is just reading a flatline-- no oscillation whatsover, unless I zoom in really far into the millivolts range and I start to see 60 Hz ripple from (presumably) the scope power supply. \$\endgroup\$ Commented Sep 9, 2018 at 0:11
  • \$\begingroup\$ You could try to recreate a Pierce oscillator on the breadboard with 2 Schmitt trigger inverters and the quartz. If the crystal works, your circuit should do the same. The quartz should not be measured with the probe, it is better to use a Schmitt trigger connected downstream. Therefore 2. \$\endgroup\$
    – arnisz
    Commented Nov 6, 2021 at 20:57

5 Answers 5

1
\$\begingroup\$

First of all, congrats on managing to solve this trouble on your own :)

If you want to learn how to avoid such troubles in your future project - I can recommend this appnote

The possible reason which went wrong with your first part number - wrong load capacitance. The reason is simple:

  1. Your IC:

enter image description here

  1. Your oscillator:

enter image description here

If you try to use the oscillator with CL=12.5 pF (they're more available compared to 6 pF ones) - the Pierce generator inside the RTC won't be able to drive such oscillator, which will produce random troubles from "stops after some time" to "completely doesn't oscillate".

\$\endgroup\$
0
\$\begingroup\$

What exactly is going wrong? What are you expecting it to do and what is it really doing? I assume that the RTC IC won't clock and stay at time 0:00, but you can talk to it through its serial interface.

I've taken a look at the datasheet and in the control register, there's an external oscillator enable bit, which is set to low by default (disable ext. oscillator). Is it possible that you didn't set that bit?

Either way, I don't think that it's the crystal that's causing the problem. I think that (most likely), it's the RTC being set up incorrectly.

EDIT: also, according to the datasheet, the recommended load cap value is 6-9pF

\$\endgroup\$
5
  • \$\begingroup\$ My crystal isn't oscillating at all. Just a flatline on my scope. And swapping it with the 18MHz crystal on the Atmega chip (as a sanity check) didn't help either. Somehow I was able to get it working a few weeks ago on a breadboard but I swear I did nothing different then versus now. In other words, my circuit was functional-- my time setting was being saved through power cycles, so I don't think the code is the issue. \$\endgroup\$ Commented Sep 9, 2018 at 0:10
  • 1
    \$\begingroup\$ Was the Atmega set to external clock when you tried it? If you tried a different crystal with the same results, it means that the crystal is not faulty, but the circuit is not driving it. The crystal won't start oscillating on it's own, it needs a driver (which is housed inside the RTC, but not enabled unless you set the oscillator enable but in the RTC's control register. \$\endgroup\$
    – DELTA12
    Commented Sep 9, 2018 at 10:20
  • \$\begingroup\$ The external clock is indeed enabled on the Atmega. But perhaps it's not a valid circuit with such a slow oscillation compared to 16MHz. I imagine there is some kind of resistive feedback that's overdriving or underdriving the 32.768 kHz crystal. \$\endgroup\$ Commented Sep 9, 2018 at 16:46
  • 1
    \$\begingroup\$ I suppose I could go to Plan B which is to build a circuit that's openly available and known to work with a new set of purchased components. \$\endgroup\$ Commented Sep 9, 2018 at 16:55
  • 1
    \$\begingroup\$ I may have found an answer: electronics.stackexchange.com/questions/368945/… \$\endgroup\$ Commented Sep 9, 2018 at 17:34
0
\$\begingroup\$

The oscillator circuit is an amplifier, with your tuning fork in the loop. One side will be low impedance and driving high or low (it's supposed switch back and forth, of course). The other side is the amplifier input, high impedance, and it should be at the halfway point between supply and ground. Noise there is usually what triggers the oscillator to start. If it's sitting high or low, the oscillator is not going to start. Besides analog considerations, mis-configurations can shut this off, too.

You have a scope, which is a significant advantage.

\$\endgroup\$
1
  • \$\begingroup\$ I did try putting a resistor on one side of the crystal but I think I need to try out different values. Thanks \$\endgroup\$ Commented Sep 9, 2018 at 17:41
0
\$\begingroup\$

Many 32kHz crystals do not require load caps. Double check the datasheet for yours. And as mentioned, the o-scope probe could easily stop a currently running crystal by just touching it. Maybe your circuit IS working, and the problem is elsewhere....

\$\endgroup\$
0
\$\begingroup\$

sometimes you need to enable the Chip (the oscillator) before it oscillates, to save energy. Try to enable it over I2C.

Page 11 on the Datasheet you sent:

Note 1:The ST bit must be set to enable the crystal oscillator circuit.

\$\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.