3
\$\begingroup\$

Update: This question is based on a wrong assumption, the problem has now been fixed. The problem was an incorrect register setting in the RTC. However the answers given regarding load capacitance for crystal oscillators may have value to people in general situations.


I have a prototype PCB of my own design. It was originally designed to use an ST brand "M41T81S" real time clock chip with a cheapo 12.5 pF watch crystal. Timing accuracy is not important (+/- 5 seconds per day drift is fine).

I have swapped out the old RTC and I'm now using a Microship brand "MCP7940N" instead, which is a pin-for-pin match for the original and has fully compatible voltages. The new chip works fine as far as the I2C communications goes. I can program the registers and read them out without problems.

The original design does not include load capacitors as the old chip didn't need them, it kept reliable time and didn't miss any clock pulses.

enter image description here

However the new chip does appear to have stricter requirements for the oscillator circuit and only sporadically responds to the crystal's signal (perhaps 1 in a million pulses is registered). Most of the time it does not "keep the time" at all. It effectively cannot see the crystal signal.

The scope reads a clean and stable 400mv p-p sine wave on the XTAL1 pin with the new RTC. I'm guessing this isn't suitable for the new chip, the datasheets for the xtal and new RTC do not specify the waveforms produced or required.

I admit that the new chip's datasheet says that "12.5 pF crystals are not recommended". Fair enough, my own stupid fault for buying these parts without properly checking for compatibility. Doesn't really matter in the long run.

Question:

Given that I've already made a dog's dinner of this prototype, is there a way that I can hack something together in the short term in order to get this new RTC to operate with the unsuitable 12.5 pF crystal and lack of load caps? It's only a prototype and definitely needs a re-spin of the layout for several other reasons besides this problem.

I figured I should change the crystal to a 6-9 pF as stated in the datasheet for the RTC but that still leaves me with nowhere to put the load caps. I've never had to mess much with crystal circuits before and could use some advice about just bodging this prototype to get this "proof of concept" board to function.

(If this turns out to be impossible then I still have the option of running the RTC from an external signal such as a microcontroller outputting a square wave, so all is not lost. I'm mainly asking this question out of curiosity rather than necessity)


Datasheets:

\$\endgroup\$
6
  • \$\begingroup\$ Not sure what your issue is... Fly_Wire axial caps to the leads of the new crystal keeping the body of the caps close to the XTAL and ground the other side somewhere close. \$\endgroup\$
    – Trevor_G
    Apr 12, 2017 at 10:49
  • 1
    \$\begingroup\$ What does the board look like, how much space is there? You could probably bodge them in with some thin wiring glue and a soldering iron \$\endgroup\$
    – PlasmaHH
    Apr 12, 2017 at 10:50
  • \$\begingroup\$ @PlasmaHH,@Trevor - is it feasible to use axial caps in this way without inductive effects just overwhelming the crystal? \$\endgroup\$
    – user98663
    Apr 12, 2017 at 11:03
  • \$\begingroup\$ @Wossname as log as you keep everything short... and trim of excess, yes \$\endgroup\$
    – Trevor_G
    Apr 12, 2017 at 11:05
  • 1
    \$\begingroup\$ Clearly, you need to add to each crystal pin some capacitance-to-ground so that oscillations are maintained. You may have no choice but to add two discrete capacitors. But you might kludge a fix by grounding xtal case to add a tiny bit of capacitance. And cover that critical area with sticky aluminium (insulated) foil, including covering a ground-plane, to add more capacitance. \$\endgroup\$
    – glen_geek
    Apr 12, 2017 at 13:44

3 Answers 3

5
\$\begingroup\$

The new chip is probably optimized for very low power. It may not have the drive level to get enough amplitude thru a 12 pF crystal when the proper load caps are used.

However, you say you see a signal when looking at one of the crystal pins with a scope. If you see the expected frequency, then the oscillator is working when you are looking at it. This may be because the scope probe capacitance is adding the phase shift needed for the loop gain to be above 1 at the crystal frequency.

If this is what is happening, then there should be two clues. First, the RTC will work while you're holding the scope probe on the crystal pin. Second, it will only work when the scope probe is on the oscillator input, not the output. It is the phase shift caused by the extra capacitance on the crystal output that allows for oscillation.

Either way, there really should be a little capacitance on the crystal output (the oscillator input). Kludge on a 10-12 pF cap between the crystal output and ground for now. When you re-design the board, include pads for a cap on each side of the crystal, and get a crystal rated for the 6-9 pF you say the chip is intended for.

\$\endgroup\$
1
\$\begingroup\$

It seems that your scope probe is providing the load capacitance to get the oscillator running. Does the device keep time when the scope is connected?

It also seems unlikely that this device is so sensitive to capacitance that it won't run with virtually any "standard" crystal and suitable load capacitors. Try, for example, putting 22pf capacitors from the X1 and X2 pins to ground, and monitor the output from the MFP pin. (Naturally, you have to configure the MFP output first - and remember the pullup resistor.) You can also monitor the oscillator status, which will tell you if the device thinks it is running.

\$\endgroup\$
1
\$\begingroup\$

Well this took a lot of headscratching and faffing around but it is now running from the old crystal without the need to add any caps.

PEBSIAC

Problem Exists Between Soldering Iron and Chair

It seems that I was conflating the terms "external crystal" and "external oscillator" while reading the datasheet for the new RTC chip.

Turns out that my question as originally asked was a red-herring. It had nothing to do with the load caps or the crystal. @henros was right in that the chip doesn't really care that much about what crystal you use.

The problem was that I was setting the "EXTOSC" flag in the RTC registers while trying to use an external crystal. The difference in terminology is subtle but critically important! I missed it completely and it took several read-throughs of the datasheet's oscillator config section to figure it out.

If one is using an external CRYSTAL, then the "oscillator" being used is actually a bit of circuitry inside the RTC chip. If one is using an EXTERNAL OSCILLATOR then the internal oscillator is disabled and therefore so is the crystal.

I had fallen into being lazy with my nomenclature for crystals and oscillators, which are two entirely different things! School-boy error.

Anyway, the problem went away by using the old crystal and simply clearing the "EXTOSC" bit in the RTC registers. Now the system works just fine.

Thanks for the answers guys, sorry that the question was erroneous.

\$\endgroup\$
1
  • \$\begingroup\$ In case it's useful to someone else on this topic, google "Vittoz oscillators". I can tell you a horror story about the Atmel Mega128 which used this sort of oscillator as the default.. Non-deterministic execution of code, and peripherals getting clocked most of the time is the short version.. \$\endgroup\$
    – user121934
    Oct 17, 2019 at 20:14

Your Answer

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