In electronics, timing and frequency are the heartbeat of every system. From microcontrollers to communication radios, almost every device relies on a stable and precise clock signal. One of the key components that help generate and control these signals is the Voltage Controlled Oscillator (VCO).
In this blog post, I will explain the working principle, applications, and significance of VCOs, particularly in the context of Phase-Locked Loops (PLLs). I decided to write this post while exploring the clock tree of STM32 microcontrollers, as understanding VCOs is essential to grasp how PLLs provide flexible and high-performance system clocks.
Before diving into Voltage Controlled Oscillators (VCOs), it’s important to first understand what an oscillator is. Grasping this concept will make it much easier to understand how a VCO works and why it is critical in systems like PLLs.
What is an Oscillator?
An oscillator is an electronic circuit that generates a continuous, repeating signal (usually a sine wave, square wave, or triangular wave) without any external input. It converts DC power into an AC signal of a particular frequency and amplitude.
Simply put, an oscillator keeps the signal alive — it doesn’t fade like a capacitor charge or pulse; it continuously repeats.
Oscillators are the foundation of almost all electronic timing systems. For example:
- In microcontrollers, oscillators provide the clock signal that drives the CPU and peripherals.
- In communication systems, they generate carrier frequencies for radios, Wi-Fi, and mobile networks.
- In audio electronics, oscillators produce tones, sound signals, or musical notes.
Simply put, an oscillator keeps a signal alive. Unlike a capacitor’s charge or a one-time pulse that fades away, it continuously produces a repeating waveform, providing a steady rhythm that other circuits can lock onto and synchronize with.
Common Types of Oscillators
RC Oscillator:
- Uses resistors and capacitors. Suitable for low-frequency applications. Example: generating clock for simple microcontrollers.
LC Oscillator:
- Uses an inductor (L) and capacitor (C) to set the frequency. Ideal for RF applications.
Crystal Oscillator:
- Uses a quartz crystal to produce very stable and precise frequencies.
Common in microcontrollers and processors.
Ring Oscillator:
- Built using digital inverters. Often used in integrated circuits like PLLs.
Now, let’s get back to the main topic: the Voltage-Controlled Oscillator (VCO).
What is a Voltage-Controlled Oscillator (VCO)?
A Voltage-Controlled Oscillator (VCO) is an oscillator whose output frequency can be adjusted by an input voltage, making it highly versatile for applications such as phase-locked loops (PLLs) and other frequency-control systems.
That means:
➡️ Increase the control voltage → Frequency increases
➡️ Decrease the control voltage → Frequency decreases
It’s just like tuning a radio: when you turn the knob (change voltage), the signal frequency changes.
📡 VCO Frequency Calculation:
The output frequency of a Voltage-Controlled Oscillator (VCO) is given by:
𝑓out = 𝑓center+𝐾𝑣⋅(𝑉control−𝑉center)
Where,
- 𝑓out = Output frequency
- 𝑓center = Center (nominal) frequency at midpoint voltage
- 𝑉control = Applied control voltage
- 𝑉center = Midpoint/control voltage for center frequency
- 𝐾𝑣 = VCO gain (Hz per volt)
Example Calculation:
- VCO range: 80–120 MHz
- Control voltage range: 1–5 V
- Center voltage 𝑉center : 3 V
- Center frequency 𝑓center : 100 MHz
- VCO gain 𝐾𝑣: 10 MHz/V
At 𝑉control = 4V
𝑓out= 100MHz+10MHz/V⋅(4V−3V) = 110MHz
Why an Input (Reference) Frequency is Needed
- A reference frequency provides a stable target for the VCO.
- In a Phase-Locked Loop (PLL):
-
- Reference input (𝑓𝑟𝑒f) is compared with VCO output.
- Phase/Frequency Detector generates an error signal.
- Loop Filter converts the error into control voltage.
- VCO adjusts frequency until it matches the reference.
Without a reference, the VCO frequency is unpredictable.
How Does a VCO Work?
A Voltage-Controlled Oscillator (VCO) changes its output frequency based on the input voltage. In simple terms, when the input voltage increases or decreases, the VCO’s internal components (like resistors, capacitors, or inductors) adjust the timing of oscillations — making the signal oscillate faster or slower.
For example:
- In an RC or relaxation VCO, the capacitor charges and discharges faster or slower depending on voltage.
- In an LC VCO, a varactor diode changes its capacitance with voltage, changing the resonant frequency.
- In digital (ring) VCOs, transistor delay varies with voltage, controlling frequency.
This simple concept allows automatic frequency control in systems like PLLs (Phase-Locked Loops) — which generate stable clocks in microcontrollers, processors, and RF systems.
Here’s an excellent video that explains the concept of a Voltage-Controlled Oscillator (VCO) in a clear and practical way.
Understanding STM32 VCO/PLL Configuration in Detail
In STM32 microcontrollers (like STM32H5), the VCO is a key part of the PLL that multiplies an input clock source to generate higher system or peripheral clocks.
To configure it safely, we need to understand three main parameters:
- PLL Input Source
- VCO Input Range
- VCO Output Range
Let’s go through each one with your example.
1. Selecting the PLL Source:
LL_RCC_PLL1_SetSource(LL_RCC_PLL1SOURCE_HSI);
Purpose: This line chooses which clock feeds the PLL.
Options:
- HSI → High-Speed Internal oscillator (typically 64 MHz for STM32H5)
- HSE → High-Speed External crystal oscillator
- CSI → Internal 4 MHz clock for low-power applications
Why it matters: The input frequency affects the VCO input and output, and therefore the final system clock. Choosing the wrong source can make the PLL fail to lock.
Tip: Always check the MCU datasheet for allowed input sources for PLL1.
2.Configuring the VCO Input Range:
LL_RCC_PLL1_SetVCOInputRange(LL_RCC_PLLINPUTRANGE_8_16);
Purpose: Defines the frequency range of the input signal that the VCO expects.
Meaning of 8_16: The VCO input frequency must be between 8 MHz and 16 MHz.
Why it matters:
- If the PLL input (after divider) is outside this range, the VCO may not operate correctly, causing the PLL not to lock.
- Ensures safe and stable operation.
Analogy: Think of this as telling the VCO, “I will only feed you this voltage/frequency range; stay stable here.”
3. Configuring the VCO Output Range:
LL_RCC_PLL1_SetVCOOutputRange(LL_RCC_PLLVCORANGE_MEDIUM); // 400 MHz is within range
Purpose: Defines the maximum output frequency the VCO can generate safely.
Ranges: STM32H5 supports LOW, MEDIUM, and HIGH.
- MEDIUM → Supports frequencies around 400 MHz, perfect for system clocks.
Why it matters:
- Prevents the VCO from being overdriven.
- Ensures that the output frequency is stable, accurate, and safe for the MCU.
Tip: Always ensure that your desired system clock (SYSCLK) is within the VCO’s output range.
Key Applications of VCOs:
VCOs are used almost everywhere in electronics where frequency needs to be tuned or controlled:
Phase-Locked Loops (PLLs):
- Used in microcontrollers (like STM32H5 PLL1/PLL2) for generating high-speed clocks.
- Provides precise frequency multiplication and phase alignment.
RF Communication:
- Acts as a local oscillator in transmitters and receivers.
- Essential in frequency modulation (FM) and demodulation.
Clock Generation:
- Used to generate adjustable clock signals in SoCs, processors, and digital circuits.
- Test and Measurement Equipment
- Used in signal generators for producing variable test frequencies.
Sensors and Control Systems:
- Used in Voltage-to-Frequency Converters (VFCs) for feedback control.
Advantages of Using a VCO:
- Wide range of frequency tuning.
- Fast response to control voltage changes.
- Compact and easy to integrate in ICs.
- Works in both analog and digital environments.
Common Pitfalls and Design Challenges
Even though VCOs are powerful, they come with challenges that every engineer must handle carefully.
1. Phase Noise and Jitter
A VCO output is never perfectly stable. Small variations in timing cause phase noise (in RF) or jitter (in digital systems).
Solution: Use clean power, low-noise biasing, and proper grounding.
2. Control Voltage Noise
Noise on the control line directly affects frequency, causing unwanted modulation.
Solution: Use RC filters, shielding, and separation from digital switching lines.
3. Temperature Drift
Frequency changes with temperature due to variations in capacitance and inductance.
Solution: Use temperature-compensated components or periodic software calibration.
4. Nonlinear Tuning
The frequency vs voltage curve is often not straight.
Solution: Apply software correction or use a lookup table.
5. Power Supply Sensitivity
Power noise can cause frequency shifts.
Solution: Use low-dropout regulators (LDOs) and separate analog/digital supply rails.