<<

1

Charge pump phase-locked loop with phase- detector: closed form mathematical model Kuznetsov N.a,b,c, Yuldashev M.a, Yuldashev R.a, Blagov M.a,b, Kudryashova E.a, Kuznetsova O.a, Mokaev Ta.

Abstract—Charge pump phase-locked loop with examples are given for the first time, the main idea of phase-frequency detector (CP-PLL) is an electrical Example 1 was already noticed by P. Acco and O. Feely circuit, widely used in digital systems for frequency [1], [9]. P. Acco and O. Feely considered only near-locked synthesis and synchronization of the clock signals. In this paper a non-linear second-order model of CP-PLL state, therefore they didn’t notice problems with out-of- is rigorously derived. The obtained model obviates the lock behavior. Example 2 and Example 3 demonstrate shortcomings of previously known second-order models problems with out-of-lock behavior, which was not discov- of CP-PLL. Pull-in time is estimated for the obtained ered before. second-order CP-PLL. Note that while derivation of non-linear mathematical models for high-order CP-PLL requires numerical solution I. Introduction of non-linear algebraic equations or allows to find only approximate solutions (see, e.g. [6], [8], [13], [14], [16], HASE-locked loops (PLLs) are electronic circuits, [19], [33], [36]), non-linear mathematical models for the designed for generation of an electrical signal (volt- P second order CP-PLL can be found in closed-form. Fur- age), while the frequency is automatically tuned to the ther, we consider only the second order CP-PLL. Noise frequency of an input (reference, Ref) signal. Charge pump performance and simulation of PLL is discussed in [3], [26], phase-locked loop with phase-frequency detector (Charge [28], [29], [32]. pump PLL, CP-PLL, CPLL) is widely used in digital systems for frequency synthesis and synchronization of the clock signals [3]. The CP-PLL is able to quickly lock onto II. A model of charge pump phase-locked loop the phase of the incoming signal, achieving low steady- with phase-frequency detector in the signal state phase error [7]. Important issues in the design of PLL space are estimation of the ranges of deviation between oscilla- Consider charge pump phase-locked loop with phase- tors for which a locked state can be achieved, frequency detector [10], [12] on Fig. 1. Both reference the stability analysis of the locked states, and study of and output of the voltage controlled oscillator (VCO) are possible transient processes. The pioneering monographs square signals, see Fig. 2. [11], [31], [35] were published in 1966, a rather comprehen- sive bibliography [24] was published in 1973, and recent trailing edge surveys [4], [23]. For the corresponding study of the CP- PLL F. Gardner developed in 1980 a linearized model in vicinity of locked states [10], [12]. Then an approximate arXiv:1901.01468v4 [eess.SP] 10 Mar 2019 discrete-time linear models of the CP-PLL were suggested 1 2 3 in [17], [25]. However, linear models are essentially limited, Fig. 2: of the reference and voltage controlled since only local behavior near locked states can be studied. oscillator (VCO) signals are periodic functions with period For the study of non-local behavior and transient processes equal to one. Trailing edges happen at the integer values of some nonlinear second-order models of the CP-PLL were corresponding phases. developed in [2], [7], [34]. Examples from section V demonstrate that algorithm Without loss of generality we suppose that trailing edges and formulas suggested by M. van Paemel in [34] should of VCO and reference signals occur when corresponding be used carefully for simulation even inside allowed area phase reaches an integer number. The frequency ωref of (see Fig. 18 and Fig. 22 in original paper [34]). While the reference signal (reference frequency) is usually assumed to be constant: (a) Faculty of and Mechanics, Saint-Petersburg State b t University, Russia; ( ) Dept. of Mathematical Information Technol- θref (t) = ωref t = , (1) ogy, University of Jyv¨askyl¨a,Finland; (c) Institute for Problems in Tref Mechanical Engineering of Russian Academy of Science, Russia; (cor- responding author email: [email protected]). This paper is where Tref , ωref and θref (t) are the period, frequency and an extended version of [22] phase of reference signal. 2

R Reference PFD C Loop filter

( ) + 1 + + s +

VCO

Fig. 1: Charge pump phase-locked loop with phase-frequency detector (Charge pump PLL)

The phase-frequency detector (PFD) is a digital circuit, The relationship between the input current i(t) and triggered by the trailing (falling) edges of the reference Ref the output voltage vF (t) for a proportionally integrating and VCO signals. The output signal of PFD i(t) can have (perfect PI) filter based on resistor and capacitor only three states (Fig. 3): 0, +Ip, and −Ip. 1 H(s) = R + , Cs Ref Ref is as follows t 1 Z VCO Ref vF (t) = vc(0) + Ri(t) + i(τ)dτ, (2) -Ip 0 Ip C 0 where R > 0 is a resistance, C > 0 is a capacitance, and VCO VCO t 1 R vc(t) = vc(0) + C i(τ)dτ is a capacitor charge. Ref 0 The control signal vF (t) adjusts the VCO frequency: ˙ free θvco(t) = ωvco(t) = ωvco + KvcovF (t), (3) Ip PFD 0 free where ωvco is the VCO free-running (quiescent) frequency -I p (i.e. for vF (t) ≡ 0), Kvco is the VCO gain (sensivity), and 2 θvco(t) is the VCO phase. Further we assume that VCO θ˙vco(t) = ωvco(t) > 0. (4) time If the frequency of VCO ωvco(t) is much higher than Fig. 3: Phase-frequency detector operation. the frequency of reference signal ωref , then trailing edges of VCO forces PFD to be in the lower state −Ip most of the time. In this case the output of loop filter vF (t) is negative. To construct a mathematical model, we wait for first Negative filter output, in turn, decrease the VCO fre- trailing edge of reference signal and define the correspond- quency to match the reference frequency. Similarly, if the ing time instance as t = 0. Suppose that before t = 0 the VCO frequency is much lower than the reference frequency, PFD had a certain constant state i(0−). A trailing edge of the filter output becomes mostly positive, increasing the the reference signal forces PFD to switch to higher state, VCO frequency. If the VCO and reference frequencies are unless it is already in state +Ip. A trailing edge of the close to each other, then the transient process may be more VCO signal forces PFD to switch to lower state, unless it complicated. In this case the CP-PLL either tends to a is already in state −Ip. If both trailing edges happen at locked state or to an unwanted oscillation. the same time then PFD switches to zero. From (1), (2), and (3), for given i(0−) and ωref we Thus, i(0) is determined by the values i(0−), θvco(0), obtain a continuous time nonlinear mathematical model and θref (0). Similarly, i(t) is determined by i(t−), θvco(t), of CP-PLL described by differential equations and θ (t). Thus, i(t) is piecewise constant and right- ref 1 1 v˙c(t) = i(t), continuous . C (5) ˙ free θvco(t) = ωvco + Kvco (Ri(t) + vc(t)), 1approaching any number from the right yields the same value of i(t) 2VCO overload is considered in the end of this paper. 3 with discontinuous piecewise constant nonlinearity interval: k interval: k+1  interval: k+2 i(t) = i i(t−),ωref ,θvco(t)  and initial conditions vc(0),θvco(0) . PFD 0 III. Derivation of discrete time CP-PLL model Here we derive discrete time model of the CP-PLL in the following form

τk+1 = ϕ(τk,vk), (6) Filter vk+1 = v(τk,vk).

First, let us define the state variables τk, vk. middle Let t0 = 0. Denote by t0 the first instant of time such that the PFD output becomes equal to zero3; if i(0) = time middle 0 then t0 = 0. Then we wait until the first trailing edge of the VCO or Ref and denote corresponding moment Fig. 5: Definition of discrete states τk and vk. lk is a PFD pulse of time by t1. Continuing in a similar way, one obtains width. middle increasing sequences {tk} and {tk } for k = 0,1,2... (see Fig. 4). Finally, from (2) we get Let t < tmiddle. Then for t ∈ [t ,tmiddle) sign (i(t)) is ( k k k k v , t ∈ [tmiddle,t ), a non zero constant (±1). Denote by τ the PFD pulse k k k+1 k vF (t) = Ip middle width (length of time interval, where PFD output is non- vk ± RIp ± C (t − tk+1), t ∈ [tk+1,tk+1 ). zero constant), multiplied by the sign of PFD output (see (9) Fig. 5): Combining (3) and (9) we obtain  free middle  middle  middle ωvco + Kvcovk, t ∈ [tk ,tk+1), τk = t − tk sign (i(t)), t ∈ [tk,t ),  k k  free  Ip  (7) ωvco(t) = ω + Kvco vk ± RIp ± (t − tk+1) , middle vco C τk = 0 tk = tk .  middle t ∈ [tk+1,tk+1 ), (10) k k+1 k+2 k+3 where the sign − or + in the last equation corresponds to Ref sign (i(t)). By (9) and (7) the value of vk+1 can be expressed via τk+1 and vk: Ip vk+1 = vk + τk+1. (11) Ip C PFD 0 To find τk+1 one needs to consider four possible cases of PFD transitions (see Fig. 6): -Ip 1) τk ≥ 0, τk+1 ≥ 0; VCO 2) τk ≥ 0, τk+1 < 0; 3) τk < 0, τk+1 ≤ 0; 4) τk < 0, τk+1 > 0. time Case 1: Case 2: middle I I Fig. 4: Explanation of t and t . p p k k PFD PFD 0 0 -I -I If the VCO trailing edge hits before the Ref trailing p p edge, then τk < 0 and in the opposite case we have τk > 0. time time Thus, τk shows how one signal lags behind another. From (2) it follows that the zero output of PFD i(t) ≡ Case 3: Case 4: 0 on the interval (tmiddle,t ) implies a constant filter k k+1 I p Ip output. Denote this constant by vk: PFD PFD 0 0 middle -I -I vF (t) ≡ vk, t ∈ [tk ,tk+1). (8) p p time time 3Remark that the PFD output i(t) always returns to zero from non-zero state at certain time. If i(t0) = −1, then the first Ref trailing Fig. 6: Four cases of PFD states transitions edge returns the PFD output to zero. If i(t0) = 1, then the VCO frequency is increasing until the first VCO trailing edge returns the PFD output to zero. Case 1: τk ≥ 0 and τk+1 ≥ 0 (see Fig. 30). 4

Substituting (17) and (10) into (16) and calculating the Ref integral (i.e. shaded area in Fig. 30a) we get the following relation for τ : VCO k+1

I p   PFD 0 free -I p (Tref − (τk mod Tref ) + τk+1) ωvco + Kvcovk +  1  (18) + K I Rτ + τ 2 = 1. vco p k+1 2C k+1 Equation (VIII) is quadratic with discriminant

2 b(v(k)) − 4ac(τk,vk), (19) time where (a) Case 1 1: general case, Reference cycle slipping; τk ≥ 0, KvcoIp τk+1 ≥ 0 a = , . 2C free Fig. 7: Subcases of the Case 1. Integral of the VCO frequency b = b(vk) = ωvco + Kvcovk + KvcoIpR,   ωvco over the VCO period Tvco is pink subgraph area (grey in c = c(τ ,v ) = (T − (τ mod T )) ωfree + K v − 1. black/white). The integral is equal to 1 according to the PFD k k ref k ref vco vco k switching law and definition of time intervals. (20) Relation (14) is equivalent to c ≤ 0, which means that the discriminant is non-negative. Therefore, equation (VIII) First, rewrite requirement τ ≥ 0 in terms of τ and k+1 k has exactly one positive solution: v . Since ω (t) > 0, condition τ > 0 takes the form k vco k+1 √ −b + b2 − 4ac θ (t ) − θ (tmiddle) ≤ 1. (12) . (21) vco k+1 vco k 2a

By (10) we get Case 2: τk ≥ 0 and τk+1 < 0 (Fig. 31). The first VCO middle edge appears at t = tk , and the second VCO edge tk+1 Z appears at t = tk+1. middle θvco(tk+1) − θvco(tk ) = ωvco(τ)dτ = middle (13) tk   free Ref = (Tref − (τk mod Tref )) ωvco + Kvcovk .

VCO Thus, condition τk+1 ≥ 0 can be expressed via vk and τk 4 I in the following way : p PFD 0

-Ip  free  (Tref − (τk mod Tref )) ωvco + Kvcovk ≤ 1. (14) VCO freq. Now find τk+1. VCO trailing edges appeared twice on middle middle time interval [tk,tk+2): at t = tk and at t = tk+1 . Thus, we get

middle middle θvco(tk+1 ) − θvco(tk ) = 1. (15)

By (3) it is equivalent to 0 time middle t t Zk+1 kZ+1 (a) Case 2 1: general case, Reference and VCO cycle slipping; ωvco(t)dt + ωvco(t)dt = 1. (16) τk ≥ 0, τk+1 < 0

middle tk+1 Fig. 8: Subcases of the Case 2. Integral of the VCO frequency tk ωvco over the VCO period Tvco is pink subgraph area (grey in By definition of τ (7) we get (see Fig. 30a) black/white). The integral is equal to 1 according to the PFD k switching law and definition of time intervals. middle tk+1 = tk − (τk mod Tref ) + Tref , middle (17) Similarly to the previous case, we can derive a relation tk+1 = tk+1 + τk+1. for τk+1 by integrating VCO frequency ωvco(t) over its middle period [t ,tk+1]: 4 Here (a mod b) is the remainder after division of a by b, where a k is the dividend and b is the divisor. This function is often called the  free  modulo operation. (Tref + τk+1 − (τk mod Tref )) ωvco + Kvcovk = 1. 5

Therefore Case 4: τk < 0 and τk+1 > 0 (see Fig. 33). 1 τk+1 = free − Tref + (τk mod Tref ). (22) ωvco + Kvcovk Ref Case 3: τk < 0 and τk+1 ≤ 0 (see Fig. 32). VCO

Ip PFD 0 -I Ref p

VCO

I PFD p i(t) 0 -Ip

time 0

(a) Case 4 1: general case, VCO and Reference cycle slipping; I K l p vco k τ < 0, τ > 0 C k k+1 Fig. 10: Subcases of the Case 4. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in black/white). The integral is equal to 1 according to the PFD switching law and definition of time intervals.

Similar to Case 3 condition τk+1 > 0 is equivalent to time 0 lb > Tref , (27)

(a) Case 3 1: general case, VCO cycle slipping; τk < where l = tmiddle −tmiddle can be computed in the follow- 0, τ < 0 b k+1 k k+1 ing way Fig. 9: Subcases of the Case 3. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in 1 − Sla black/white). The integral is equal to 1 according to the PFD lb = lb(τk,vk) = free , switching law and definition of time intervals. Kvcovk + ωvco S = S (τ ,v ) = S mod 1, la la k k lk (28) First, we determine the sign of τk+1. To do that we Slk = Slk (τk,vk) = need to find out which of the signals (VCO or reference) 2  free τk middle − Kvcovk − IpRKvco + ω τk + KvcoIp . reaches its period first after tk , i.e. to check if lb = vco 2C middle tk+1 − tk ≤ Tref . By (10) for the time interval lb we get (see Fig. 32) Now we can compute the VCO phase corresponding to its full period: Slb lb = lb(vk) = free , (23) Kvcovk + ωvco Sla + STref + Sτk+1 = 1, where free t ST = ST (vk) = Tref (Kvcovk + ωvco ), Zk+1 ref ref  free  Slb = ωvco(t)dt = 1 − Sla . (24) Sτk+1 = Sτk+1 (τk+1,vk) = τk+1 Kvcovk + ωvco + IpRKvco + tmiddle I K τ 2(k + 1) k + p vco . 2C Here Sla (green area in Fig. 32) is computed as a fractional (29) part of the subgraph area corresponding to l = −τ : k k From (27) there is only one positive solution τk+1 of quadratic equation Sla = Sla (τk,vk) = Slk mod 1, S = S (τ ,v ) = √ lk lk k k (25) −b + b2 − 4ad 2 τ = ,  free lk k+1 = Kvcovk − IpRKvco + ωvco lk + KvcoIp . 2a 2C KvcoIp a = , (30) Finally, we get 2C free b = b(vk) = ω + Kvcovk + KvcoIpR, 1 − Sla vco τk+1 = free − Tref . (26) Kvcovk + ωvco d = b(τk,vk) = Sla + STref − 1, 6

IV. Corrected full discrete model of CP-PLL agreement with engineering requirements for a particular Combining equations for all four cases we obtain a application. The ideal case is τlock = 0. discrete time nonlinear mathematical model of CP-PLL There is a hypothesis, which has not yet been proven rigorously, that the hold-in and pull-in ranges5 coincide I v = v + p τ (τ ,v ), and both are infinite if the model has a locked state (see, k+1 k C k+1 k k (31) e.g. [2], [7], [18]). k = 0,1,2,... B. Pull-in time with initial conditions v0 and τ0. Function τk+1(τk,vk) is defined by the following equation One of the important characteristics of CP-PLL is how  √ fast it acquires a locked state during the pull-in process. −b+ b2−4ac Suppose that the CP-PLL is in a locked state with input  2a , τk ≥ 0, c ≤ 0,   frequency ωref1. Then the reference frequency changes to  1 new frequency ω from fixed range [ωmin,ωmax]. Since  free − Tref + (τk mod Tref ), ref2 ref ref  ωvco +Kvcovk  CP-PLL lost it’s locked state, the feedback loop of CP- τk ≥ 0, c > 0, τk+1(τk,vk) = PLL tunes the VCO to the new input frequency to acquire   new locked state. Transient process takes time Tref1→ref2,  lb − Tref , τk < 0, lb ≤ Tref ,  and maximum of such possible time intervals is called a  √  pull-in time Tpull-in. The pull-in time can be measured in  −b+ b2−4ad 2a , τk < 0, lb > Tref , seconds or the number of cycles of the input frequency. (32) In practice (34) is hard to check for all k. Instead for KvcoIp a = , simulation one may check that additionally to small τk 2C frequency of VCO is close to reference frequency: free b = b(vk) = ωvco + Kvcovk + KvcoIpR, τk c = c(τk,vk) = ≤ τlock, Tref  free  (35) (Tref − (τk mod Tref )) ωvco + Kvcovk − 1, free 1 ωvco + Kvcovk − < ωlock. 1−Sla (33) Tref lb = lb(τk,vk) = free , Kvcovk+ωvco V. Comparison with original model by M. van Sla = Sla (τk,vk) = Slk mod 1, Paemel Slk = Slk (τk,vk) =   2 In this section using original notation [34] we demostrate free τk − Kvcovk − IpRKvco + ωvco τk + KvcoIp 2C , why existing model has problems and how proposed model free fixes them. d = d(vk) = Sla + Tref (Kvcovk + ωvco ) − 1.

Here the initial conditions are the following: v0 is the initial A. Example 1 output of the filter, τ0 is determined by θvco(0) and i(0). Consider the following set of parameters and initial If at some point VCO becomes overloaded (frequency state: approaches zero) one should stop simulation or use another R2 = 0.2;C = 0.01;Kv = 20;Ip = 0.1;T = 0.125; set of equations, based on ideas similar to (34) and (35) (36) in [34], see section VIII. τ(0) = 0.0125;v(0) = 1. Calculation of normalized parameters (equations (27)-(28) A. Locked states, hold-in range, and pull-in range and (44)-(45) in [34])

After the synchronization is achieved, i.e. transient pro- KN = IpR2KvT = 0.05, cess is over, the loop is said to be in a locked state. For R C τ = 2 = 0.016, practical purposes, only asymptotically stable locked states, 2N T r in which the loop returns after small perturbations of its 1 KN (37) state, are of interest. CP-PLL is in a locked state if FN = ≈ 0.2813, 2π τ2N trailing edges of the VCO signal happens near the trailing √ K τ edges of the reference signal: ζ = N 2N ≈ 0.0141, 2

τk shows that parameters (36) correspond to allowed area in ≤ τlock, k = 0,1,2,..., (34) Tref Fig. 13 (equations (46)–(47), Fig 18 and Fig. 22 in [34]): where τlock is sufficiently small, and the loop returns in 5 The largest symmetric interval (continuous range, without holes) this state after small perturbations of (vk,τk). of frequencies around free-running frequency of the VCO is called In a locked state the output of PFD i(t) can be non- a hold-in range if the loop has a locked state. If, in addition, the loop acquires a locked state for any initial state of the loop and any zero only on short time intervals (shorter than τlock). reference frequency from the interval then the interval is called a An allowed residual phase difference τlock should be in pull-in range [4], [20], [21], [23]. 7

Example 1, Example 2 Example 1, Example 2 Example 3 Example 3

Fig. 11: Parameters for Example 1, Example 2, and Example 3 correspond to allowed area (see Fig 18 and Fig. 22 in [34])

p 1 + ζ2 − ζ Therefore the algorithm is terminated with error. FN < ≈ 0.3138, π (38) From (36) for our model we have: 1 FN < ≈ 5.6438. 4πζ free ωvco = 0, Now we use the flowchart in Fig. 12 (Fig. 10 in [34]) to c = (T − (τ(0) mod T ))Kvv(0) − 1 = 1.2500, 1 τ(1) = − T + (τ(0) mod T ) = −0.0625, (41) Example 1. Kvv(0) Example 2. I v(1) = v(0) + p τ(1) = 0.3750. Example 3. C

B. Example 2

Consider the same parameters as in Example 1, but τ(0) = −0.098: ERROR Example 1 R2 = 0.2;C = 0.01;Kv = 20;Ip = 0.1;T = 0.125; (42) τ(0) = −0.098; v(0) = 1.

ERROR In this case (37), (38), and Fig. 13 are the same as in Examples 2, 3 Example 1, i.e. we are in the “allowed area”. Now we compute τ(1) and v(1) following the flowchart in Fig. 12: since τ(0) < 0 we proceed to case 2) and corresponding equation of τ(k + 1) (equation (9) in [34]):

Fig. 12: Demonstration of Example 1, Example 2, and Example 2 1 Ipτ(0) 3 in the flowchart of the algorithm (see Fig. 10 in [34]) − IpR2τ(0) − τ(1) = Kv 2C − T + τ(0) = −0.21906, v(0) compute τ(1) and v(1): since τ(0) > 0 and τ(0) < T , we − 0.2191 < −T = −0.125. proceed to case 1) and corresponding relation for τ(k +1) (43) (equation (7) in [34]): This fact indicates cycle-slipping (out of lock). According −I R − v(k) to the flowchart in Fig. 12 (see Fig. 10 in [34]), we should τ(k + 1) = p 2 + Ip proceed to case 6) and recalculate τ(1). First step of case C q (39) 6) is to calculate t1,t2,t3,... (equations (16) and (17) in 2 2Ip 1 (IpR2 + v(k)) − C (v(k)(T − τ(k)) − K ) [34]): + v . Ip C q 2 Ip 1 vn−1 − IpR2 − (vn−1 − IpR2) − 2 · However, the expression under the square root in (39) is C Kv tn = , negative: Ip C (44) 2 2Ip 1 Ip (IpR2 + v(0)) − (v(0)(T − τ(0)) − ) = −0.2096 < 0. vn = vn−1 − tn, C Kv C (40) v0 = v(k − 1). 8

Since k = 0, then (16) and (17) in [34]) until t1 + t2 + ... + tn > |τ(0)|. Even Ip q if we suppose v(−1) = v(0) − C τ(0), we get v − I R − (v − I R )2 − 2 Ip · 1 0 p 2 0 p 2 C Kv t1 = , t1 = 0.0463, v1 = 1.215; Ip C (45) t2 = 0.0618, v2 = 0.983; (52) Ip v = v − t , t1 + t2 = 0.1081 < |τ(0)| = 0.123. 1 0 C 1 However, t can not be computed, because the relation v0 = v(−1). 3 under the square root in (44) is negative: However, v(−1) doesn’t make sense and algorithm termi- 2 Ip 1 nates with error. Even if we suppose that it is a typo (v2 − IpR2) − 2 · ≈ −0.0726. (53) C Kv and v0 = v(0), then relation under the square root become negative: Corrected model gives τ(1) = −0.0569, v(1) = 0.3153. (54) 2 Ip (v(0) − IpR2) − 2 = −0.0396 < 0. (46) CKv VI. Mathematical simplification of the discrete In both cases the algorithm is terminated with error. model of CP-PLL Note, that modification of case 2) corresponding to VCO Follow the ideas from [1], [7], the number of parameters overload (equation (35) in [34]) can not be applied here, in (32) can be reduced to just two (α and β) since v(0) > IpR2 (no overload) and v(1) is not computed αβ τk yet because of the error. τk = , Corrected model successfully detects overload without Tref αβ  free  any error: ω = Tref ωvco + Kvcovk − 1, k (55) free α = KvcoIpTref R, ωvco v(1) + − IpR2 ≈ −0.2106 < 0 (47) 2 K KvcoIpT vco β = ref . 2C Then C. Example 3 αβ αβ αβ αβ αβ ωk+1 = ωk + 2βτk+1(τk ,ωk ), Consider parameters: (56) k = 0,1,2,... τ(0) = −0.123; v(0) = 0.6, αβ αβ (48) with initial conditions τ (0) and ω (0). Function αβ αβ αβ R2 = 0.2;C = 0.02;Kv = 20;Ip = 0.1;T = 0.125. τk+1(τk ,ωk ) is defined by the following equation Similar to (37) and (38) τ αβ (τ αβ,ωαβ) = k+1 k √k  2 K = 0.05, τ = 0.032, −bn+ bn−4βc αβ N 2N  , τ ≥ 0, c ≤ 0, (49)  2β k FN ≈ 0.1989, ζ = 0.02,    1 − 1 + (τ αβ mod 1), p  ωαβ +1 k 1 + ζ2 − ζ  k  αβ FN < ≈ 0.3120, = τ ≥ 0, c > 0, π (50) k 1  F < ≈ 3.9789,  αβ N  l − 1, τ < 0, l ≤ 1, 4πζ  bn k bn   √ parameters (48) correspond to allowed area in Fig. 13  −b + b2 −4βd  n n , τ αβ < 0, l > 1, (equations (46)-(47), Fig. 18 and Fig. 22 in [34]). 2β k bn (57) Now we compute τ(1) and v(1) following the flowchart αβ αβ bn = bn(ωk ) = ωk + α + 1, in Fig. 12: since τ(0) < 0 one proceeds to case 2) and c = c(τ αβ,ωαβ) = corresponding equation for computing τ(k + 1) (equation k k αβ αβ (9) in [34]): (1 − (τk mod 1))(ωk + 1) − 1, 1 − (Sl mod 1) I τ(0)2 αβ αβ k 1 p lbn = lbn(τk ,ωk ) = , K − IpR2τ(0) − 2C αβ τ(1) = v − T + τ(0) ≈ −0.224, ωk + 1 v(0) αβ αβ Sl = Slk(τ ,ω ) = − 0.224 < −T = −0.125. k k k  αβ  αβ 2 (51) − ωk − α + 1 τk + βτn(k), The last inequality indicates cycle-slipping (out of lock). d = d(τ αβ,ωαβ) = (S mod 1) + ωαβ. According to the flowchart in Fig. 12 (see Fig. 10 in [34]), k k lk k one proceeds to case 6) and recalculates τ(1). First step of This change of variables allows to reduce parameter space case 6) is to calculate t1,t2,t3,... using (44) (see equations and simplify design of PFD PLLs. 9

Moreover, checking requirement (34) for all k is impos- sible in practice during simulation. Instead one can check that values of ωαβ and ταβ are small, which indicate that frequencies of VCO and input signal are close and trailing edges happen almost at the same time. It means that the loop is in a locked state.

A. Locked states and periodic solutions By (55), there is only one stationary point

αβ αβ ωk = ωk+1 ≡ 0, αβ αβ (58) τk = τk+1 ≡ 0. which is a locked state if it is locally stable. Period-2 points Fig. 14: Comparison of PFD outputs of Simulink model (PFD αβ αβ Simulink) vs V.Paemel’s model (Paemel model) vs Corrected ωk+2 = ωk , model (Discrete model). Lower subfigure demonstrates output αβ αβ (59) of Loop filter. For considered set of parameters (τ(0) = 0;v(0) = τ = τ , −6 −3 −3 k+2 k 10;R2 = 1000;C = 10 ;Kv = 500;Ip = 10 ;T = 10 ;τ2N = 1;KN = 0.5;FN = 0.1125;ζ = 0.3536) all three models produce also can be found by (55): almost the same results.

αβ αβ αβ ω k + 2 = ωk+1 + 2βτk+2, αβ αβ αβ = ωk + 2βτk+2 + 2βτk+1, (60) αβ αβ τk+2 = −τk+1. B. Example 6

From (60) period-2 points correspond to the alternating between Case 2 and Case 4. In general, period-P points satisfy equation k+P τ(0) = 0;v(0) = 100, X τ = 0. (61) −6 −3 −3 i R2 = 1000;C = 4 · 10 ;Kv = 500;Ip = 10 ;T = 10 . i=k+1 τ2N = 4;KN = 0.5;FN = 0.0563;ζ = 0.7017. By (57) it is possible to obtain exact relations for all (63) periodic solutions.

VII. Comparison of Simulink vs V.Paemel’s model vs Corrected model

Correctness of proposed model was verified by exten- sive simulation in Matlab Simulink. Circuit level model in Matlab Simulink was compared with original model by V. Paemel and proposed model. Full code also can be found in Github repository https://github.com/mir/ PFD-simulation Here we consider only few examples. Based on simulation for this set of parameters all three models produce almost the same results.

A. Example 5 Fig. 15: Comparison of PFD outputs of Simulink model (PFD Simulink) vs V.Paemel’s model (Paemel model) vs Corrected τ(0) = 0; v(0) = 10, model (Discrete model). Lower subfigure demonstrates out- put of Loop filter. For considered set of parameters (τ(0) = −6 −3 −3 −6 −3 R2 = 1000;C = 10 ;Kv = 500;Ip = 10 ;T = 10 . 0;v(0) = 100;R2 = 1000;C = 4 · 10 ;Kv = 500;Ip = 10 ;T = −3 τ2N = 1;KN = 0.5;FN = 0.1125;ζ = 0.3536. 10 ;τ2N = 4;KN = 0.5;FN = 0.0563;ζ = 0.7071) all three (62) models produce almost the same results. 10

Example 4 Example 4 Example 5 Example 5

Fig. 13: Parameters for Example 5 and Example 6 correspond to allowed area (see Fig 18 and Fig. 22 in [34])

free VIII. Algorithm for VCO overload Case O1. τk < 0, Kvcovk + ωvco > 0, τk+1 < 0 (equiva- lently lb < Tref )

If filter output vF (t) is small enough then VCO equation (3) should be modified [?] to satisfy (4): Ref

VCO

I  free PFD p free ωvco 0  ω + KvcovF (t), vF (t) > − i(t) ˙ vco Kvco -I θvco(t) = free (64) p  0, v (t) ≤ − ωvco F Kvco

At step k VCO overload can be detected by checking the following conditions: 0

free ωvco Ip τk > 0 and vk + − τk < 0, Kvco C free (65) ωvco τk < 0 and vk + − IpR < 0. time Kvco

free Fig. 16: VCO overload case O1. τk < 0, Kvcovk + ωvco > 0, τk+1 < 0 (equivalently lb < Tref ) Following Cases describe how to modify (32) to take into account VCO overload. Note, that values τk and vk can be correctly computed by (32). free • Case O1. τk < 0, Kvcovk + ωvco > 0, τk+1 < 0 free In order to compute τk+1 taking into account VCO over- • Case O2. τk < 0, Kvcovk + ωvco > 0, τk+1 ≥ 0 free load, one can compute phase of VCO before it’s frequency free ωvco • Case O3. τk < 0, Kvcovk + ω ≤ 0, vk + + vco KVCO hit zero. The VCO phase at that moment corresponds to IpR < 0 the area S of the green triangle (see Fig. 16). In order free la free ωvco • Case O4. τk < 0, Kvcovk + ω ≤ 0, vk + + to find the triangle area one can find lx — time interval vco KVCO IpR ≥ 0 corresponding to zero VCO frequency: free • Case O5. τk ≥ 0, Kvcovk + ωvco ≤ 0, τk+1 > 0 free  free  • Case O5*. Impossible. τk ≥ 0, Kvcovk + ωvco ≤ 0, C ωvco lx = min − (vk + − IpR),−τk . (66) τk+1 < 0. Ip Kvco free • Case O6. τk ≥ 0, Kvcovk + ωvco > 0, τk+1 > 0, free • Case O7. τk ≥ 0, Kvcovk + ωvco > 0, τk+1 ≤ 0, Since the triangle in question (Sla) is part of the larger 11

free free ωvco tringle S, we get Case O3. τk < 0, Kvcovk +ω ≤ 0, vk + +IpR < 0 vco KVCO I S = K (τ + l )2 p , vco k x 2C (67) Sla = S mod 1.

Condition τk+1 < 0 means that VCO edge triggered Ref change of PFD state from 0 to −Ip. Since phase change between two consequetive falling edges of VCO is 1, we VCO I get p PFD 0 -I free p Sla + lb(Kvcovk + ωvco ) = 1, 1 − Sla lb = free . (68) Kvcovk + ωvco

where lb is time during which PFD was in zero state. If 0 lb < Tref , then

τk+1 = −(Tref − lb). (69) time

If lb ≥ Tref then we should proceed to the next case (O2).

Fig. 18: Overload limit, VCO cycle slipping; τk < 0, τk+1 < 0

free Case O2. τk < 0, Kvcovk + ωvco > 0, τk+1 ≥ 0 (equiva- lently lb ≥ Tref ) Consider timing diagram on Fig. 18. One can split interval τk+1 into subintervals lb0, lb+ such that PFD output is zero on lb0 and positive on lb+: Ref

VCO

I PFD p 0 τ = l + l , -Ip k+1 b0 b+ I ωfree + K (I R + v + p l ) = 0, vco vco p k C b0 (71)  free  C ωvco lb0 = − − IpR − vk . 0 Ip Kvco

time Since phase difference between two consequetive falling edges of VCO is 1, we get free Fig. 17: VCO overload case O2. τk < 0, Kvcovk + ωvco > 0, τk+1 ≥ 0 (equivalently lb ≥ Tref )

Value of Sla is computed by (67). Now we can compute Sla + Slb+ = 1, τk+1 (see Fig. 17) similarly to case 4, (30) KvcoIp 2 Slb+ = l , 2C b+ (72) √ s −b + b2 − 4ad 2C τk+1 = , lb+ = (1 − Sla) , 2a KvcoIp K I a = vco p , 2C (70) free b = b(vk) = ωvco + Kvcovk + KvcoIpR,

d = b(τk,vk) = Sla + STref − 1, where Sla and Slb are areas of corresponding triangles free (phase difference of VCO for corresponding time intervals). STref = STref (vk) = Tref (Kvcovk + ωvco ), 12

free free ωvco Case O4. τk < 0, Kvcovk +ω ≤ 0, vk + +IpR ≥ 0 Consider timing diagram on Fig. 20. Since phase differ- vco KVCO ence between two consequetive falling edges of VCO is 1, we get K I Ref τ (ωfree + K (v + I R)) + τ 2 vco p = 1 (76) k+1 vco vco k p k+1 2C VCO Therefore

I √ p 2 PFD 0 −b + b + 4a -I p τ = , k+1 2a K I (77) a = vco p , 2C b = ωfree + K v + K I R. 0 vco vco k vco p

free Case O6. τk ≥ 0, Kvcovk + ωvco > 0, τk+1 > 0. Consider timing diagram on Fig. 21. Here τk+1 can be time computed using case 1 (without overload, see Fig. 30a)

free Fig. 19: VCO overload case O4.τk < 0, Kvcovk +ωvco ≤ 0, vk + ωfree vco + IpR ≥ 0 Ref KVCO VCO

I PFD p Consider timing diagram on Fig. 19. Since phase differ- 0 -I ence between two consequetive falling edges of VCO is 1, p we get 0

Sla + Sτk+1 = 1, (73) where Sla can be computed using (67), and Sτk+1 is phase of VCO corresponding to time interval τk+1. Then

time KvcoIp 2 free Sτk+1 = τk+1 + τk+1(ωvco + Kvco(vk + IpR)). 2C Fig. 21: VCO overload case O6. τk > 0, τk+1 > 0 (74) Finally, free p 2 Case O7. τk ≥ 0, Kvcovk + ωvco > 0, τk+1 ≤ 0 −b + b − 4ado τk+1 = , Consider timing diagram on Fig. 22. Here τ can be 2a k+1 computed using (22) from case 2 (without overload) KvcoIp a = , (75) 2C free b = ωvco + Kvcovk + KvcoIpR, Ref do = −Sτk+1 . VCO

Ip PFD 0 -I free p Case O5. τk ≥ 0, Kvcovk + ωvco ≤ 0, τk+1 > 0 0

Ref

VCO

Ip PFD 0

-Ip time

Fig. 22: VCO overload case O7. τk > 0, τk+1 ≤ 0 0 IX. Simulation of VCO overload model and comparison with Matlab Simulink Simulink model is shown in Fig. 23. Full code for simulation in Matlab and comparison with simulink model time can be found in GitHub repository https://github.com/ Fig. 20: VCO overload case O5. τk > 0, τk+1 > 0 mir/cppll-overload and in Appendix. 13

Discrete model Descrete model PFD out comparison

Ref Ref Filter output vco frequency ref PFD I_p K_vco > 0 1 in phase VCO out VCO simulink PFD out PFD simulink s vco Ref I_p Falling-edge PFD Loop filter K_vco 0 Overload Pulse waveform Switch 0 omega_free initial_vco_phase

omega_vco_free intiial VCO phase

Fig. 23: Maltab Simulink model of CP-PLL with VCO overload

Fig. 25: Simulation of VCO overload model and comparison with Matlab Simulink. Here Discrete model shows output Fig. 24: Simulation of proposed mathematical model and com- of PFD predicted by proposed mathematical model, simulink parison with Matlab Simulink. Here Discrete model shows pfd out, vco frequency, and Filter output show results free −3 output of PFD predicted by proposed mathematical model, of Simulink simulation. Parameters: ωvco = 0;Tref = 10 ;R = −6 −3 simulink pfd out, vco frequency, and Filter output show 1000;C = 10 ;Kvco = 1000;Ip = 10 ;v1 = 4;τ1 = −0.2 · T ; free ref results of Simulink simulation. Parameters: ωvco = 0;Tref = −3 −6 −3 10 ;R = 1000;C = 10 ;Kvco = 1000;Ip = 10 ;v1 = 0;τ1 = −0.1 · Tref . It is easy to see that simulation with proposed discrete model Simulation confirms mathematical proof and jus- tifies proposed model.

Conclusion In this paper a non-linear mathematical model of CP- PLL is rigorously derived. The obtained model obviates the shortcomings in previously known mathematical mod- els of CP-PLL. The VCO overload case initially noted in [34] is extended to take into account new cases. Analysis of local stability with respect to coordinate τk (partial stability, see condition (34)) gives us the estimation of the hold-in range. There is a hypothesis, which has not yet been proven rigorously, that the hold-in and pull-in ranges are coincide. For some parameters we estimate the pull-in time numerically. There were many attempts to generalize equations derived in [34] for higher-order loops (see, e.g. [5], [14], [15], [27], [30], [33]), but the resulting transcen- dental equations can not be solved analytically without using approximations. Therefore proposed model is very 14

effective and corresponding numerical algorithm is much [19] T. Johnson and J. Holmberg. Nonlinear state-space model of faster than alternative models (e.g., Matlab Simulink). charge-pump based frequency synthesizers. In Circuits and Systems, 2005. ISCAS 2005. IEEE International Symposium on, pages 4469–4472. IEEE, 2005. Acknowledgements [20] N.V. Kuznetsov, G.A. Leonov, M.V. Yuldashev, and R.V. Yul- dashev. Rigorous mathematical definitions of the hold-in and The work is supported by the Russian Science Founda- pull-in ranges for phase-locked loops. IFAC-PapersOnLine, tion project 19-41-02002 and Grant for Leading Scientific 48(11):710–713, 2015. Schools of Russia (2018-2019). [21] N.V. Kuznetsov, G.A. Leonov, M.V. Yuldashev, and R.V. Yul- dashev. Solution of the Gardner problem on the lock-in range Authors would like to thank Mark Van Paemel for of phase-locked loop. ArXiv e-prints, 2017. 1705.05013. valuable comments. In private communication with Mark [22] N.V. Kuznetsov, M.V. Yuldashev, R.V. Yuldashev, M.V. Van Paemel it turned out that some of the considered Blagov, E.V. Kudryashova, O.A. Kuznetsova, and T.N. Mokaev. Comment on ”Analysis of a charge-pump PLL: A new model” shortcoming were avoided in FORTRAN code that he used by M. van Paemel. arXiv preprint arXiv:1810.02609, 2018. for the simulation of the circuit. Also Mark Van Paemel [23] G.A. Leonov, N.V. Kuznetsov, M.V. Yuldashev, and R.V. Yul- emphasized importance of VCO overload and motivated dashev. Hold-in, pull-in, and lock-in ranges of PLL circuits: rigorous mathematical definitions and limitations of classical us to develope corresponding algorithm. theory. IEEE Transactions on Circuits and Systems–I: Regular Papers, 62(10):2454–2464, 2015. [24] W.C. Lindsey and R.C. Tausworthe. A Bibliography of the References Theory and Application of the Phase-lock Principle. JPL tech- [1] P. Acco. Study of the loop ‘a phase lock: Hybrid aspects taken nical report. Jet Propulsion Laboratory, California Institute of into account. PhD thesis, Toulouse, INSA, 2003. Technology, 1973. [2] P. Acco, J. Daafouz, D. Fourniet-Prunaret, and A.-K. Taha. Ap- [25] J. Lu, B. Grung, S. Anderson, and S. Rokhsaz. Discrete z- proche hybride de la stabilit´elocale de la boucle `averrouillage domain analysis of high order phase locked loops. In Circuits de phase par impulsions de charge. Revue e-STA, 1(4), 2004. and Systems, 2001. ISCAS 2001. The 2001 IEEE International [3] R.E. Best. Phase locked loops: design, simulation, and applica- Symposium on, volume 1, pages 260–263. IEEE, 2001. tions. McGraw-Hill Professional, 2007. [26] G M´esz´aros,Cs F´u’zy, and J Ladv´anszky. Does or [4] R.E. Best, N.V. Kuznetsov, G.A. Leonov, M.V. Yuldashev, and phase noise arise first? Electronics Letters, 48(12):1, 2012. R.V. Yuldashev. Tutorial on dynamic analysis of the Costas [27] Sinisa Milicevic and Leonard MacEachern. Time evolution of loop. Annual Reviews in Control, 42:27–49, 2016. the voltage-controlled signal in charge pump pll applications. [5] Chuang Bi, Paul F Curran, and Orla Feely. Linearized discrete- In Microelectronics, 2008. ICM 2008. International Conference time model of higher order charge-pump plls. In Circuit Theory on, pages 413–416. IEEE, 2008. and Design (ECCTD), 2011 20th European Conference on, [28] B. Razavi. Monolithic phase-locked loops and clock recovery pages 457–460. IEEE, 2011. circuits: theory and design. John Wiley & Sons, 1996. [6] F. Bizzarri, A. Brambilla, and G.S. Gajani. Periodic small signal [29] Werner Rosenkranz. Phase-locked loops with limiter phase analysis of a wide class of type-ii phase locked loops through an detectors in the presence of noise. IEEE Transactions on exhaustive variational model. IEEE Transactions on Circuits communications, COM-30(10):805–809, 1982. and Systems I: Regular Papers, 59(10):2221–2231, 2012. [30] Sergio Sancho, Almudena S´uarez,and Jeffrey Chuan. General [7] P.F. Curran, Ch. Bi, and O. Feely. Dynamics of charge-pump envelope-transient formulation of phase-locked loops using three phase-locked loops. International Journal of Circuit Theory and time scales. IEEE Transactions on Microwave Theory and Applications, 41(11):1109–1135, 2013. Techniques, 52(4):1310–1320, 2004. [8] B. Daniels. Analysis and design of high order digital phase locked [31] V.V. Shakhgil’dyan and A.A. Lyakhovkin. Fazovaya avtopod- loops. PhD thesis, National University of Ireland Maynooth, stroika chastoty (in Russian). Svyaz’, Moscow, 1966. 2008. [32] V.V. Shakhgil’dyan and A.A. Lyakhovkin. Sistemy fazovoi [9] Orla Feely, Paul F. Curran, and Chuang Bi. Dynamics of charge- avtopodstroiki chastoty (in Russian). Svyaz’, Moscow, 1972. pump phase-locked loops. International Journal of Circuit [33] B.I. Shakhtarin, A.A. Timofeev, and V.V. Sizykh. Mathematical Theory and Applications, 2012. model of the phase-locked loop with a current detector. Journal [10] F. Gardner. Charge-pump phase-lock loops. IEEE Transactions of Communications Technology and Electronics, 59(10):1061– on Communications, 28(11):1849–1858, 1980. 1068, 2014. [11] F.M. Gardner. Phaselock techniques. John Wiley & Sons, New [34] M. van Paemel. Analysis of a charge-pump PLL: A new model. York, 1966. IEEE Transactions on communications, 42(7):2490–2498, 1994. [12] F.M. Gardner. Phaselock techniques. John Wiley & Sons, 2005. [35] A. Viterbi. Principles of coherent communications. McGraw- [13] M. Guermandi, E. Franchi, and A. Gnudi. On the simulation of Hill, New York, 1966. fast settling charge pump PLLs up to fourth order. International [36] Z. Wang. An analysis of charge-pump phase-locked loops. Journal of Circuit Theory and Applications, 39(12):1257–1273, IEEE Transactions on Circuits and Systems I: Regular Papers, 2011. 52(10):2128–2138, 2005. [14] C. Hangmann, C. Hedayat, and U. Hilleringmann. Stability analysis of a charge pump phase-locked loop using autonomous difference equations. IEEE Transactions on Circuits and Sys- Appendix: Simulink model tems I: Regular Papers, 61(9):2569–2577, 2014. [15] Pavan Kumar Hanumolu, Merrick Brownlee, Kartikeya Ma- yaram, and Un-Ku Moon. Analysis of charge-pump phase- locked loops. IEEE Transactions on Circuits and Systems I: Regular Papers, 51(9):1665–1674, 2004. [16] C.D. Hedayat, A. Hachem, Y. Leduc, and G. Benbassat. Mod- eling and characterization of the 3rd order charge-pump PLL: a fully event-driven approach. Analog Integrated Circuits and Signal Processing, 19(1):25–45, 1999. [17] J.P. Hein and J.W. Scott. Z-domain model for discrete- time PLL’s. IEEE Transactions on Circuits and Systems, 35(11):1393–1400, 1988. [18] A. Homayoun and B. Razavi. On the stability of charge-pump phase-locked loops. IEEE Transactions on Circuits and Systems I: Regular Papers, 63(6):741–750, 2016. Fig. 26: Simulink model of CP-PLL 15

19 % number of steps (tau_k) to simulate 20 max_step = 10000; 21 22 % initialize PFD output with initial data 23 pfd_output = zeros((max_step-1)*4,2); 24 pfd_output(1,:) = [0 0]; 25 if (tau_1 >= 0) 26 pfd_output(2,:) = [0 I_p]; 27 pfd_output(3,:) = [tau_1 I_p]; 28 pfd_output(4,:) = [tau_1 0]; 29 t_k_middle = tau_1; 30 initial_vco_phase = 1 - (... 31 (omega_free + K_vco*v_1)*tau_1 ... 32 + K_vco*I_p/2/C*tau_1ˆ2 ... 33 - K_vco*I_p/C*tau_1ˆ2 ... 34 ); 35 initial_ref_phase = 0; 36 else 37 pfd_output(2,:) = [0 -I_p]; 38 pfd_output(3,:) = [-tau_1 -I_p]; 39 pfd_output(4,:) = [-tau_1 0]; 40 t_k_middle = -tau_1; Fig. 27: Simulink model of PFD 41 initial_vco_phase = 0; 42 initial_ref_phase = 1 + tau_1/T_ref; 43 end 44 initial_filter_state = v_1 - I_p*tau_1/C; 45 index = 4; 46 47 48 tau_v = zeros(max_step,2); 49 tau_v(1,:) = [tau_1 v_1]; 50 tau_k = tau_1; 51 v_k = v_1 ; 52 for step = 2:(max_step - 1) 53 %check for VCO overload 54 if ((tau_k > 0 ... 55 && (v_k+omega_free/K_vco - I_p/C*tau_k) < 0)... 56 ||... 57 (tau_k < 0 ... 58 && v_k+omega_free/K_vco - I_p*R < 0)) 59 errordlg(sprintf(’VCO overload detected at k = %0d’,step-1)); 60 break ; 61 end Fig. 28: Simulink model of VCO 62 63 [tau_k1,v_k1,tau_k_zero] = righthand(tau_k,v_k ,... 64 K_vco, T_ref, I_p, C, R, omega_free); 65 66 tau_v(step,:) = [tau_k1 v_k1]; 67 t_k1 = t_k_middle + tau_k_zero; 68 index = index + 1; 69 pfd_output(index,:) = [t_k1 0]; 70 71 if (tau_k1 ˜= 0) 72 index = index + 1; 73 pfd_output(index,:) = [t_k1 I_p*sign(tau_k1)]; 74 75 t_k1_middle = t_k1 + abs(tau_k1); 76 index = index + 1; 77 pfd_output(index,:) = [t_k1_middle I_p*sign(tau_k1)]; 78 index = index + 1; 79 pfd_output(index,:) = [t_k1_middle 0]; 80 end 81 82 t_k = t_k1 ; 83 t_k_middle = t_k1_middle; 84 tau_k = tau_k1; 85 v_k = v_k1 ; 86 end 87 [tau_k1,v_k1,tau_k_zero] = righthand(tau_k,v_k ,... 88 K_vco, T_ref, I_p, C, R, omega_free); 89 tau_v(max_step,:) = [tau_k1,v_k1]; 90 91 % truncate trailing zeros 92 last_non_zero = find(pfd_output(:,1),1,’last’); 93 pfd_output = pfd_output(1:last_non_zero,:); 94 95 % plot(pfd_output(:,1),pfd_output(:,2)); 96 % ylim([-1.1*I_p 1.1*I_p]); 97 paemel_simulation;

1 function [tau_k1,v_k1,tau_k_zero] = righthand( ... 2 tau_k,v_k,... 3 K_vco, T_ref, I_p, C, R, omega_free) 4 %righthandside Corrected 5 if(tau_k >= 0) 6 c = (T_ref - rem(tau_k,T_ref))*(omega_free+K_vco*v_k)-1; 7 if (c <= 0) 8 % tau(k+1)>0,case1) 9 a = K_vco*I_p/(2*C); 10 b = omega_free + K_vco*v_k + K_vco*I_p*R; 11 tau_k1 = (-b + sqrt(bˆ2 - 4*a*c))/(2*a); 12 tau_k_zero = T_ref - rem(tau_k,T_ref); Fig. 29: Simulink model of Loop filter 13 else 14 % tau(k+1)<0,case2) 15 tau_k1 = 1/(omega_free + K_vco*v_k) - T_ref + rem(tau_k,T_ref); 16 tau_k_zero = 1/(omega_free + K_vco*v_k); 1 % parameters 17 end 2 omega_free = 0; 18 else 3 T_ref = 10ˆ-3; 19 lk = -tau_k ; 4 R = 1000; 20 S_lk = (K_vco*v_k-I_p*R*K_vco+omega_free)*lk+(K_vco*I_p*lkˆ2)/(2*C); 5 C = 10ˆ -6; 21 S_la = rem(S_lk,1); 6 K_vco = 500; 22 S_lb = 1-S_la; 7 I_p = 10ˆ -3; 23 lb = S_lb/(K_vco*v_k + omega_free); 8 24 if lb <= T_ref 9 % recalculated values 25 % tau(k+1)<0 10 tau_2N = R*C/T_ref 26 l_k1 = T_ref - lb; 11 K_N = I_p*R*K_vco*T_ref 27 tau_k1 = -l_k1; 12 F_N = 1/(2*pi)*sqrt(K_N/tau_2N) 28 tau_k_zero = lb; 13 dzeta = sqrt(K_N*tau_2N)/2 29 else 14 30 % tau(k+1)>=0 15 % initial data 31 S_Tref = T_ref*(K_vco*v_k +omega_free); 16 v_1 = 10; 32 c = S_la + S_Tref -1; 17 tau_1 = T_ref*0; 33 b = omega_free +K_vco*v_k +K_vco*I_p*R; 18 34 a = K_vco*I_p/(2*C); 16

35 tau_k1 = (-b+sqrt(bˆ2-4*a*c))/(2*a); 4 %righthandside Paemel 36 tau_k_zero = T_ref; 5 if(tau_k >= 0) 37 end 6 % case 1 38 end 7 a = I_p/(2*C); 39 v_k1 = v_k + tau_k1*I_p/C; 8 b = v_k + I_p*R; 40 end 9 c = (T_ref - tau_k)*v_k-1/K_vco; 10 tau_k1 = (-b + sqrt(bˆ2 - 4*a*c))/(2*a); 11 tau_k_zero = T_ref - tau_k; 12 1 % check that omega_free is zero if (tau_k1 < 0) 13 2 if (omega_free > 0) % case 3 Paemel 14 3 errordlg(’Please set omega_free to zero’); tau_k1 = 1/(K_vco*v_k) - T_ref + tau_k; 15 4 end tau_k_zero = 1/(K_vco*v_k); 5 16 end 17 6 % initialize PFD output with initial data else 18 7 paemel_output = zeros((max_step-1)*4,2); % case 2 Paemel 19 8 paemel_output(1,:) = [0 0]; tau_k1 = (... 20 9 if (tau_1 >= 0) 1/K_vco - I_p*R*tau_k - I_p*tau_kˆ2/(2*C)... 21 10 paemel_output(2,:) = [0 I_p]; )/v_k - T_ref + tau_k; 22 11 paemel_output(3,:) = [tau_1 I_p]; 23 12 paemel_output(4,:) = [tau_1 0]; lk = -tau_k ; 24 13 t_k_middle = tau_1; S_lk = (K_vco*v_k-I_p*R*K_vco)*lk+(K_vco*I_p*lkˆ2)/(2*C); 25 14 initial_vco_phase = 1 - (... tau_k_zero = (1-rem(S_lk,1))/(K_vco*v_k); 26 15 (K_vco*v_1)*tau_1 ... 27 16 + K_vco*I_p/2/C*tau_1ˆ2 ... if( tau_k1 > 0) 28 17 - K_vco*I_p/C*tau_1ˆ2 ... % case 4 Paemel 29 18 ); tau_k1 = (... 30 19 initial_ref_phase = 0; -I_p*R -v_k + sqrt((I_p*R + v_k)ˆ2 + (2*I_p/C)*v_k*tau_k1) ... 31 20 else )/( I_p /C); 32 21 paemel_output(2,:) = [0 -I_p]; 33 22 paemel_output(3,:) = [-tau_1 -I_p]; tau_k_zero = T_ref; 34 23 paemel_output(4,:) = [-tau_1 0]; end 35 24 t_k_middle = -tau_1; end 36 25 initial_vco_phase = 0; v_k1 = v_k + tau_k1*I_p/C; 37 26 initial_ref_phase = 1 + tau_1/T_ref; end 27 end 28 initial_filter_state = v_1 - I_p*tau_1/C; 29 index = 4; 30 31 Appendix: Matlab code for VCO overload 32 tau_v_paemel = zeros(max_step,2); 33 tau_v_paemel(1,:) = [tau_1 v_1]; model 34 tau_k = tau_1; 35 v_k = v_1 ; 36 for step = 2:(max_step - 1) 1 % parameters 37 [tau_k1,v_k1,tau_k_zero] = paemel_righthand(tau_k,v_k ,... 2 omega_free = 0; 38 K_vco, T_ref, I_p, C, R); 3 T_ref = 10ˆ-3; 39 4 R = 1000; 40 % Compute case 6 5 C = 10ˆ -6; 41 if (tau_k1 < -T_ref) 6 K_vco = 1000; 42 if (step <= 2) 7 I_p = 10ˆ -3; 43 errordlg(’ERROR in Paemel algo case 6), no v(-1)’); 8 44 paemel_output = zeros((max_step-1)*4,2); 9 % recalculated values 45 break ; 10 tau_2N = R*C/T_ref 46 end 11 K_N = I_p*R*K_vco*T_ref 47 v_n_1 = tau_v_paemel(step-2,2); 12 F_N = 1/(2*pi)*sqrt(K_N/tau_2N) 48 t_sum = 0; 13 dzeta = sqrt(K_N*tau_2N)/2 49 while (t_sum < abs(tau_k)) 14 50 t_n = (v_n_1 - I_p*R - sqrt((v_n_1 - I_p*R)ˆ2 - 15 % initial data ,→ 2*I_p/C/K_vco)... 16 v_1 = 4; 51 )/( I_p /C); 17 tau_1 = -0.2*T_ref; 52 t_sum = t_sum + t_n; 18 if (tau_1 < -T_ref) 53 v_n_prev = v_n_1; 19 errordlg(’Impossible tau_1. Can not be lower than -T_ref.’); 54 v_n_1 = v_n_1 - I_p/C*t_n; 20 end 55 end 21 56 t_sum = t_sum - t_n; 22 % number of steps (tau_k) to simulate 57 t_a = -tau_k - t_sum; 23 max_step = 10000; 58 t_b = (1/K_vco - t_a*(v_n_prev - I_p*R) + I_p/C*t_aˆ2/2)/v_k; 24 59 tau_k1 = t_b - T_ref; 25 % initialize PFD output with initial data 60 26 pfd_output = zeros((max_step-1)*4,2); 61 v_k1 = v_k + tau_k1*I_p/C; 27 pfd_output(1,:) = [0 0]; 62 tau_k_zero = t_b; 28 if (tau_1 >= 0) 63 end 29 pfd_output(2,:) = [0 I_p]; 64 30 pfd_output(3,:) = [tau_1 I_p]; 65 tau_v_paemel(step,:) = [tau_k1 v_k1]; 31 pfd_output(4,:) = [tau_1 0]; 66 t_k1 = t_k_middle + tau_k_zero; 32 t_k_middle = tau_1; 67 index = index + 1; 33 initial_vco_phase = 1 - (... 68 paemel_output(index,:) = [t_k1 0]; 34 (omega_free + K_vco*v_1 + K_vco*I_p*R - 69 ,→ K_vco*tau_1*I_p/C)*tau_1 ... 70 if (tau_k1 ˜= 0) 35 + K_vco*I_p/2/C*tau_1ˆ2 ... 71 index = index + 1; 36 ); 72 paemel_output(index,:) = [t_k1 I_p*sign(tau_k1)]; 37 % overload 73 38 if (-K_vco*I_p/C*tau_1 + K_vco*v_1 < 0) 74 t_k1_middle = t_k1 + abs(tau_k1); 39 if (-K_vco*I_p/C*tau_1 + K_vco*v_1 +K_vco*I_p*R < 0) 75 index = index + 1; 40 if (omega_free + K_vco*v_1 + K_vco*I_p*R < 0) 76 paemel_output(index,:) = [t_k1_middle I_p*sign(tau_k1)]; 41 errordlg(’Impossible initial condition. v_1 is too 77 index = index + 1; ,→ small .’); 78 paemel_output(index,:) = [t_k1_middle 0]; 42 end 79 end 43 initial_vco_phase = 1 - (... 80 44 (omega_free + K_vco*v_1 + K_vco*I_p*R)ˆ2/2/(K_vco*I_p/C) 81 % case 5 ,→ ... 82 if (tau_k1 >= T_ref) 45 ); 83 tau_k1 = rem(tau_k1,T_ref); 46 else 84 end 47 initial_vco_phase = 1 - (... 85 48 tau_1ˆ2*K_vco*I_p/2/C+ ... 86 t_k = t_k1 ; 49 tau_1*(K_vco*I_p*R + K_vco*v_1 + omega_free - 87 t_k_middle = t_k1_middle; ,→ tau_1*K_vco*I_p/C)... 88 tau_k = tau_k1; 50 ); 89 v_k = v_k1 ; 51 end 90 end 52 end 91 [tau_k1,v_k1,tau_k_zero] = righthand(tau_k,v_k ,... 53 if (initial_vco_phase < 0) 92 K_vco, T_ref, I_p, C, R, omega_free); 54 errordlg(’Impossible initial condition. v_1 or tau_1 is too 93 tau_v_paemel(max_step,:) = [tau_k1,v_k1]; ,→ big .’); 94 55 end 95 % truncate trailing zeros 56 initial_ref_phase = 0; 96 last_non_zero = find(paemel_output(:,1),1,’last’); 57 else 97 if (last_non_zero > 1) 58 pfd_output(2,:) = [0 -I_p]; 98 paemel_output = paemel_output(1:last_non_zero,:); 59 pfd_output(3,:) = [-tau_1 -I_p]; 99 end 60 pfd_output(4,:) = [-tau_1 0]; 100 % plot(pfd_output(:,1),pfd_output(:,2)); 61 t_k_middle = -tau_1; 101 % ylim([-1.1*I_p 1.1*I_p]); 62 initial_vco_phase = 0; 63 initial_ref_phase = 1 + tau_1/T_ref; 64 end 65 initial_filter_state = v_1 - I_p*tau_1/C; 1 function [tau_k1,v_k1,tau_k_zero] = paemel_righthand( ... 66 index = 4; 2 tau_k,v_k,... 3 K_vco, T_ref, I_p, C, R) 67 17

68 34 a = K_vco*I_p/(2*C); 69 tau_v = zeros(max_step,2); 35 tau_k1 = (-b+sqrt(bˆ2-4*a*c))/(2*a); 70 tau_v(1,:) = [tau_1 v_1]; 36 tau_k_zero = T_ref; 71 tau_k = tau_1; 37 end 72 v_k = v_1 ; 38 end 73 for step = 2:(max_step - 1) 39 v_k1 = v_k + tau_k1*I_p/C; 74 [tau_k1,v_k1,tau_k_zero] = righthand(tau_k,v_k ,... 40 end 75 K_vco, T_ref, I_p, C, R, omega_free); 76 77 %check for VCO overload 78 if ((tau_k > 0 ... 1 function [tau_k_o,v_k_o,tau_k_zero] = righthand_overload( ... 79 && (v_k+omega_free/K_vco - I_p/C*tau_k) < 0)... 2 tau_k,v_k,... 80 ||... 3 tau_k_1,v_k_1,... 81 (tau_k < 0 ... 4 K_vco, T_ref, I_p, C, R, omega_free) 82 && v_k+omega_free/K_vco - I_p*R < 0)) 5 %righthandside overload 83 [tau_k_o,v_k_o,tau_k_zero] = righthand_overload(tau_k,v_k ,... 6 root2 = @(a,b,c) ((-b + sqrt(bˆ2 - 4*a*c))/2/a); 84 tau_k1,v_k1,... 7 85 K_vco, T_ref, I_p, C, R, omega_free); 8 omega_vco = omega_free + K_vco*v_k; 86 tau_k1 = tau_k_o; 9 a = K_vco*I_p/2/C; 87 v_k1 = v_k_o; 10 b = omega_vco + K_vco*I_p*R; 88 end 11 89 12 if(tau_k < 0) 90 tau_v(step,:) = [tau_k1 v_k1]; 13 l_x = min([-C/I_p*(v_k + omega_free/K_vco - I_p*R) -tau_k]); 91 t_k1 = t_k_middle + tau_k_zero; 14 S = K_vco*(tau_k + l_x)ˆ2*I_p/2/C; 92 index = index + 1; 15 Sla = rem(S,1); 93 pfd_output(index,:) = [t_k1 0]; 16 if (omega_vco > 0) 94 17 if (tau_k_1 < 0) 95 18 % O1 if (tau_k1 ˜= 0) 19 l_b = (1-Sla)/omega_vco; 96 index = index + 1; 20 tau_k_o = -(T_ref - l_b); 97 pfd_output(index,:) = [t_k1 I_p*sign(tau_k1)]; 21 98 22 tau_k_zero = l_b; 99 t_k1_middle = t_k1 + abs(tau_k1); 23 else 100 index = index + 1; 24 % O2 101 pfd_output(index,:) = [t_k1_middle I_p*sign(tau_k1)]; 25 Sref = T_ref*omega_vco; 102 index = index + 1; 26 d = Sla + Sref - 1; 103 pfd_output(index,:) = [t_k1_middle 0]; 27 tau_k_o = root2(a,b,d); 104 end 28 105 29 tau_k_zero = T_ref; 106 t_k = t_k1 ; 30 end 107 t_k_middle = t_k1_middle; 31 else 108 tau_k = tau_k1; 32 if (v_k + omega_free/K_vco + I_p*R < 0) 109 v_k = v_k1 ; 33 % O3 110 end 34 l_b_0 = C/I_p*(-omega_free/K_vco - I_p*R - v_k); 111 [tau_k1,v_k1,tau_k_zero] = righthand(tau_k,v_k ,... 35 l_b_plus = sqrt((1 - Sla)*2*C/K_vco/I_p); 112 K_vco, T_ref, I_p, C, R, omega_free); 36 tau_k_o = l_b_0 + l_b_plus; 113 tau_v(max_step,:) = [tau_k1,v_k1]; 37 114 38 tau_k_zero = T_ref; 115 % truncate trailing zeros 39 else 116 last_non_zero = find(pfd_output(:,1),1,’last’); 40 % O4 117 pfd_output = pfd_output(1:last_non_zero,:); 41 d_0 = Sla - 1; 118 42 tau_k_o = root2(a,b,d_0); 119 plot(pfd_output(:,1), pfd_output(:,2)/I_p); 43 44 tau_k_zero = T_ref; 45 end 1 function [tau_k1,v_k1,tau_k_zero] = righthand( ... 46 end 2 tau_k,v_k,... 47 else 3 K_vco, T_ref, I_p, C, R, omega_free) 48 if (omega_vco <= 0) 4 %righthandside Corrected 49 if (tau_k_1 > 0) 5 if(tau_k >= 0) 50 % O5 6 c = (T_ref - rem(tau_k,T_ref))*(omega_free+K_vco*v_k)-1; 51 tau_k_o = root2(a,b,-1); 7 if (c <= 0) 52 8 % tau(k+1)>0,case1) 53 tau_k_zero = T_ref - rem(tau_k,T_ref); 9 a = K_vco*I_p/(2*C); 54 end 10 b = omega_free + K_vco*v_k + K_vco*I_p*R; 55 else 11 tau_k1 = (-b + sqrt(bˆ2 - 4*a*c))/(2*a); 56 if (tau_k_1 > 0) 12 tau_k_zero = T_ref - rem(tau_k,T_ref); 57 % O6 equal to case 1) no overload 13 else 58 c = (T_ref - rem(tau_k,T_ref))*(omega_free+K_vco*v_k)-1; 14 % tau(k+1)<0,case2) 59 tau_k_o = root2(a,b,c); 15 tau_k1 = 1/(omega_free + K_vco*v_k) - T_ref + rem(tau_k,T_ref); 60 16 tau_k_zero = 1/(omega_free + K_vco*v_k); 61 tau_k_zero = T_ref - rem(tau_k,T_ref); 17 end 62 else 18 else 63 % O7 equal to case 2) no overload 19 lk = -tau_k ; 64 tau_k_o = 1/(omega_free + K_vco*v_k) - T_ref + 20 S_lk = (K_vco*v_k-I_p*R*K_vco+omega_free)*lk+(K_vco*I_p*lkˆ2)/(2*C); ,→ rem(tau_k,T_ref); 21 S_la = rem(S_lk,1); 65 22 S_lb = 1-S_la; 66 tau_k_zero = T_ref - rem(tau_k,T_ref) + tau_k_o; 23 lb = S_lb/(K_vco*v_k + omega_free); 67 end 24 if lb <= T_ref 68 end 25 % tau(k+1)<0 69 end 26 l_k1 = T_ref - lb; 70 v_k_o = v_k + tau_k_o*I_p/C; 27 tau_k1 = -l_k1; 71 end 28 tau_k_zero = lb; 29 else 30 % tau(k+1)>=0 31 S_Tref = T_ref*(K_vco*v_k +omega_free); 32 c = S_la + S_Tref -1; 33 b = omega_free +K_vco*v_k +K_vco*I_p*R; Appendix: Additional pics 18

Ref Ref VCO VCO Ip PFD 0 I -Ip p PFD 0

-Ip

time time (a) Case 1 1: general case, Reference cycle slipping; τk ≥ 0, τk+1 ≥ 0 (b) Case 1 4: all VCO and Reference trailing edges happen at . different time instances; τk > 0, τk+1 > 0

Ref

VCO Ref

Ip PFD 0 VCO

-Ip

Ip PFD 0

-Ip

0 0 time time (c) Case 1 2: VCO and Reference trailing edges both happen (d) Case 1 3: VCO and Reference trailing edges both happen middle at the same time instance tk+1; τk > 0, τk+1 = 0 at the same time instance tk ; τk mod Tref = 0, τk+1 > 0

Ref

VCO

Ip PFD 0

-Ip

time (e) Case 1 5: VCO and Reference trailing edges both happen at the same time instance tk; τk = 0, τk+1 > 0

Fig. 30: Subcases of the Case 1. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in black/white). The integral is equal to 1 according to the PFD switching law and definition of time intervals. 19

Ref Ref

VCO VCO

Ip Ip PFD 0 PFD 0

-Ip -Ip

VCO VCO freq. freq.

0 0 time time (a) Case 2 1: general case, Reference and VCO cycle slipping; (b) Case 2 2: all VCO and Reference trailing edges happen at τk ≥ 0, τk+1 < 0 different time instances; τk > 0, τk+1 < 0

Ref Ref

VCO VCO

I p Ip PFD 0 PFD 0 -I p -Ip VCO VCO freq. freq.

0 0 time time (c) Case 2 3: VCO and Reference trailing edges both happen (d) Case 2 4: VCO and Reference trailing edges both happen middle at the same time instance tk ; τk mod Tref = 0, τk+1 < 0 at the same time instance tk; τk = 0, τk+1 < 0

Fig. 31: Subcases of the Case 2. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in black/white). The integral is equal to 1 according to the PFD switching law and definition of time intervals. 20

Ref Ref

VCO VCO

I I PFD p PFD p 0 i(t) 0 i(t) -I -Ip p

IpKvcolk IpKvcolk C C

time time 0

(a) Case 3 1: general case, VCO cycle slipping; τk < (b) Case 3 2: all VCO and Reference trailing edges happen at 0, τk+1 < 0 different time instances; τk < 0, τk+1 < 0

Ref Ref VCO VCO I PFD p 0 I i(t) PFD p -I 0 p i(t) -Ip

I K l p vco k I K l C p vco k C

time 0 0

(c) Case 3 3: VCO and Reference trailing edges both happen (d) Case 3 4: VCO and Reference trailing edges both happen middle at the same time instance tk ; τk < 0, τk+1 < 0 at the same time instance tk+1; τk < 0, τk+1 = 0

Fig. 32: Subcases of the Case 3. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in black/white). The integral is equal to 1 according to the PFD switching law and definition of time intervals. 21

Ref Ref VCO VCO Ip PFD 0 I p -I PFD 0 p

-Ip

time time 0 0 (b) Case 4 2: Reference cycle slipping; Refer all VCO and (a) Case 4 1: general case, VCO and Reference cycle slipping; Reference trailing edges happen at different time instances; τk < 0, τk+1 > 0 τk < 0, τk+1 > 0

Ref

VCO

Ip PFD 0

-Ip

time 0

(c) Case 4 3: VCO and Reference trailing edges both happen middle at the same time instance tk ; τk < 0, τk+1 > 0

Fig. 33: Subcases of the Case 4. Integral of the VCO frequency ωvco over the VCO period Tvco is pink subgraph area (grey in black/white). The integral is equal to 1 according to the PFD switching law and definition of time intervals.