Skip to main content

Xtal (Crystal Oscillator)

Embedded Systems Hardware Embedded Systems Hardware Interface Clock
Author
swang
Table of Contents
Basics in Embedded Systems - This article is part of a series.
Part 3: This Article

Working with oscillator circuit the beating of hearts of circuits.

text
A crystal oscillator is an electronic component that uses the mechanical resonance of a vibrating crystal (typically quartz) to produce a precise frequency. This frequency serves as a clock signal that helps regulate the timing in microcontrollers, microprocessors, and other digital systems.

Crystals are popular in embedded systems because they provide a stable and accurate clock signal, allowing devices to perform tasks at consistent intervals.

Equivalent Circuit (Not important for coding)
#

The equivalent circuit is shown as below:

text

Using Laplace transfer, the impedance of this network can be written as: \(Z(s) = \left( \frac{1}{s \cdot C_1} + s \cdot L_1 + R_1 \right) \parallel \left( \frac{1}{s \cdot C_0} \right) \)

Internal vs. External Clock
#

MCUs rely on clock sources for timing, with options typically including internal clocks and external clocks. Many modern MCUs support both, allowing developers to select the best source depending on their application’s needs. The choice between internal and external clocks impacts cost, power consumption, precision, and startup time. Here’s a quick overview of how these factors play into the selection process. Here are some comparisons about these 2 types of clocks.

Factor Internal Clock External Clock
Cost Lower cost, no extra components needed Higher cost, requires crystal and capacitors
Power Lower power consumption Higher power due to crystal driving current
Precision Lower accuracy, prone to drift High precision, stable frequency
Startup Time Fast startup Slower startup (few ms to tens of ms)
Basics in Embedded Systems - This article is part of a series.
Part 3: This Article

Related

ADC and DAC
Embedded Systems Hardware Embedded Systems Hardware Interface Signal
GPIO
Embedded Systems Hardware Embedded Systems Hardware Interface