Hello

Welcome lekule blog

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation.
together in the world. #lekule86
Join us on

Choosing the Right Oscillator for Your Microcontroller

Internal or external? Quartz or ceramic? Crystal oscillator or silicon oscillator? So many clocking options . . . which one is right for your design?

Oscillating Options

Every microcontroller needs a clock source. The CPU, the memory bus, the peripherals—clock signals are everywhere inside a microcontroller. They govern the speed at which the processor executes instructions, the baud rate of serial-communication signals, the amount of time needed to perform an analog-to-digital conversion, and so much more.
All of this clocking action goes back to the source of the clock signal, namely the oscillator. Therefore, you need to make sure that your oscillator can support whatever performance you expect from your microcontroller. At the same time, though, some oscillator options are more complex or expensive than others, so your choice of oscillator should also reflect the importance of reducing cost and complexity whenever possible.
There are quite a few ways to generate a clock signal for a microcontroller. The datasheet for your particular device should provide a good deal of information about what types of oscillators you can use and how to implement them in a way that is compatible with the device’s hardware. This article will focus on the advantages and disadvantages of various clock sources so that you can better choose among the oscillator options discussed in your microcontroller’s datasheet.
So let’s start with a list, followed by a discussion of each option:
  • Internal
    • Usually (as far as I know, always) a resistor–capacitor circuit
    • Phase-locked loop for frequency multiplication
  • External
    • CMOS clock
    • Crystal
    • Ceramic resonator
    • Resistor–capacitor
    • Capacitor only

Internal Oscillators: The KIS Option

I’m an advocate of the Keep It Simple principle; consequently, I have a special appreciation for internal oscillators, and I encourage you to avail yourself of the internal oscillator whenever possible. No external components are required: You can safely assume that the frequency is well chosen since the oscillator was designed by the same people who designed the rest of the microcontroller. Also, the salient performance specs—e.g., initial accuracy, duty cycle, temperature dependency—are (hopefully) right there in the datasheet.
The dominant disadvantage with internal oscillators is the lack of precision and frequency stability. The baseline frequency depends on the values of the passive components that make up the oscillator circuit, and the tolerances for the values of these passive components are not particularly tight. Furthermore, capacitance and resistance are influenced by ambient temperature, so internal RC oscillators experience temperature “drift”—i.e., changes in temperature lead to changes in frequency.
In my experience, many applications can tolerate the shortcomings of an internal oscillator, especially when the frequency has been calibrated at the factory. With older microcontrollers, the internal oscillator might have tolerance as bad as ±20%. However, a newer device can give you ±1.5% (or better), which is accurate enough for RS-232 communication and even (in conjunction with clock-recovery circuitry) for USB.
Another way to expand the capabilities of an internal oscillator is manual “trimming”—if your microcontroller includes a trimming/calibration register, you can adjust the frequency by modifying the value in this register. This is a perfectly practical technique for low-quantity designs: Simply measure the clock frequency with an oscilloscope or frequency counter and then trim the oscillator accordingly.
A variation on the internal-oscillator theme is the phase-locked loop (PLL). A PLL allows a low-quality, high-speed internal oscillator to benefit from the stability and precision of an external oscillator. In general, a PLL doesn’t help you to avoid external components because it requires a reference clock that is usually derived from a crystal. An exception, though, is when you have a high-quality clock somewhere on the PCB but don’t want to use it for the microcontroller because it’s too slow—you could use a PLL to multiply this clock up to an acceptable frequency.

CMOS Clock

Another straightforward clocking option is the so-called “CMOS clock,” which falls into the for-lack-of-a-better-term category. “CMOS clock” is a vague (though convenient) way of referring to any clock signal driven by some other component on the board. The CMOS clock is a great option if your design already includes a clock signal with 1) a workable frequency and 2) electrical characteristics that are compatible with the microcontroller’s CMOS-clock-input circuitry. Often, though, this is not the case, so let’s look at two options for generating a CMOS clock.
First is the “crystal oscillator.” This is a good time to point out that a quartz crystal is not an oscillator; rather, a quartz crystal is the central component in a quartz-crystal oscillator circuit, which might look something like this:



Crystal oscillators are handy devices that consist of a quartz crystal and the additional circuitry needed to generate a standard digital clock signal. Thus, you get the stability and precision of a crystal without worrying about load capacitance and the careful PCB layout needed to ensure robust operation with a standalone crystal.

The second option is a “silicon oscillator”. This term refers to oscillator ICs that are not based on quartz crystals or ceramic resonators. These devices are versatile and easy to use, and they can be quite accurate. For example, the LTC6930 series from Linear Tech requires only one bypass capacitor, and the vast majority of the parts are within .05% of the nominal frequency:





Silicon oscillators are more reliable than crystals and ceramic resonators, especially in harsh environments subject to shock or vibration. But they’re also more expensive.

Quartz and Ceramic

When you need seriously high precision and stability without the additional cost of a crystal-based oscillator IC, opt for the standalone-crystal approach. Parts with tolerance below 20 parts per million (i.e., 0.002%) are readily available. The oscillator circuit shown above is partially integrated into microcontrollers that support the standalone-crystal configuration; you will need to provide the correct load capacitors. The total load capacitance (CLTOTAL) is specified in the crystal’s datasheet, and the load capacitors are chosen as follows:



where CP represents whatever parasitic capacitance is present. This calculation is pretty simple in practice: Choose a reasonable value for CP (say, 5 pF), subtract this from CLTOTAL, then multiply by two. So if the datasheet gives a load capacitance of 18 pF, we have



Ceramic resonators are less accurate than crystals; common tolerances are 1000 to 5000 parts per million. They may save you a few cents if you don’t need the accuracy of quartz, but in my mind, the main advantage is that you can get ceramic resonators with integrated load capacitors.

Last, and Least . . .

There aren’t many situations that call for an external resistor–capacitor or capacitor-only oscillator. If for some reason you are opposed to the external-oscillator options discussed thus far, choose a microcontroller with an internal oscillator and use that. If, however, you are determined to dig out a passive or two from your box of spare parts, refer to the microcontroller’s datasheet for guidance on how to connect and design the oscillator circuit. Here is an example of how to connect the components, taken from the datasheet for the C8051F12x–13x (PDF) microcontrollers from Silicon Labs:



And you can refer to page 190 (PDF) of this same datasheet for an example of information on choosing component values.

Conclusion

I hope you now know enough to make an informed, confident decision next time you need to choose an oscillator for your microcontroller. Here are my recommendations in a nutshell:
  • Internal oscillator whenever possible
  • Silicon oscillator if the accuracy is adequate and the cost is acceptable—otherwise, quartz crystal

Share this:

ABOUTME

Hi all. This is deepak from Bthemez. We're providing content for Bold site and we’ve been in internet, social media and affiliate for too long time and its my profession. We are web designer & developer living India! What can I say, we are the best..

Post a Comment
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Labels

LEKULE TV EDITORIALS ARTICLES DC ROBOTICS DIGITAL SEMICONDUCTORS GENERATOR AC EXPERIMENTS MANUFACTURING-ENGINEERING REFERENCE FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT TRANSDUCER & SENSOR VIDEO ARDUINO RENEWABLE ENERGY AUTOMOBILE TEARDOWN SYNCHRONOUS GENERATOR DIGITAL ELECTRONICS ELECTRICAL DISTRIBUTION CABLES AUTOMOTIVE MICROCONTROLLER SOLAR PROTECTION DIODE AND CIRCUITS BASIC ELECTRICAL ELECTRONICS MOTOR SWITCHES CIRCUIT BREAKERS CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES WEARABLES CAMERA TECHNOLOGY COMMUNICATION GENERATION BATTERIES FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE CONTROL SYSTEM NUCLEAR ENERGY SMATRPHONE FILTER`S POWER BIOGAS BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS ENERGY SOURCE PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR 555 TIMER CIRCUITS AUTOCAD BLUETOOTH C PROGRAMMING HOME AUTOMATION HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY COMPUTER DEFECE & MILITARY FLUORESCENT LAMP INDUSTRIAL ROBOTICS ANDROID ELECTRICAL DRIVES GROUNDING SYSTEM CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS USB ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS CONTROL MOTION ELECTRICAL LAWS INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES APPS & SOFTWARE BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RECTIFIER AND CONVERTERS RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS DC MOTOR DRIVES ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS WIRELESS BUILDING SERVICES COMPRESSOR CRANES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION INDUSTRIAL DRIVES LAPTOP SCIENCE THERMOCOUPLE TRIGONOMENTRY REFERENCE UART oscilloscope BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING ELECTROMECHANICAL FEATURED FILTER DESIGN HARDWARE JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER VALVE COLOR CODES ELECTRIC TRACTION FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF