22
\$\begingroup\$

How do I share a single crystal (not a complete oscillator module) between two micros? Is it OK to just connect everything as normal for the first micro and also directly connect its XO to the XI of the second microcontroller? I expect to place the micros very close together on the board.

\$\endgroup\$
0

6 Answers 6

20
\$\begingroup\$

What I have done when I needed to share a clock between micros is to have the crystal drive the oscillator on one micro and then use the oscillator output pin (typically CLKOUT or OSCOUT) from that micro to drive the second micro.

I would expect problems trying to drive two oscillators from the same crystal, if for no other reason than that the capacitance of the long PCB traces required to go between the two processors would cause a malfunction.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Some microcontrollers do have a separate clock output pin that is not connected to the crystal. \$\endgroup\$
    – joeforker
    Jun 14, 2011 at 15:32
  • 2
    \$\begingroup\$ The MSP430 processors can route any of the internal clocks (ACLK, SMCLK or MCLK) out of their I/O pins. I use the ACLK out (32768Hz) to supply the RTC backup clock to a GPS device for the times that its main power is off. \$\endgroup\$
    – uɐɪ
    Jun 15, 2011 at 7:30
9
\$\begingroup\$

That is not quite what you want. When you use a crystal to form an oscillator, you are using an inverter internal the the microcontroller to drive the crystal. If you connect both micros to the same crystal, they will fight and not work.

Therefore you will want to pick one of the two micros to serve as the crystal driver (configure as shown in section 6.2.6 of the datasheet) and the other micro to use an external clock input (6.2.1 of data sheet). Then change your schematic connection like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Alternatively, if symmetry is desired you can use an external oscillator as opposed to a crystal. Then both could operate in external clock mode.

\$\endgroup\$
10
  • \$\begingroup\$ There is a definite need to adjust the upper capacitor in this set-up, if one wants the full benefits of the predictability of a crystal. \$\endgroup\$
    – Asmyldof
    Aug 27, 2015 at 22:27
  • 2
    \$\begingroup\$ so if C2=10pF (assuming about 10pF loading due to the CLKI input) and keep C1=22pF, right? \$\endgroup\$
    – MarkU
    Aug 27, 2015 at 23:16
  • 1
    \$\begingroup\$ @Passerby That's why I want to keep this question alive. The other question didn't provide any clear schematics. \$\endgroup\$
    – GisMofx
    Aug 28, 2015 at 13:02
  • 1
    \$\begingroup\$ No it will just come up as is if it was using any external clock. \$\endgroup\$ Aug 28, 2015 at 13:08
  • 1
    \$\begingroup\$ @GisMofx I flagged it asking for the answer to be merged, so that it gets moved over to the other question, so it can be preserved. \$\endgroup\$
    – Passerby
    Aug 28, 2015 at 13:29
4
\$\begingroup\$

The problem with that approach is that the connection to the second oscillator input will affect the capacitance on that pin, and alter the frequency slightly as well as reducing the crystal drive. It might not matter, though, and is very unlikely to prevent oscillation. When I've needed to do that for a product I've used a crystal oscillator module for both MCUs.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ A little extra capacitance on the oscillator output line isn't much of a problem. It's mostly the capacitance on the output side of the crystal, which is the oscillator input line, that forms the load on the crystal and needs to be about right to get the proper frequency within range. If you need to distribute the clock widely, put a CMOS buffer gate close to the micro with the crystal. \$\endgroup\$ Jun 14, 2011 at 14:07
  • \$\begingroup\$ Also it's a great idea for EMI to avoid routing clock signals across boards. \$\endgroup\$
    – joeforker
    Jan 23, 2014 at 20:35
3
\$\begingroup\$

You may build oscilator using cheapo invertor chip (0.1$), or specialized clock generator (slightly more expensive), and feed that clock to both uC.

Simply connection crystal to both would not work (reliably).

\$\endgroup\$
2
\$\begingroup\$

If it's anything like the PICs I've used, you have an XTALout and and XTALin with the actual XTAL between them and caps (maybe around 22pf) to ground. Try connecting the XTALout of one to the XTALin of the other.

\$\endgroup\$
1
  • \$\begingroup\$ It's recommended to use a small series capacitor to drive the second oscillator from the output of the first. \$\endgroup\$
    – stevenvh
    Apr 12, 2012 at 14:40
2
\$\begingroup\$

Make an oscillator out of your crystal and an inverter like BarsMonster suggested, and feed it into the input of a fanout distribution buffer IC. One fanout buffer output goes to the clock input of each MCU.

I can't really recommend a specific part without knowing what micros you're using, but you'd want to start with these filters:

  • Type: Fanout Buffer (Distribution)
  • Number of Circuits: 1
  • Ratio - Input:Output: 1:2
\$\endgroup\$
2
  • 1
    \$\begingroup\$ A list of 3000 parts is not really useful. Select one of them, and explain why it's a good choice. \$\endgroup\$
    – stevenvh
    Jun 8, 2012 at 6:33
  • \$\begingroup\$ I'm hesitant to put a specific part directly in the answer without knowing what logic levels etc. he's using. I 'll put in some search filter info to help narrow it down. For what it's worth, I'm currently using an oscillator with a TI CDCLVC1102. It looks like you could use a CDC3RL02 with a TXCO and no inverter as well. \$\endgroup\$
    – Joe Baker
    Jun 9, 2012 at 9:38

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.