 # What is the purpose of the 22pF capacitor next to the crystal of the MCU oscillator circuit?

The oscillator circuit is used for the real-time clock RTC. For this oscillator circuit, only 32.768KHZ crystal can be used. The crystal is connected between OSC3 and OSC4, and in order to obtain a stable frequency, two capacitors with external resistors must be added to form the oscillator circuit.

The oscillator circuit is used for the real-time clock RTC. For this oscillator circuit, only 32.768KHZ crystal can be used. The crystal is connected between OSC3 and OSC4, and in order to obtain a stable frequency, two capacitors with external resistors must be added to form the oscillator circuit. The oscillating signal generated by the 32.768KHZ clock crystal oscillator is divided 15 times by the frequency divider in the quartz clock to obtain a 1HZ second signal, that is, the second hand moves once per second, and the frequency divider in the quartz clock can only be divided by 15 times. For crystal oscillators of other frequencies, after 15 divisions, it is not a 1HZ second signal, and the clock is inaccurate. 32.768K=32768=2 to the 15th power, data conversion is more convenient and accurate.

Most MCU enthusiasts do not understand that a capacitor near 22pF should be connected to both sides of the MCU crystal, because this capacitor is sometimes unnecessary. I refer to many books and explain very little. The most mentioned is the stabilization effect, and the load capacitance is not a very in-depth theoretical analysis. The problem is that many hobbyists don’t care about these two capacitors. They think it’s enough to follow the reference design. The same is true for me. It wasn’t until a mobile phone project was lost because of this capacitor that it lost several million. Consider the role of this capacitor. In fact, the real name of the oscillation circuit of the MCU is “three-point capacitor oscillation circuit”, please refer to the picture. The crystal is equivalent to the inductance in the three-point type. C1 and C2 are capacitors. 5404 and R1 implement an NPN transistor. You can compare the three-point capacitor oscillation circuit in the high-frequency book. Next, analyze this circuit.

5404 must need a resistor, otherwise it is in the saturation cut-off region, not the amplification region, R1 is equivalent to the biasing effect of the triode, so that 5404 is in the amplification region, then 5404 is an inverter, which realizes the role of the NPN triode, The NPN transistor is also an inverter when the common emitter is connected.

Next, I will explain the working principle of this three-point oscillator circuit in a simple way. You can also read the book directly. We all know that the condition for a sinusoidal oscillation circuit to oscillate is that the system magnification is greater than 1, which is easy to achieve, and the phase meets 360°. Next, we mainly explain the phase problem: because the 5404 is an inverter, that is to say, a 180° shift is realized. phase, then you need C1, C2 and Y1 to achieve a 180° phase shift. It happens that when C1, C2, and Y1 form a resonance, a 180° phase shift can be achieved. This is the easiest for everyone to use the ground as a reference. , the currents passing through C1 and C2 are the same, and the ground is in the middle of C1 and C2, so the voltages are just opposite, achieving a 180 phase shift. When C1 increases, the amplitude of the C2 end increases, and when C2 decreases, the amplitude also increases.

Sometimes C1 and C2 can vibrate even if they are not soldered. This is not to say that there is no C1 and C2, but it is caused by the distributed capacitance of the chip pins, because the original C1 and C2 do not need to be very large, so this is very important. Next, the influence of these two capacitors on the oscillation stability is analyzed. Because the voltage feedback of 7404 relies on C2, if C2 is too large and the feedback voltage is too low, this is also unstable. If C2 is too small, the feedback voltage is too high, the stored energy is too small, it is easy to be disturbed by the outside world, and it will also affect the outside world by radiation. .

The effect of C1 is the opposite of that of C2. Because when we lay out the board, assuming that the double-sided board is relatively thick, the influence of the distributed capacitance is not very large. If we assume that the high-density multi-layer board is used, the distributed capacitance needs to be considered, especially the oscillator circuit such as VCO. Consider distributed capacitance.

For some projects used in industrial control, it is recommended not to use the crystal method to oscillate. The second is to directly connect an active crystal oscillator. Many times, people will use a 32.768K clock crystal to make the clock, instead of using the single-chip crystal frequency division to make the clock later. , Many people do not understand the reason. In fact, this is related to the stability of the crystal. The higher the frequency of the crystal, the higher the Q value is generally difficult, the frequency stability is not high, and the crystal stability of 32.768K is good in all aspects. It is an industrial standard, and it is easier to make it higher.