# Can I use a single crystal oscillator for multiple ICs? [duplicate]

Possible Duplicate:
What's the schematic to share one crystal with two micros?

## Background

I am building an Arduino project that basically consists of five Bareduinos.

## Question

Can I share a single 16Mhz crystal with multiple ICs (ATMega328), or does each IC have to have its own crystal?

If each does need its own crystal, will I have any execution latency among the various ICs? For example, if I send a signal from one IC to four other ICs, telling them to each to start blinking their own LED, would the LED blinking be synchronized or slightly out-of-sync?

-
Or this one electronics.stackexchange.com/questions/27989/… where I explain that some microcontrollers (AVR) can output the buffered crystal clock on one of its pins. – jippie Jun 17 '12 at 7:28
this is a duplicate to me, but as a side note you could ask a question about how much this would desync them. An important note here, 100 clock cycles out of sync(which is a crazy amount) would not be visible to your eye at all, it would have to be orders of magnitude greater desync – Kortuk Jun 17 '12 at 20:08
Is there no difference between sharing a single crystal between two ICs and sharing a single crystal between 5 ICs? If there is a difference, this question would not be a duplicate and someone else may need the same answer. – Matthew Patrick Cashatt Jun 17 '12 at 21:50

## marked as duplicate by stevenvh, Kortuk♦Jun 17 '12 at 20:10

The ATMega328 has a full-swing oscillator, with rail-to-rail swing on the XTAL2 output. Buffer it with a 74HC1G14 Schmitt-trigger, and you have a clock you can distribute to the other controllers. The Schmitt-trigger has an input capacitance of typically 1.5 pF, so you may want to subtract that from the oscillator's load capacitance.

This clock can drive the XTAL1 inputs of the other devices directly. I would suggest to keep connections as short as possible, because they will cause a lot of radiation. You can limit that by using an RC filter at the Schmitt-trigger's output. A 100 $\Omega$ resistor plus a 15 pF capacitor give you a cutoff frequency of 100 MHz.

Don't forget to program the CKSEL fuses on the other devices to "0000".

-
 THANK YOU SIR!! – Matthew Patrick Cashatt Jun 17 '12 at 11:52

They can certainly share a 16MHz crystal if the traces are of total capacitance less than that required to load the oscillator (guess 10pF/20cm for 20mil traces) and Too MuchTM noise isn't injected somewhere along the line.

Synchronization between Arduinos, however, is a different beast. First define your maximum allowable phase variation for the project to work. For better than 63 ns synchronization I suggest a new question that asks how to do that, without any IC or oscillator constraints. Interrupts other than the triggering one, that which fires to light the LEDs, need to be ignored for sub-microsecond performance. From about 10 µs to 100 µs, so long as all interrupt service routines (ISRs) are what is known as "thin" (in this case it means they return in less than 10 µs), the micro can perform some other simple tasks, but nothing like serial communication or other continuous duties. In the 100 µs to milliseconds range the micro is free to perform some more demanding interrupt-driven tasks like sub-115200 baud serial communication. Once in the millisecond range one can afford to program ISRs in something other than Assembly, allow sequential as opposed to concurrent signaling (ie: they can be chained), and generally not worry so much about synchronization. Above 10 ms our brains begin to detect flicker.

The above is full of guesses, abouts, and arounds.

-