Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Which type of oscillator do I use for my circuit?

Status
Not open for further replies.

Sashvat

Member
Hello guys, I went through the STM32F103C8T6 data sheet and was unable to understand the high speed external clock. My question is, the data sheet has specified to use a Crystal oscillator and it has also specified loading capacitors, in some schematics (the blue pill for example) have capacitors around the crystal oscillators.

But in the data sheet they show a circle saying "resonator with integrated capacitors". I have selected a crystal oscillator- https://www.mouser.in/ProductDetail/IQD/LFXTAL055440Reel?qs=sGAEpiMZZMsBj6bBr9Q9aR/uGiDjvlIS0LM5x/vaaa189H1ra5sGew== -this is the one. So when I connect this to the microcontroller do I have to add the capacitors, or do I just connect it directly with this oscillator?

And also, how do I calculate the load capacitance? They also have specified the Pin and PCB capacitance, is it in series or parallel with the calculated loading capacitor values CL1 and CL2?

Thank you
 
Last edited:
You're confusing yourself - you call it an 'oscillator' when it's just a bare crystal, so you will need capacitors. The capacitors go from either end of the crystal to ground, in my experience it's not at all critical, and I simply chuck a couple of small capacitors that I already have in stock there - something like 10pF or 15pF.
 
It is often easier to use an oscillator (not a crystal) and connect the output of that to the "osc in" connection on the microcontroller. Leave the "osc out" connection open, or it may be possible to configure the microcontroller to use that for something else.

The oscillator will have a power and ground connection, which should be decoupled like any IC, and that's all you have to think about.

If you do use a crystal, its "load capacitance" isn't like anything else that would be called a load capacitance. Crystals are mechanical resonators, and they can be considered to be a series tuned circuit of a huge inductance and a tiny capacitor, typically measured in femtofarads. At resonance, the crystal has its lowest impedance. At a slightly higher frequency, the crystal will be inductive, and at a lower frequency it will be capacitive.

It's often easiest to make an oscillator circuit with capacitors, as they are cheaper and have lower losses than inductors, so it is convenient to run the crystal slightly above it's resonant frequency, so that it is inductive, and that is balanced by the capacitance of the oscillator circuit. Because of this, crystals are adjusted to be at their marked frequency when in series with a capacitor whose value is the load capacitance.

For instance, if you buy a 10 MHz crystal with a 30 pF load, the crystal will have its lowest impedance at less than 10 MHz, probably around 9.99 MHz (but that will vary a lot, even within one batch of crystals). The series combination of the crystal and a 30 pF capacitor will have its lowest impedance at 10 MHz, give or take the adjustment tolerance which might be +/- 10 ppm or 100 Hz.

If you do use the wrong load capacitance, the frequency will be wrong, but often not by a lot.

You also then get into making sure that the oscillator starts OK, and is not affected too badly by external influences. Changing the capacitance to get the frequency correct can result in the oscillator not starting.

Or buy a packaged oscillator.

Here is an oscillator from Mouser:-
https://www.mouser.co.uk/ProductDet...6bBr9Q9aZiWbAMN9VKZUxkawuN%2BEp6/M53T38lyag==

The maximum output load of 15 pF in the datasheet for that is the same idea as the maximum load capacitance for any logic output. The output voltage levels and rise and fall times are quoted up to that capacitance. You don't need to add any capacitance, as the value is a maximum.
 
Last edited:
It is often easier to use an oscillator (not a crystal) and connect the output of that to the "osc in" connection on the microcontroller. Leave the "osc out" connection open, or it may be possible to configure the microcontroller to use that for something else.

The oscillator will have a power and ground connection, which should be decoupled like any IC, and that's all you have to think about.

If you do use a crystal, its "load capacitance" isn't like anything else that would be called a load capacitance. Crystals are mechanical resonators, and they can be considered to be a series tuned circuit of a huge inductance and a tiny capacitor, typically measured in femtofarads. At resonance, the crystal has its lowest impedance. At a slightly higher frequency, the crystal will be inductive, and at a lower frequency it will be capacitive.

It's often easiest to make an oscillator circuit with capacitors, as they are cheaper and have lower losses than inductors, so it is convenient to run the crystal slightly above it's resonant frequency, so that it is inductive, and that is balanced by the capacitance of the oscillator circuit. Because of this, crystals are adjusted to be at their marked frequency when in series with a capacitor whose value is the load capacitance.

For instance, if you buy a 10 MHz crystal with a 30 pF load, the crystal will have its lowest impedance at less than 10 MHz, probably around 9.99 MHz (but that will vary a lot, even within one batch of crystals). The series combination of the crystal and a 30 pF capacitor will have its lowest impedance at 10 MHz, give or take the adjustment tolerance which might be +/- 10 ppm or 100 Hz.

If you do use the wrong load capacitance, the frequency will be wrong, but often not by a lot.

You also then get into making sure that the oscillator starts OK, and is not affected too badly by external influences. Changing the capacitance to get the frequency correct can result in the oscillator not starting.

Or buy a packaged oscillator.

Here is an oscillator from Mouser:-
https://www.mouser.co.uk/ProductDetail/ECS/ECS-5032MV-80-CN-TR?qs=sGAEpiMZZMsBj6bBr9Q9aZiWbAMN9VKZUxkawuN%2BEp6/M53T38lyag==

The maximum output load of 15 pF in the datasheet for that is the same idea as the maximum load capacitance for any logic output. The output voltage levels and rise and fall times are quoted up to that capacitance. You don't need to add any capacitance, as the value is a maximum.

Thank you very much, just a small clarification, so when I use an 'oscillator' I don't need to add capacitors to the circuit I am building as they have capacitors built inside them as a whole package. But when I buy a crystal, the one I specified- https://www.mouser.in/ProductDetail/IQD/LFXTAL055440Reel?qs=sGAEpiMZZMsBj6bBr9Q9aR/uGiDjvlIS0LM5x/vaaa189H1ra5sGew==, then I need to use capacitors as they need to be decoupled from the voltage supply. correct?
 
Thank you very much, just a small clarification, so when I use an 'oscillator' I don't need to add capacitors to the circuit I am building as they have capacitors built inside them as a whole package. But when I buy a crystal, the one I specified- https://www.mouser.in/ProductDetail/IQD/LFXTAL055440Reel?qs=sGAEpiMZZMsBj6bBr9Q9aR/uGiDjvlIS0LM5x/vaaa189H1ra5sGew==, then I need to use capacitors as they need to be decoupled from the voltage supply. correct?

No, an oscillator isn't just a crystal and a couple of capacitors, it's a complete module comprising a crystal, the capacitors, and the electronics to make it oscillate.

The capacitors aren't there for decoupling, there are an essential part of the oscillator circuit, along with the electronics inside the chip.

Instead of all these questions, why not just look up the schematic of the 'blue pill', which clearly shows the exact components required.
 
Thank you very much, just a small clarification, so when I use an 'oscillator' I don't need to add capacitors to the circuit I am building as they have capacitors built inside them as a whole package. But when I buy a crystal, the one I specified- https://www.mouser.in/ProductDetail/IQD/LFXTAL055440Reel?qs=sGAEpiMZZMsBj6bBr9Q9aR/uGiDjvlIS0LM5x/vaaa189H1ra5sGew==, then I need to use capacitors as they need to be decoupled from the voltage supply. correct?
You are correct that an oscillator doesn't need capacitors and that a crystal does. However, the crystals that are needed on a capacitor are not decoupling capacitors. Decoupling capacitors are much larger values, typically 10 nF or more, and the value isn't important and can usually be increased a lot without making a difference. A decoupling capacitor is there to stop any change in voltage. The crystals need load capacitors, typically 50 pF or less, and the circuit performance will change a lot if the value is changed significantly. The load capacitors must be small enough to allow the crystal to oscillate.

An oscillator is a type of integrated circuit, with electronics and a crystal in one package. It has a supply and ground, and many oscillators suggest a decoupling capacitor between ground and supply, close to the oscillator. That is good practice with nearly all integrated circuits that have a supply and ground.

(Somewhat of a cross post with Nigel)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top