Also see: Microcontroller Clock Support Solutions
The majority of clock sources for microcontrollers can be grouped into two types: those based on mechanical resonant devices, such as crystals and ceramic resonators, and those based on electrical phase-shift circuits such as RC (resistor, capacitor) oscillators. Silicon oscillators are typically a fully integrated version of the RC oscillator with the added benefits of current sources, matched resistors and capacitors, and temperature-compensation circuits for increased stability. Two examples of clock sources are illustrated in Figure 1
. Figure 1a shows a Pierce oscillator configuration suitable for use with mechanical resonant devices like crystals and ceramic resonators, while Figure 1b shows a simple RC feedback oscillator.
Figure 1. Examples of a simple clock source: (a) a Pierce oscillator configuration and (b) an RC feedback oscillator.
Primary Differences Between Mechanical Resonators and RC Oscillators
Crystal and ceramic resonator-based oscillators (mechanical) typically provide very high initial accuracy and a moderately low temperature coefficient. RC oscillators, in contrast, provide fast startup and low cost, but generally suffer from poor accuracy over temperature and supply voltage, and show variations from 5% to 50% of nominal output frequency. While the circuits illustrated in Figure 1 can produce clean reliable clock signals, their performance will be heavily influenced by environmental conditions, circuit component choice, and the layout of the oscillator circuit. Ceramic resonators and their associated load capacitance values must be optimized for operation with particular logic families. Crystals, with their higher Q, are not as sensitive to amplifier selection but are susceptible to frequency shifts (and even damage) when overdriven. Environmental factors like electromagnetic interference (EMI), mechanical vibration and shock, humidity, and temperature affect oscillator operation. These environmental factors can cause output frequency changes, increased jitter, and in severe cases, can cause the oscillator to stop functioning.
Many of the considerations described above can be avoided through use of oscillator modules. These modules contain all oscillator circuit components and provide a clock signal as a low-impedance square-wave output. Operation is guaranteed over a range of conditions. Crystal oscillator modules and fully integrated silicon oscillators are most common. Crystal oscillator modules provide accuracy similar to discrete component circuits using crystals. Silicon oscillators are more precise than discrete component RC oscillator circuits, and many provide comparable accuracy to ceramic resonator-based oscillators.
Power consumption is another important consideration of oscillator selection. The power consumption of discrete component crystal-oscillator circuits is primarily determined by the feedback-amplifier supply current and by the in-circuit capacitance values used. The power consumption of amplifiers fabricated in CMOS is largely proportional to the operating frequency and can be expressed as a power-dissipation capacitance value. The power-dissipation capacitance value of an HC04 inverter gate used as an inverting amplifier, for example, is typically 90pF. For operation at 4MHz from a 5V supply, this equates to a supply current of 1.8mA. The discrete component crystal oscillator circuit will typically include an additional load capacitance value of 20pF, and the total supply current becomes 2.2mA.
Ceramic resonator circuits typically specify larger load capacitance values than crystal circuits, and draw still more current than the crystal circuit using the same amplifier.
By comparison, crystal oscillator modules typically draw between 10mA and 60mA of supply current because of the temperature compensation and control functions included.
The supply current for silicon oscillators depends on type and function, and can range from a few micro-amps for low-frequency (fixed) devices to tens of milli-amps for programmable-frequency parts. A low-power silicon oscillator, such as the MAX7375
, draws less than 2mA when operating at 4MHz.
The optimal clock source for a particular microcontroller application is determined by a combination of factors including accuracy, cost, power consumption, and environmental requirements. The following table summarizes the common oscillator circuit types discussed here, together with their strengths and weaknesses.
Table 1. Performance Comparison of Clock Source Types
||Medium to high
||Sensitive to EMI, vibration, and humidity. Complex circuit impedance matching.
|Crystal Oscillator Module
||Medium to high
||Insensitive to EMI and humidity. No additional components or matching issues.
||High cost; high power consumption; sensitive to vibration; large packaging.
||Sensitive to EMI, vibration, and humidity.
|Integrated Silicon Oscillator
||Low to medium
||Insensitive to EMI, vibration, and humidity. Fast startup, small size, and no additional components or matching issues.
||Temperature sensitivity is generally worse than crystal and ceramic resonator types; high supply current with some types.
||Usually sensitive to EMI and humidity. Poor temperature and supply-voltage rejection performance.