Wednesday, January 3, 2018

2nd order-typ2-II PLL loop filter analysis


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
% design a loop filter for a typeII PLL
% the folrmulas are based on this analysis: http://sss-mag.com/pdf/pllfil.pdf
%
%           Icp_\___________________________Vctrl 
%               /     |                 |
%                     \                 | 
%                     /  R1 ohms        |
%                     \                 |
%                     /                 |
%                     |                _|_
%                    _|_               ___ C2 F
%                    ___ C1 F           |
%                     |                 |
%                    _|_               _|_
%                    \ /               \ /
%
%


function [R1,C1,C2]=pll_typeII_get_loop_filter (Icp,kvco,pm,bw,N)
% Icp: charge pump current [A]
% kvco: VCO gain [Hz/V]
% pm: phase margin [deg]
% bw: 3dB closed loop bandwidth [Hz] 
% N: feeback divider ratio 

% Z(s): impedance of loop filter
% Z(s) = (s+1/R1/C1)/(C2*s*(s+(C1+C2)/C1/C2/R1))
% z1=1/R1/C1
% p1=(C1+C2)/C1/C2/R1
% Z(s) = (s+z1)/C2/s/(s+p1)

% A(s): open loop transfer function

% ----------        |\
% | phi_in |--------|+\         __________          ________       ____________
% ----------        |  \________|Icp/2/pi|__________| Z(s) |_______|2*pi*kvco/s|______________phi_out
%                   |  /        ---------           -------        ------------  |
%               ----|-/                                                          |
%               |   |/                                              -----        |
%               |___________________________________________________| %N |_______|
%                                                                   -----
%
%  A(s) = Icp*kvco*Z(s)/s/N = Icp*kvco/C2/N/s^2*(s+z1)/(s+p1)
%  phase[A(s=jw)]=-180+arctan(w/z1)-arctan(w/p1)
%  PM: phase margin
%  PM = arctan(w/z1)-arctan(w/p1) = arctan[(p1-z1)*w/(w^2+p1*z1)]
%  design loop filter to maximize PM: d[(p1-z1)*w/(w^2+p1*z1)]/dw=0 --> wp=sqrt(p1*z1)
%  by PM definition we have: |A(s=jwp)|=1
%  closed loop transfer function: T(s) 
%  (phi_in-phi_out/N)*[A(s)*N] = phi_out --> T(s) = phi_out/phi_in = N*A(s)/(1+A(s))
%  3dB bandwidth, w0=2*pi*bw, is achived when |T(s=jw0)| = N/2; this can be achived for A(s=jw0) = j
%  we know that at wp, |A(s=jwp)|=1 and by maximizing PM at wp, we can assume that w0 is approximately equal to wp
%  using trigonometry equality of sec(tetha)=sqrt(1+tan^2(tetha)): z1=wp*(sec(PM)-tan(PM))
wp = 2*pi*bw;
tetha = pm*pi/180;
z1 = wp*(sec(tetha)-tan(tetha));
p1 = wp^2/z1;
C2= Icp*kvco/N/wp^2*sqrt(wp^2+z1^2)/sqrt(wp^2+p1^2); % using |A(s=jwp)|=1
C1=(p1/z1-1)*C2;
R1=1/C1/z1;

No comments: