Phase-Frequency Detector (PFD) Simulator
Visualize PFD timing in a charge-pump PLL — REF vs FB, UP/DN pulses, and average charge-pump current — then design the Type-2 loop filter (R, C, optional 3rd-order pole) for a given bandwidth and phase margin, with the resulting open-loop Bode plot.
Inputs
Result
Loop specifications
Component values
PFDs, Charge Pumps & PLL Loop Filters
A phase-frequency detector (PFD) is the front end of nearly every modern phase-locked loop. Compared to a simple XOR or mixer-style phase detector, the PFD has two huge advantages: a linear range of one full cycle (±2π rad), and an output that's sensitive to frequency difference as well as phase difference. The second property is what lets a PLL acquire lock from any starting frequency offset.
How the PFD works
The classic three-state PFD is two D flip-flops with their D inputs tied high. REF clocks one, FB (the divided VCO) clocks the other. The Q outputs are UP and DN. An AND gate resets both flip-flops whenever both go high simultaneously. The behaviour:
- REF leads FB by Δt: UP goes high on REF's rising edge, stays high until FB's rising edge resets both. UP pulse width = Δt; DN pulse ≈ 0 (just the reset-path delay).
- FB leads REF by Δt: DN goes high on FB's rising edge, resets when REF arrives. DN pulse width = Δt; UP ≈ 0.
- Perfect lock: UP and DN go high together briefly each cycle (matched edges → reset). The "deadband" is just the reset-path propagation delay (~1 ns) — vanishingly small ripple.
- Frequency error: faster input keeps triggering its flip-flop while the slower one hasn't caught up. The PFD spends almost all of its time pulling the loop in the right direction. This is what gives charge-pump PLLs their "infinite" capture range.
The charge pump
UP and DN drive a charge pump — typically a pair of matched current sources/sinks. When UP is high, +Icp flows into the loop filter; when DN is high, −Icp flows out. The average current per reference cycle is Iavg = Icp · φ / (2π) where φ is the phase error in radians. The combined PFD+CP block is therefore a perfectly linear phase-to-current converter with gain Kpd = Icp / (2π) A/rad.
Type-2 loop filter — the standard choice
The charge pump's output is a current; you need a filter that converts that to a control voltage for the VCO. The simplest stable design is a Type-2 lead-lag: a capacitor C in series with a resistor R, with the VCO control voltage taken across the C. The filter impedance is Z(s) = R + 1/(sC) — an integrator (the 1/sC term) plus a stabilising zero (the R term) at ωz = 1/(RC). The integrator gives infinite DC gain (so static phase error → 0); the zero provides phase margin for stability.
Designing for a chosen bandwidth and phase margin
Once you pick a target loop bandwidth ωc (the unity-gain crossover) and a phase margin PM, the component values fall out as:
- R·C = tan(PM) / ωc — sets the zero location to give the desired phase margin
- C = Icp·Kvco / (cos(PM) · N · ωc²) — sets the open-loop magnitude to 1 at ωc
- R = sin(PM) · N · ωc / (Icp·Kvco) — solve the above two together
This gives you exactly 1 at ωc with exactly PM phase margin. Adding a 3rd-order pole (an extra cap Cp = C/10 in parallel) attenuates reference spurs at multiples of fref, but slightly reduces the actual phase margin — the tool shows you the achieved PM with Cp included.
The "bandwidth < fref/10" rule
The CP-PLL is fundamentally a sampled-data system; the PFD samples once per reference cycle. The continuous-time linear analysis above only holds when the loop bandwidth is well below the sampling rate, conventionally BW < fref/10. Push past that and the loop will exhibit instability and excess ripple not predicted by Bode analysis. The tool flags this in the stability badge.