Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

lock attach
Attachments are accessible only for community members.
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted


Provided below is a custom implementation of analog Phase-Locked Loop (PLL_scm).

Component implements Phase-Frequency Detector (PFD) as phase comparator and voltage-controlled oscillator based on switched-capacitor delta-sigma modulator. Only few external capacitors and resistors required for low-pass filter. PLL_scm can lock to digital signal, producing one output of the same frequency, and another one of multiplied frequency, both are phase-aligned with the input. The component was designed to operate at low frequencies (10Hz–10kHz), with primary goal of tracking AC power lines (50-60 Hz).

Component was developed as part of RMS detection project. It can be useful for frequency multiplication, quadrature generation, motor control, guitar sound effects, etc.

It was tested using CY8KIT-059 PSoC5 prototyping kit. Several demo projects are provided.

Component Major features:

   Implements analog PLL using Type-II Phase Frequency Detector.

   Uses 1st-order delta-sigma modulator as VCO.

   Primary output is locked in both frequency and phase.

   Secondary output for multiplied frequency.

   Output for optional lock detection.

   Does not consume CPU.

Attached archive contains component library, component datasheet and several demo projects for PSoC5. Please read installation instructions in the readme.txt.

The component provided as-is, no liabilities. It is free to use and modify.

YouTube video showing component in action:

Custom Phase Lock Loop (PLL) demo using PSoC5 microcontroller - YouTube




Figure 1. Project schematic using 3-rd order LPF.


Figure 2. O-scope snapshot: blue trace - PLL input (60Hz), yellow trace - PLL output (locked).

PLL_scm_locked 60 Hz.jpg

2 Replies
Level 2
Level 2
First like received First like given

Is it possible to input a 32,768kHz clock (DS3231) and get 1,048576MHz (32x32,768) to use with DDS32?



1 MHz is too high for this type of PLL. The component uses very specific VCO, based on Delta-Sigma Modulator, which is optimized for low frequency operation (<100kHz).

I see several options to get to 1.048576 MHz.

1. Use XTAL (24 MHz) or external clock as stable reference, and DDS32 component to obtain desired frequency with accuracy of about 0.01 Hz. This is not true lock though. See #15 at

DDS24: 24-bit DDS arbitrary frequency generator component

2. It is possible to modify PLL component using a different type of VCO, optimized to operate in 1 MHz range. Basically, use PFD schematic and divider and add your own VCO. I tried several VCO schematics and was able to get up to 30 MHz, but had no time to put it together as a component. Your advantage is that desired frequency range is very narrow, so you can use simple 1 MHz ceramic resonator +2 capacitors, plus a varactor diode to tune oscillator frequency within ~1% to lock to 32x32768 Hz quartz. See example picture.


Implementation example of such VCO can be found here

Simple FM audio transmitter using PSoC5