C0: represents the shunt capacitance resulting from the capacitor formed by the electrodes
Lm: (motional inductance) represents the vibrating mass of the crystal
Cm: (motional capacitance) represents the elasticity of the crystal
Rm: (motional resistance) represents the circuit losses

The impedance of the crystal is given by the following equation (assuming that Rm is negligible):

FS is the series resonant frequency when the impedance Z = 0:

This equation gives resonance frequency when Lm = 1/(ω Cm)

Fa is the anti-resonant frequency when impedance Z tends to infinity. Using equation (1), it is expressed as follows:

Oscillation frequency of the crystal

To oscillate, the following Barkhausen conditions must be fulfilled. The closed-loop gain should be greater than 1 and the total phase shift of 360o is to be provided:

Pierce oscillator

Inv: the internal inverter that works as an amplifier
Q: crystal quartz or a ceramic resonator
RF: internal feedback resistor
RExt: external resistor to limit the inverter output current
CL1 and CL2: are the two external load capacitors
Cs: stray capacitance is the addition of the MCU pin capacitance (OSC_IN and OSC_OUT)
and the PCB capacitance: it is a parasitical capacitance.

#### Step1: Calculate the gain margin

Choose a crystal and go to the references
If CL1 and CL2 are known compute CL:

#### Estimate PCB Trace Stray Capacitance

Input Values. Enter the Given:

#### Result:

The CL value is specified by the crystal manufacturer:

Enter Oscillator Data:

#### Gain margin of the oscillator

gm is the transconductance of the inverter (in mA/V for the high-frequency part or in μA/V for the low-frequency part: 32 kHz). gmcrit (gm critical) depends on the crystal parameters.
Assuming that CL1 = CL2, and assuming that the crystal sees the same CL on its pads

According to the Eric Vittoz theory: the impedance of the motional RLC equivalent circuit of a crystal is compensated by the impedance of the amplifier and the two external capacitances.
To satisfy this theory, the inverter transconductance (gm) must have a value gm > gmcrit. In this case, the oscillation condition is reached. A gain margin of 5 can be considered as a minimum to ensure an efficient startup of oscillations.

Enter Crystal Data:

MCU data