# Can we phase lock to a reference signal of square wave

Does the reference signal in the phase lock loop have to be a perfect sine wave？ If not, how can it be phase locked to?

The reference signal in a PLL needs to be appropriate for the type of phase discriminator used.

Most PLLs that are built use digital phase discriminators, so a square wave is the ideal waveform to use.

Even when using an analogue phase discriminator, for instance a DC-IF coupled double balanced mixer, a square wave works just as well as a sine wave.

A phase discriminator outputs a signal that's proportional to the difference in phase between the reference signal, and a fed-back signal representing the phase of the locked oscillator. It's just as easy to define the phase of a square wave as it is for a sine, triangle or pulse waveform. As long as this phase definition exists, and as long as the phase discriminator is sensitive to it, then a PLL can be closed successfully.

• Thanks! Clealy illustrated! but How to define the phase of a square wave then?
– Kicr
Apr 14, 2018 at 7:43
• @Rickyim It's a definition, so you can use anything that's useful. Generally what we do is say that phase = 0 at one edge, phase =2pi or 360 degrees at the next occurrence of the same polarity edge, and increases linearly with time between the two edges. Apr 14, 2018 at 8:13

If your phase-detector is an EXOR, a 50% duty cycle allows an exact loc.

If your phase-detector is a PFD, you don't need 50% duty cycle, but you will be exactly locked onto which ever polarity edge PFD uses to clock the internal FlipFlops.

• See your point! Thanks! The XOR phase detector only detect the sign difference. For a steady duty cycle, the phase difference will be one-to-one map to the phase detector output. So actually the VCO is controlled to generate a sine wave of the same frequency as the base frequency of square wave. Right?
– Kicr
Apr 15, 2018 at 5:54