3
\$\begingroup\$

I have a project which I will need two 8051 microcontroller on a board. I want to reduce its size and cost, so I tried to use one crystal for two microcontroller, but just connect them parallel doesn't work.

One of my friend said that I can try connect normally on one of the chip (chip A), and short the xtal2 from chipA to xtal1 from chipB. (Not connecting anything on the xtal2 from chipB)

Is this the right way to do it? Do I need to change any code? I've tried but I failed, so I need some suggestion.

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

You can connect XTAL2 (clock OUT) of the master chip (the one with the crystal) to XTAL1 (clock IN) of the slave chip and leave XTAL2 (clock OUT) on the slave chip open.

This should work if the chips are close together. If you are running them over a distance a buffer from the XTAL2 output of the master would be a good idea.

Or (better) use a crystal oscillator rather than a raw crystal and drive both chips with the external clock (XTAL1 and each, leave XTAL2 open on both). Pretty cheap, guaranteed stable and start-up and good drive capability.

The code would not change, assuming the clock frequency is the same as what the programs were designed for.

Edit: You should slightly reduce the load capacitor on the XTAL 2 line to account for the increased capacitance of the second input. 5pF is about right. Not important if you don't care about the exact clock frequency.

\$\endgroup\$
2
  • \$\begingroup\$ Is an inch short enough? \$\endgroup\$ Commented Jun 30, 2014 at 13:27
  • \$\begingroup\$ Yes, should be. \$\endgroup\$ Commented Jun 30, 2014 at 13:28
2
\$\begingroup\$

I have used the following circuit to share one crystal between two devices -- not a microcontroller, but two UART expanders which internally have a similar clock circuit with XTAL1 and XTAL2 leads.

enter image description here

The lines on the left are simply the power and ground for the 74HC04 chip. VCC is 3.3V in this case. As you can see, the second HC04 gate drives the XTAL1 line(s), while the XTAL2 lines are left unconnected. Because of the HC04, this circuit has more of a capability to drive multiple devices than simply connecting the same crystal to the XTAL1 lead of each one.

I have left off the frequency of the crystal, and the value of the capacitors (typically 22pf) off of the circuit, since they will be dependent on whatever you are already using.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.