User-Guide for Author: Dennis Fischette Copyright 2004, Dennis Fischette Disclaimer: despite efforts to minimize any errors and associated with these tools, the author assumes no liability for their use or mis-use of any kind. Use at your own risk. These tools are available for free personal use. They may not be offered or altered in any way for sale or barter. Description: ----------- Plloop is a Perl-based PLL loop analysis tool. It is intended to help designers calculate basic loop parameters and generate transfer functions, similar to MATLAB(tm). From user-specified loop parameters such as VCO gain, charge-pump current, feedback divisor, reference period, etc, plloop calculates 1) damping factor - assumes ideal 2nd-order PLL - no parasitic poles 2) natural frequency - assumes ideal 2nd-order PLL - no parasitic poles 3) 2*damping*naturalFrequency - 2x inverse of loop time constant - assumes ideal 2nd-order PLL - no parasitic poles 4) over-sampling ratio - referenceFrequency/openLoopBandwidth 5) phase margin - measured when openLoopGain=0dB 6) open-loop bandwidth - frequency at which openLoopGain=0dB 7) closed-loop bandwidth - frequencies at which closedLoopGain = 0dB and -3dB 8) peaking frequency and amplitude - maximum amplitude of closed-loop transfer function 9) estimated phase error (w/and w/o gate leakage) - assumes random VCO error accumulating up to the bandwidth of the PLL 10) estimated frequency modulation (at reference frequency) (w/and w/o gate leakage) - VCO jitter due to instantaneous correction of accumulated phase error 11) expected VCO frequency - fref*N 12) ratio of parasitic-loop pole to reference period - R*C2/Tref 13) open-loop transfer functions including up to 3 parastic poles and feedback delay 14) closed-loop transfer functions including up to 3 parastic poles and feedback delay Plloop produces five transfer function output files with the following extensions: 1. <>.out Open and Closed Loop Transfer Functions (magnitude and phase) 2. <>.openMag Bode Plot of Open-Loop Magnitude (dB vs. log(f)) 3. <>.openPhs Bode Plot of Open-Loop Phase (degrees vs. log(f)) 4. <>.closedMag Bode Plot of Closed-Loop Magnitude (dB vs. log(f)) 5. <>.closedPhs Bode Plot of Closed-Loop Phase (degrees vs. log(f)) Note: output Files 2-5 are easily viewable using gnuplot. Command Line Syntax: -------------------- plloop [ ] kvco: VCO gain (Hz/V). e.g. 1e9 icp: charge-pump current (Amp). e.g. 30e-6 res: low-pass filter resistance (Ohm). e.g. 3000 c1: low-pass filter large capacitor (Farad). e.g. 100e-12 c2: low-pass filter small (smoothing) capacitor (Farad). e.g. 7.5e-12 fbdiv: VCO feedback divider. e.g. 10 fbdly: feedback path delay. e.g. 5e-9 tref: reference period (Sec). e.g. 20e-9 ig: total gate-leakage on low-pass filter capacitors (Amp) rmsPctPerJit: estimated std deviation of VCO period jitter as percentage of VCO period. e.g. 0.4 e.g. Tvco=1000pS, Jitter(rms)=4pS --> rmsPctPerJit=100*4/1000 = 0.5 tau3: (optional) time-constant (Sec) of additional parasitic pole between LPF and VCO V-to-I e.g. 3e-9. Default=0 models additional low-pass filter ripple pole (3rd LPF pole). tau4: (optional) time-constant *(Sec) of parasitic pole at input of VCO e.g. 1e-9. Default=0 models VCO V-to-I filter tranferFunctionOutputPrefix: prefix used for the five output files generated by plloop Supplemental Tools (Perl) ------------------------- parsecol - parses rows and columns of a textfile for easy graphing command line syntax: parsecol [] ... [] [-startStop startLineNum stopLineNum] e.g. parsecol oldfile newfile 2 7 8 -startStop 35 1045 - columns 2, 7, and 8 are copied from oldfile to newfile, starting at line number 35 and ending at line number 1045 - comment lines are denoted with leading '#' and are ignored by parser except in counting line numbers. Gory Details ------------ Transfer functions model the PLL's behavior in the continuous-time frequency domain. As long as the PLL's sampling (reference) frequency is at least 10X higher than the PLL's bandwidth, then this continuous-time assumption is reasonable. Plloop treats two kinds of transfer functions: open-loop and closed-loop. The open-loop transfer function is the ratio of open-loop output phase to input phase. Phs(out)/Phs(in) assuming no feedback. Remember that phase is the time-integral of frequency. The closed-loop transfer function models the feedback that forces the output phase to follow the input phase. Again, it is defined as the ratio of Phs(out)/Phs(in). Note that transfer function math employs complex algebra. For our purposes, Phs(out) is measured at the output of the feedback divider. For closed-loop transfer functions, that allows us to directly compare how well the output is tracking the input. A magnitude of one indicates perfect tracking. Greater than one means over-correction. Less than one means under-correction. I'm going to call "K" the loop gain. It is defined as follows: K = Kvco*Icp/N (rad/sec)*Amp/V == rad/sec*Ohm where Kvco is the VCO gain, Icp is the charge-pump current, and N is the feedback divisor. Assuming no feedback delay, the open-loop transfer function is the following: G(s) = (K/s)*F(s) where F(s) is the loop filter transfer function. The closed-loop transfer function is simply H(s) = G(s) / (1+G(s)) In our analysis, we'll assume AC behavior and set s=-jw. If we assume that the PLL contains no parasitic poles (no C2 cap, Tau3-Tau4=0), then the PLL's closed-loop transfer function is 2nd-order with two poles and one stabilizing zero. This is a classic form, and the math is similar that of an RLC circuit or a mass-spring-dashpot. The 2nd-order closed-loop transfer function is the following: H(s) = (wn**2 * (1+s*R*C1))/ (s**2 + 2*s*D*wn + wn*wn) where wn is the natural frequency and D is the damping factor. Some important equations that fall out of this 2nd-order loop analysis: naturalFrequency = sqrt(Kvco*Icp/(Fbdiv*C1)) rads/sec dampingFactor = 0.5 * R * C1 * naturalFrequency loopTimeConstant = 1/(D*wn) sec Real PLL's are not 2nd-order. At minimum they contain a parasitic pole (C2 cap) to smooth control voltage ripple. They may also contain higher-order parasitic pole and feedback delay, which reduce stability while typically also reducing VCO period jitter. The open-loop transfer function with these parasitic poles and delays is the following mess: G(s) = ((K/s)*(1+s*R*C1) * e**(-s*Tdly)) / ((s*((C1+C2)+s*R*C1*C2) * (1+s*Tau3) * (1+s*Tau4)) where Tdly is the feedback delay and Tau3 and Tau4 are the time-constants associated with parasitic poles. Rather than solving this equation analytically, I examine the open-loop and closed-loop transfer function characteristics by solving numerically and viewing the results on a Bode plot. Phase margin is defined as difference between 180 degrees and the phase lag of the open-loop transfer function when it's magnitude is one (= 0dB). The phase margin is a good measure of the stability of the PLL's feedback loop. With reasonable allowances for feedback delay and parasitic poles, many designs aim for about 55-65 degrees of phase margin with a damping factor of about 0.7-1.0. Longterm-jitter (assumulated phase error) is estimated using the followig equations: If the damping factor > 1, Terr = Jrms * sqrt(fvco/fn) If the damping factor is < 1, Terr = Jrms * sqrt(fvco/fn*D) where Jrms is the rms VCO period jitter, fvco is the VCO frquency in Hz, fn is the natural frequency in Hz, and D is the damping factor.