In microcontrollers, clock signals can be generated using either mechanical resonant devices or electrical phase shift circuits.
The inaccuracy and noise levels make internal phase shift oscillators unsuitable for applications requiring precise timing over a wide temperature range.
Crystal oscillators are preferred due to advantages such as accuracy, compactness, low cost, low power consumption, and high-frequency generation.
Microcontrollers and microprocessors depend on oscillators for basic timing and control. Oscillators are responsible for supplying the clock signals in microcontrollers. All the instructions executed by microcontrollers are in synchronization with clock signals. The timing for different operations in a microcontroller is assigned with the help of oscillators.
Usually, crystal oscillators are preferred in microcontrollers due to advantages such as accuracy, compactness, low cost, low power consumption, and high-frequency generation. A crystal oscillator is good at providing stable output for a long duration and is popular for its stability and durability. Let’s take a look at the types of oscillators and what makes crystal oscillators such a good choice.
Types of Oscillators in Microcontrollers
Oscillators generate the heartbeat of every microcontroller and produce clock signals that are essential for synchronizing internal operations. In microcontrollers, the clock signals can be generated using either mechanical resonant devices or electrical phase shift circuits.
Mechanical resonant devices include crystals and ceramic resonators. Mechanical resonator-based oscillators are well-known for their accuracy. As they offer a low-temperature co-efficient, they are suitable for applications where precise timing over a wide temperature range is required.
Electrical phase shift-based oscillator circuits include RC and LC oscillators. These oscillators are low-cost clock generators with a fast start-up. However, they lack accuracy with variations in temperature and supply voltage. The variations are observed in the range of 5% to 50% of the nominal output frequency.
We will get more familiar with a few of the oscillators used in microcontrollers in the upcoming section.
Common Clock Generation Sources in Microcontrollers
As we have seen, clock generation sources can be based on piezoelectric materials or electrical phase shift circuits. Some of the oscillator options for generating clock signals for microcontrollers are:
- External RC circuit - The charging or discharging rate of the resistor-capacitor circuit can be used as the clock input.
- Internal RC circuit - The internal RC oscillator circuit in microcontrollers generates clock signals. However, the accuracy is very much compromised in such systems.
- External clock - A powered clock driver can be used for providing clock signals, especially when multiple devices are connected and operating at the same frequency.
- External resonator - External resonators are mechanical resonators that use piezoelectric ceramics to function as reference signal generators.
- External oscillator - The external oscillator is recognized as the standard clock generator for microcontrollers. The external oscillator requires a piezoelectric crystal such as quartz for generating clock signals. The crystal is connected to the oscillator pins of the microcontroller IC. All other parts necessary for the oscillator circuit are built in the chip.
Internal oscillators such as RC and LC circuits have limitations in frequency generation, and it is impossible to achieve higher frequencies with such clock generators. The accuracy of the clock signals from such internal oscillators is compromised and they are jittery and noisy. The inaccuracy and noise levels make them unsuitable for applications requiring precise timing over a wide temperature range.
Crystal Oscillators in Microcontrollers
For such precise applications, crystal oscillators are preferred due to their advantages such as accuracy, compactness, low cost, low power consumption, and high-frequency generation. Crystal oscillators use piezoelectric crystals such as quartz, Rochelle salt, or tourmaline for generating oscillations. The fundamental working principle is the inverse piezoelectric effect in which the alternating voltage applied on the surface of the crystal creates vibrations in it. The vibrations occur at the natural frequency of the crystal and eventually get converted into oscillations.
In most microcontrollers, a standard oscillatory circuit consists of two parts :
- An inverting amplifier with a voltage gain - This is the active part of the oscillator circuit, which is on-chip in most microcontrollers.
- A frequency selective feedback path - The frequency-selective feedback path is formed by the quartz crystal, capacitors, and resistors. The feedback path is the external circuitry part of the oscillator system of the microcontroller.
The crystal used in microcontroller oscillator circuits is commonly quartz due to its good quality factor, stability, small size, low cost, and easy availability. The quartz crystal offers the reference frequency, which is utilized by the on-chip system to provide system frequency. The quartz crystal combined with two capacitors forms the tuned proportional-integral network, which offers a 180° phase shift feedback path. In addition, capacitors in the external circuitry provide some damping effect and thus stabilize the frequency. A series resistor is present in the external oscillator circuitry to limit the current flowing through the crystal. The selection of the series resistor depends on the piezoelectric crystal used and the required resonance frequency.
When designing crystal oscillators, access to simulation tools can help you gain a better understanding of what is happening internally. Cadence’s PCB design and analysis software offers circuit design tools with simulation features. Leading electronics providers rely on Cadence products to optimize power, space, and energy needs for a wide variety of market applications. If you’re looking to learn more about our innovative solutions, talk to our team of experts or subscribe to our YouTube channel.