I am moving my Arduino project to another platform, operating at 3.3V. (5V from USB not useable due to some 3.3V-only chips in the design) Having read about this it seems that 12MHz is a good speed to use, and my stock USB to UART converter, CH340G does call for a 12MHz crystal.

Now what is the best way to share this 12MHz clock between CH340 and ATmega328P, eliminating an extra crystal? Can I tap off XO pin from CH340 with crystal attached, and carry it to the XTAL1 pin of the ATmega?


If sharing clock requires some fine tuning, what about building a reference clock out of 74LVC1G04 and 74LVC1G06 chips and clock both chips from this?

  • 1
    It is always a good idea to provide documentation for the devices in question. Dec 23, 2014 at 0:37
  • All the documentation I have is in Chinese so not really helpful here. And the only interesting thing here is that it have the standard crystal across inverter clock circuitry. Dec 23, 2014 at 1:04

2 Answers 2


Sharing a crystal between multiple devices is a very bad idea. The crystal is only a piece of the oscillator, the rest of it being a small bit of circuitry within the IC itself. Having multiple ICs connected to the same crystal will cause them to fight over who is driving it.

The datasheet for the CH340T/R, which I was able to find in English, says the following:

When CH340 chip is working normally, the outside must supply 12MHz clock signal to XI pin.

This seems to imply that you can feed an external 12MHz clock into the chip and it will work. So we take the clock from the '328P and pass it to the '340G.

Programming the CKOUT fuse on the '328P will cause the internal clock to be output on CLKO, which we then connect to XI of the '340G. This means that that you will lose PB0/D8, but no longer need a second crystal. This also means that you will be unable to use the prescaler since doing so will affect the clock output.

  • I am saying that I connect the crystal to '340G and tap off its XO pin to '328P. Dec 23, 2014 at 10:15
  • Unlike clkout, crystal out is not meant to drive external loads - if it works or not depends on inplementation detail of the oscillators. If you insist on trying, consider loose coupling via a large resistor or small capacitor. Do you have timing needs which actually require a crystal? What about a 32u4 instead of an m328p plus distinct USB? Dec 23, 2014 at 14:47
  • Or even living with the 8MHz from the internal oscillator. Dec 23, 2014 at 18:05

Often is is possible. The range of the crystals signals' max swing are small. Where the XI pin needs to accept these small AC signal. Hence on the FUSE on the ATmega. Which also enables the XO as a Hard clamp to excite the crystal. The crystal dominates the voltage making it small. Additionally, it is important to have the proper parallel capacitance on both the input and output of the crystal. When the XO(0) is tied to the XI(1) along with the crystal and its parallel capacitor, noting that it is in the range of 10-40pf, the total parallel capacitance will be significantly increased. Where it may be possible to reduce the XO(0)'s parallel capacitor, if XI(1) does not add too much.

Anyone attempting this should really inspect the signal on an Oscilloscope to ensure the nature of the wave form is stable and stress its tolerances. Likely by changing the parallel capacitors to find the min and max's before failure. And varying VCC of both chips across is allowed ranges. As to determine the ranges is not unacceptable.

That said the datasheets refer to a version with a suffix T that have an CKO or Clock output on pin 1. That would be best and change the ATmega's FUSE for TTL input. Where Ignacio's answer is very valid and stable. Just the opposite direction.

I would point out that you will have the issue that 12MgHz is not a typically supported F_CPU speed in the code. I have toy'ed with changing the speed in the past, as to do just what you are attempting here, but with a different clock source. And found it requiring so many changes to the Arduino libraries, which are typically #IF'ed to either 8 or 16 so many places not using a nice formula, it was not worth its cost savings versus cost in maintenance. As a starter you may want to refer to SE: "Arduino at 11.0592MHz".

Your Answer

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

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