Monday, 21 October 2013

Using crystals in embedded applications - Part 1

Generally, for most of embedded applications we tend to use external crystal. Whether it be processor, micro controller, FPGA, SoC clock source is must. The other frequencies required as per interface (like USB, PCIe, SPI, I2C, etc) are derived from the internal PLL of the controllers. Crystal to be used in a application has some load capacitance which need to be achieved using external crystals also taking parasitic capacitance into consideration.

Along with these load capacitors you might have observed resistors used in two ways:
  • Resistor in parallel to crystal
  • Resistor in series with XTALIN pin

Generally, we follow the processor or crystal datasheet and go ahead using these resistors. These datasheets generally give the values for these resistors to be used and we will be least bothered to know about the purpose of those. Before going to know the purpose of those resistors let us see the types of crystals used in applications:
  • Series resonant crystals
  • Parallel resonant crystals

The oscillator configuration inside processor or a controller  is a pierce oscillator type and we add an external crystal. For a series resonator type there are no reactive components in the feedback where as in a parallel resonator type we have reactive components in feedback. the only difference is that parallel resonant crystal is fixed to oscillate at a specific frequency for a given load capacitance.

But why do we use resistors?

As mentioned, a pierce oscillator is inside a controller. A pierce oscillator is formed by a TTL or CMOS device. The important thing to remember here is that this device (which is inverter) inside the processor or controller must be biased properly to start oscillation or to maintain oscillations.  

parallel resistor helps for DC biasing to keep the inverter in active region. The value preferred is in Kilo ohm to Mega ohm.The only problem with this resistor is that it spoils the 'Q' of crystal. Generally, in micro controllers, this resistor is inside. Check out the micro controller datasheet to know whether to include this resistor outside or if it is already present. If resistor is large, feedback will be less and oscillator tend to be slow.

A series resistor  helps to prevent overdrive of crystal and helps to increase the life time of crystal (aging of crystal). The value of resistor used is less than <500 ohm. The main disadvantage is power consumption and it reduces the gain margin of the circuit.

How does load capacitance effect oscillator?

We have to keep in mind that load capacitance is formed by external capacitors and parasitic capacitance. The sum of these capacitance must match load capacitance of crystal. If load capacitance is less than the desired value, oscillator runs fast. If load capacitance is higher than the desired value, oscillator runs slow.

No comments:

Post a Comment