10
\$\begingroup\$

I have a microcontroller and an FPGA on the same board. If they're both going to run at the same clock speed, can I just use one oscillator to clock them both? There seems like there is something I should watch out for here, but I can't immediately think of any problems with it if I just keep the traces short. Has anyone done this before? What would be some common pitfalls of doing this?

\$\endgroup\$
14
\$\begingroup\$

Yes, most likely that's fine. You have to make sure each chip is set up to expect a ready clock in, not to drive the crystal itself. You have to look at the datasheets, of course, but most likely the devices can be set up that way.

However, there may be a less expensive way. Very likely at least one (probably both) of the chips can drive a crystal directly. You can have one of them do that, and possibly use it to drive the other chip. This can get a little tricky since the crystal drive output line is more of a analog signal than a digital one, and it may not be interpreted as intended by the other chip if used directly. It may not be interpreted as intended by a ordinary digital gate either, so buffering it close to the crystal and then sending that digital signal to the other chip may not work either. This is where you have to consult the datasheets very carefully and do some experimentation.

A totally reliable way would be to have one chip drive the crystal, have that signal be buffered internally and then driven out on another pin as real guaranteed digital signal. This is more likely to work with the FPGA driving the crystal since you should be able to have the clock signal driven out to a pin. Microcontrollers sometimes have clock out pins, but in the case of PICs at least (what I am most familiar with), that is usually the oscillator/4 frequency, not the oscillator frequency directly. You probably don't want to run the FPGA and 1/4 the clock rate of the micro.

\$\endgroup\$
6
\$\begingroup\$

Some microcontrollers can configure to drive an output pin with the clock frequency from its oscillator circuit. Pretty much a buffer for the clock signal. I believe I read it in a datasheet for ATtiny45. That way only one chip is driving the crystal, but other chips can still use its clock.

\$\endgroup\$

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.