2
\$\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\$
  • 3
    \$\begingroup\$ Beware, an oscilloscope can change the load capacitance by a significant amount, so don't necessarily trust what you see there. \$\endgroup\$ – vicatcu Sep 8 '18 at 17:24
  • 3
    \$\begingroup\$ You should say what the scope is telling you. \$\endgroup\$ – gbarry Sep 8 '18 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\$ – Jerry Schwarzbach Sep 9 '18 at 0:11
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\$
  • \$\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\$ – Jerry Schwarzbach Sep 9 '18 at 0:10
  • \$\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 Sep 9 '18 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\$ – Jerry Schwarzbach Sep 9 '18 at 16:46
  • \$\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\$ – Jerry Schwarzbach Sep 9 '18 at 16:55
  • \$\begingroup\$ I may have found an answer: electronics.stackexchange.com/questions/368945/… \$\endgroup\$ – Jerry Schwarzbach Sep 9 '18 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\$
  • \$\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\$ – Jerry Schwarzbach Sep 9 '18 at 17:41

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.