Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #478801 > unrolled thread

How does a PLL work?

Started byPiotr Wyderski <peter.pan@neverland.mil>
First post2017-09-25 10:07 +0200
Last post2017-09-26 12:54 -0700
Articles 20 on this page of 70 — 16 participants

Back to article view | Back to sci.electronics.design


Contents

  How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 10:07 +0200
    Re: How does a PLL work? bill.sloman@ieee.org - 2017-09-25 01:25 -0700
    Re: How does a PLL work? Rob <nomail@example.com> - 2017-09-25 08:27 +0000
      Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 12:38 +0200
        Re: How does a PLL work? Rob <nomail@example.com> - 2017-09-25 11:31 +0000
          Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 13:53 +0200
    Re: How does a PLL work? Steve Wilson <no@spam.com> - 2017-09-25 08:46 +0000
      Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 12:50 +0200
        Re: How does a PLL work? Steve Wilson <no@spam.com> - 2017-09-25 12:28 +0000
        Re: How does a PLL work? Jan Panteltje <pNa0nStpealmtje@yahoo.com> - 2017-09-25 15:43 +0000
    Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 09:35 -0400
      Re: How does a PLL work? Steve Wilson <no@spam.com> - 2017-09-25 13:56 +0000
        Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 11:45 -0400
      Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 15:59 +0200
        Re: How does a PLL work? Steve Wilson <no@spam.com> - 2017-09-25 14:15 +0000
          Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-25 16:38 +0200
            Re: How does a PLL work? Steve Wilson <no@spam.com> - 2017-09-25 14:53 +0000
            Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 12:24 -0400
              Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 00:14 +0200
                Re: How does a PLL work? pcdhobbs@gmail.com - 2017-09-25 16:16 -0700
                  Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 09:44 +0200
                    Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-26 13:55 -0400
                      Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 23:13 +0200
                        Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-28 00:28 +0200
                          Re: How does a PLL work? George Herold <gherold@teachspin.com> - 2017-09-27 17:39 -0700
                          Re: How does a PLL work? Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2017-09-28 07:42 +0000
                            Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-28 10:17 +0200
                              Re: How does a PLL work? Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2017-09-28 12:52 +0000
                                Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-28 16:21 +0200
                                  Re: How does a PLL work? Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2017-09-28 15:22 +0000
                                    Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-28 12:29 -0700
                                      Re: How does a PLL work? whit3rd <whit3rd@gmail.com> - 2017-09-28 13:27 -0700
                Re: How does a PLL work? kevin93 <kevin@whitedigs.com> - 2017-09-25 16:43 -0700
                  Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 10:10 +0200
        Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 10:25 -0400
          Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 10:29 -0400
        Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 12:09 -0400
      Re: How does a PLL work? John Larkin <jjlarkin@highlandtechnology.com> - 2017-09-25 09:12 -0700
        Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 12:30 -0400
          Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 12:36 -0400
            Re: How does a PLL work? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-09-25 21:18 +0300
              Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 15:14 -0400
                Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-25 12:39 -0700
                  Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 16:07 -0400
                Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 17:28 -0400
                  Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 00:34 +0200
                  Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 19:52 -0400
                    Re: How does a PLL work? pcdhobbs@gmail.com - 2017-09-25 17:39 -0700
            Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 17:16 -0400
              Re: How does a PLL work? Jan Panteltje <pNa0nStpealmtje@yahoo.com> - 2017-09-26 08:02 +0000
            Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 01:01 +0200
              Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 19:54 -0400
                Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 11:52 +0200
        Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 12:30 -0400
          Re: How does a PLL work? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-25 12:32 -0400
            Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 13:48 -0400
              Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 13:55 -0400
                Re: How does a PLL work? John Larkin <jjlarkin@highland_snip_technology.com> - 2017-09-25 11:39 -0700
          Re: How does a PLL work? John Larkin <jjlarkin@highland_snip_technology.com> - 2017-09-25 11:37 -0700
    Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 10:06 -0400
      Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-26 00:04 +0200
        Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-26 12:30 -0400
          Re: How does a PLL work? Piotr Wyderski <peter.pan@neverland.mil> - 2017-09-27 00:01 +0200
    Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-25 12:00 -0700
      Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-25 15:39 -0400
        Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-25 12:45 -0700
    Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-26 11:19 -0700
      Re: How does a PLL work? bitrex <bitrex@de.lete.earthlink.net> - 2017-09-26 15:09 -0400
        Re: How does a PLL work? Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> - 2017-09-26 12:48 -0700
        Re: How does a PLL work? George Herold <gherold@teachspin.com> - 2017-09-26 12:54 -0700

Page 1 of 4  [1] 2 3 4  Next page →


#478801 — How does a PLL work?

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 10:07 +0200
SubjectHow does a PLL work?
Message-ID<oqadf8$g1b$1@node1.news.atman.pl>
But I mean, really. The usually presented theory is crystal-clear:
There is a phase detector which produces voltage proportional to
phase difference of the input signals, which is then filtered and
feed back to a VCO and the loop is closed.

I am trying to implement a software PLL and my simulations show
the above is not true. For zero phase difference the phase error
voltage is also zero, so it would require a VCO/filter with
infinite memory, otherwise the VCO would return to its free-running
frequency. It can be done in digital, but in the case of any
analog VCO the control voltage *sets* the frequency, not *adjusts*
it by a given amount. Therefore such a PLL requires a non-zero
phase error to stay in lock, it is just "error-shaping" that
keeps both frequencies in sync. This is done by sub-cycle
inflation/deflation of the VCO waveform, i.e. by distorting
the VCO signal. The high-freq part then integrates out to 0
and the low-freq part is what keeps the loop in lock.

This is how a free-running 50Hz PLL with a multiplying detector
locks to 55Hz input (one second simulation):

https://s26.postimg.org/7jcgkmyg9/pll1.png

and several output cycles magnified:

https://s26.postimg.org/m6df2ax2h/pll2.png

Blue/orange is the quardrature VCO, green is the input,
red is the correcting voltage. The loop is in a perfect
lock, the red waveform is sufficiently below 0 in order
to make it happen, but the red oscillations is exactly
what makes it work and *should not* be excessively
filtered. This conclusion is again backed up by simulation:
for a given cutoff frequency increasing the filter order
makes the loop harder to stabilize and for a 3rd order
RC filter with 1.5Hz cutoff I am unable to adjust the
gain to make it lock. If the order increases, it must
be compensated by the increase of the cutoff frequency.

If I am right then why all the books I know simply lie? :-)

	Best regards, Piotr

[toc] | [next] | [standalone]


#478806

Frombill.sloman@ieee.org
Date2017-09-25 01:25 -0700
Message-ID<82b7218b-1069-48d2-bb27-f047b2c5b67e@googlegroups.com>
In reply to#478801
On Monday, September 25, 2017 at 6:07:07 PM UTC+10, Piotr Wyderski wrote:
> But I mean, really. The usually presented theory is crystal-clear:
> There is a phase detector which produces voltage proportional to
> phase difference of the input signals, which is then filtered and
> feed back to a VCO and the loop is closed.
> 
> I am trying to implement a software PLL and my simulations show
> the above is not true. For zero phase difference the phase error
> voltage is also zero, so it would require a VCO/filter with
> infinite memory, otherwise the VCO would return to its free-running
> frequency. 

<snip>

Floyd M. Gardener "Phaselock techniques" ISBN 0-471-04294-3

The low pass filter between the phase detector and the VCO has enough memory to do the job. With a first order filter it's trivial to amke it work, but even a second order filter adds enough extra phase lag around the feedback loop, when combined with the fact that the VCO integrates the phase error, to create a stability problem, as is discussed at some length by Floyd Gardner, along with the solutions.

-- 
Bill Sloman, Sydney

[toc] | [prev] | [next] | [standalone]


#478809

FromRob <nomail@example.com>
Date2017-09-25 08:27 +0000
Message-ID<slrnoshfge.t75.nomail@xs9.xs4all.nl>
In reply to#478801
Piotr Wyderski <peter.pan@neverland.mil> wrote:
> But I mean, really. The usually presented theory is crystal-clear:
> There is a phase detector which produces voltage proportional to
> phase difference of the input signals, which is then filtered and
> feed back to a VCO and the loop is closed.
>
> I am trying to implement a software PLL and my simulations show
> the above is not true. For zero phase difference the phase error
> voltage is also zero, so it would require a VCO/filter with
> infinite memory, otherwise the VCO would return to its free-running
> frequency. It can be done in digital, but in the case of any
> analog VCO the control voltage *sets* the frequency, not *adjusts*
> it by a given amount. Therefore such a PLL requires a non-zero
> phase error to stay in lock, it is just "error-shaping" that
> keeps both frequencies in sync. This is done by sub-cycle
> inflation/deflation of the VCO waveform, i.e. by distorting
> the VCO signal. The high-freq part then integrates out to 0
> and the low-freq part is what keeps the loop in lock.
>
> This is how a free-running 50Hz PLL with a multiplying detector
> locks to 55Hz input (one second simulation):
>
> https://s26.postimg.org/7jcgkmyg9/pll1.png
>
> and several output cycles magnified:
>
> https://s26.postimg.org/m6df2ax2h/pll2.png
>
> Blue/orange is the quardrature VCO, green is the input,
> red is the correcting voltage. The loop is in a perfect
> lock, the red waveform is sufficiently below 0 in order
> to make it happen, but the red oscillations is exactly
> what makes it work and *should not* be excessively
> filtered. This conclusion is again backed up by simulation:
> for a given cutoff frequency increasing the filter order
> makes the loop harder to stabilize and for a 3rd order
> RC filter with 1.5Hz cutoff I am unable to adjust the
> gain to make it lock. If the order increases, it must
> be compensated by the increase of the cutoff frequency.
>
> If I am right then why all the books I know simply lie? :-)
>
> 	Best regards, Piotr

No it is correct, books that only write what you cite in the first
paragraph are merely explaining the general principle and do not
go down to the detail that you encounter when really implementing it.
That does not make them lying, they just aren't complete.

Check the theory of a PID loop as well.

[toc] | [prev] | [next] | [standalone]


#478823

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 12:38 +0200
Message-ID<oqambd$lts$1@node2.news.atman.pl>
In reply to#478809
Rob wrote:

> No it is correct, books that only write what you cite in the first
> paragraph are merely explaining the general principle and do not
> go down to the detail that you encounter when really implementing it.

I don't want to sound pompous, but I dare to think that many/most of
the authors are just copy-pasting their predecessors and have no clue
what *really* happens under the hood. In the case of the multiplying
detector the second harmonic is not a nuisance, an artifact of basic
trigonometry, but actually the thing which makes it work.

> That does not make them lying, they just aren't complete.

Definitely a more diplomatic way to say that, but whatever you
call them, they are misleading to the point which renders the
implementation of a correctly locking loop impossible, if you
follow the book too closely. I've lost a day trying to figure
out why my "properly" designed loop goes mad, but manual tweaking
makes it super-stable.

 > Check the theory of a PID loop as well.

I think I would need to go there some day, because in the digital
domain it seems to be much more natural to control the increments
instead of the magnitude of some variable.

	Best regards, Piotr

[toc] | [prev] | [next] | [standalone]


#478825

FromRob <nomail@example.com>
Date2017-09-25 11:31 +0000
Message-ID<slrnoshq97.p97.nomail@xs9.xs4all.nl>
In reply to#478823
Piotr Wyderski <peter.pan@neverland.mil> wrote:
>> That does not make them lying, they just aren't complete.
>
> Definitely a more diplomatic way to say that, but whatever you
> call them, they are misleading to the point which renders the
> implementation of a correctly locking loop impossible, if you
> follow the book too closely. I've lost a day trying to figure
> out why my "properly" designed loop goes mad, but manual tweaking
> makes it super-stable.

Like you, I have experienced this myself when I built a frequency
synthesizer (VCO/divider/reference oscillator/phase detector) way
back in the seventies, and I thought I could reduce the spurs by
"improving" the loopfilter (relative to the example I found in a magazine).

Indeed, that did not work.

[toc] | [prev] | [next] | [standalone]


#478826

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 13:53 +0200
Message-ID<oqaqoa$tis$1@node1.news.atman.pl>
In reply to#478825
Rob wrote:

> Indeed, that did not work.

Thanks a lot for your confirmation that I am on the correct track, Rob!

	Best regards, Piotr


[toc] | [prev] | [next] | [standalone]


#478813

FromSteve Wilson <no@spam.com>
Date2017-09-25 08:46 +0000
Message-ID<XnsA7FB3087EC711idtokenpost@69.16.179.23>
In reply to#478801
Piotr Wyderski <peter.pan@neverland.mil> wrote:

> But I mean, really. The usually presented theory is crystal-clear:
> There is a phase detector which produces voltage proportional to
> phase difference of the input signals, which is then filtered and
> feed back to a VCO and the loop is closed.
 
> I am trying to implement a software PLL and my simulations show
> the above is not true. For zero phase difference the phase error
> voltage is also zero, so it would require a VCO/filter with
> infinite memory, otherwise the VCO would return to its free-running
> frequency. It can be done in digital, but in the case of any
> analog VCO the control voltage *sets* the frequency, not *adjusts*
> it by a given amount. Therefore such a PLL requires a non-zero
> phase error to stay in lock, it is just "error-shaping" that
> keeps both frequencies in sync. This is done by sub-cycle
> inflation/deflation of the VCO waveform, i.e. by distorting
> the VCO signal. The high-freq part then integrates out to 0
> and the low-freq part is what keeps the loop in lock.
 
> This is how a free-running 50Hz PLL with a multiplying detector
> locks to 55Hz input (one second simulation):
 
> https://s26.postimg.org/7jcgkmyg9/pll1.png
 
> and several output cycles magnified:
 
> https://s26.postimg.org/m6df2ax2h/pll2.png
 
> Blue/orange is the quardrature VCO, green is the input,
> red is the correcting voltage. The loop is in a perfect
> lock, the red waveform is sufficiently below 0 in order
> to make it happen, but the red oscillations is exactly
> what makes it work and *should not* be excessively
> filtered. This conclusion is again backed up by simulation:
> for a given cutoff frequency increasing the filter order
> makes the loop harder to stabilize and for a 3rd order
> RC filter with 1.5Hz cutoff I am unable to adjust the
> gain to make it lock. If the order increases, it must
> be compensated by the increase of the cutoff frequency.
 
> If I am right then why all the books I know simply lie? :-)
 
>      Best regards, Piotr

Quadrature phase detectors can lock at non-integer ratios. You need a 
frequency-phase detector to lock on the fundamental. 

[toc] | [prev] | [next] | [standalone]


#478824

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 12:50 +0200
Message-ID<oqan1j$mhp$1@node2.news.atman.pl>
In reply to#478813
Steve Wilson wrote:

> Quadrature phase detectors can lock at non-integer ratios.

Isn't it just a matter of the pulling range, i.e. be a problem
only in the case of wideband loops? If the VCO bandwidth is narrow,
then it simply cannot reach the stable non-integer ratio.
In my case f_c+/-10% is perfectly fine, but the exact phase
tracking is the key figure.

> You need a frequency-phase detector to lock on the fundamental.

The ones I am aware of are edge-sensitive, so for a low-frequency
loop:

1. How would you get the input signal edge in the first place?
A comparator with a preset level? No, very amplitude-dependent.
Zero crossing detector? A tiny amount of noise will derail it.

2. There are too few edges per second at 50Hz, so the convergence
will be sloooow.

The multiplier is a real-time (approximate) phase detector, you
don't need to complete a full cycle to get meaningful results.
Do you know a practical PFD with comparably low latency?

	Best regards, Piotr

[toc] | [prev] | [next] | [standalone]


#478828

FromSteve Wilson <no@spam.com>
Date2017-09-25 12:28 +0000
Message-ID<XnsA7FB562EA1514idtokenpost@69.16.179.22>
In reply to#478824
Piotr Wyderski <peter.pan@neverland.mil> wrote:

> Steve Wilson wrote:
 
>> Quadrature phase detectors can lock at non-integer ratios.
 
> Isn't it just a matter of the pulling range, i.e. be a problem
> only in the case of wideband loops? If the VCO bandwidth is narrow,
> then it simply cannot reach the stable non-integer ratio.
> In my case f_c+/-10% is perfectly fine, but the exact phase
> tracking is the key figure.

PFD gives exact phase tracking with no non-integer lock ratios, locks only 
to the fundamental.
 
>> You need a frequency-phase detector to lock on the fundamental.
 
> The ones I am aware of are edge-sensitive, so for a low-frequency
> loop:
 
> 1. How would you get the input signal edge in the first place?
> A comparator with a preset level? No, very amplitude-dependent.
> Zero crossing detector? A tiny amount of noise will derail it.

Zero cross. The loop filter will take care of the noise.
 
> 2. There are too few edges per second at 50Hz, so the convergence
> will be sloooow.
 
Depends on the loop bandwidth.

> The multiplier is a real-time (approximate) phase detector, you
> don't need to complete a full cycle to get meaningful results.
> Do you know a practical PFD with comparably low latency?
 
>      Best regards, Piotr

The results are not meaningful when the loop is out of lock. You are not 
going to get meanginful results on a partial cycle.

You can start the vco in phase with the incoming signal. In either case, 
XOR or PFD, the lock time depends on the loop bandwidth. You then set a 
limit to the allowable phase error and wait until it gets there. If it's 
not fast enough, increase the limit or the loop bandwidth. The latter will 
increase the loop jitter.

[toc] | [prev] | [next] | [standalone]


#478844

FromJan Panteltje <pNa0nStpealmtje@yahoo.com>
Date2017-09-25 15:43 +0000
Message-ID<oqb86i$1m03$1@gioia.aioe.org>
In reply to#478824
On a sunny day (Mon, 25 Sep 2017 12:50:27 +0200) it happened Piotr Wyderski
<peter.pan@neverland.mil> wrote in <oqan1j$mhp$1@node2.news.atman.pl>:

>Steve Wilson wrote:
>
>> Quadrature phase detectors can lock at non-integer ratios.
>
>Isn't it just a matter of the pulling range, i.e. be a problem
>only in the case of wideband loops? If the VCO bandwidth is narrow,
>then it simply cannot reach the stable non-integer ratio.
>In my case f_c+/-10% is perfectly fine, but the exact phase
>tracking is the key figure.

Exactly, well know every household case was the NTSC (or PAL) color subcarrier PLL (in every TV),
usually a crystal that can be tuned by a varicap over only a small range by the color burst.
No way will it ever lock on some 'harmonic'.

[toc] | [prev] | [next] | [standalone]


#478831

FromPhil Hobbs <pcdhSpamMeSenseless@electrooptical.net>
Date2017-09-25 09:35 -0400
Message-ID<Xbydneiym9W1m1TEnZ2dnUU7-a_NnZ2d@supernews.com>
In reply to#478801
On 09/25/2017 04:07 AM, Piotr Wyderski wrote:
> But I mean, really. The usually presented theory is crystal-clear:
> There is a phase detector which produces voltage proportional to
> phase difference of the input signals, which is then filtered and
> feed back to a VCO and the loop is closed.

You're describing a _first_order_ PLL.  Those lock up in 1 cycle, on the
plus side, but on the minus side they have a lot of comparison frequency
ripple and exhibit a phase error proportional to the difference between
the reference frequency and the oscillator's free-running frequency.

But practically nobody uses those.

Normally you do one of two things: for low performance, use a
frequency/phase detector with a tri-state output, such as PD 2 of a
74HC4046, or use an op amp integrator with a lead-lag characteristic.

Your average op amp has a DC gain of 90-140 dB, so that the static phase
error goes away, at least down to the level set by the offset voltages
of the op amp and phase detector.

A PLL measures phase and sets frequency, so it's intrinsically
integrating.  That means that (without a loop filter) its open-loop
transfer function has one pole at zero, and -90 degree phase everywhere.

If you add another integrator, the phase is near -180 degrees, and the
loop will oscillate.  One simple way to frequency-compensate a PLL is,
first, to calculate the frequency where the two-integrator transfer
function crosses 0 dB:

w_0 = 2 pi f_0 = sqrt(K_vco K_phi/(RC)),

where K_vco is the VCO control gain in rad/s/V, K_phi is the phase
detector gain in V/rad, and RC is the time constant of the integrator
(i.e. R_in * C_f).

Then you put a resistor R_z in series with the feedback capacitor,
forming a time constant C_f * R_z = 1/w_0.

That'll give you about a 52 degree phase margin, which is a good
starting number.

> 
> I am trying to implement a software PLL and my simulations show
> the above is not true. For zero phase difference the phase error
> voltage is also zero, so it would require a VCO/filter with
> infinite memory, otherwise the VCO would return to its free-running
> frequency. It can be done in digital, but in the case of any
> analog VCO the control voltage *sets* the frequency, not *adjusts*
> it by a given amount. Therefore such a PLL requires a non-zero
> phase error to stay in lock, it is just "error-shaping" that
> keeps both frequencies in sync. This is done by sub-cycle
> inflation/deflation of the VCO waveform, i.e. by distorting
> the VCO signal. The high-freq part then integrates out to 0
> and the low-freq part is what keeps the loop in lock.
> 
> This is how a free-running 50Hz PLL with a multiplying detector
> locks to 55Hz input (one second simulation):
> 
> https://s26.postimg.org/7jcgkmyg9/pll1.png
> 
> and several output cycles magnified:
> 
> https://s26.postimg.org/m6df2ax2h/pll2.png
> 
> Blue/orange is the quardrature VCO, green is the input,
> red is the correcting voltage. The loop is in a perfect
> lock, the red waveform is sufficiently below 0 in order
> to make it happen, but the red oscillations is exactly
> what makes it work and *should not* be excessively
> filtered. This conclusion is again backed up by simulation:
> for a given cutoff frequency increasing the filter order
> makes the loop harder to stabilize and for a 3rd order
> RC filter with 1.5Hz cutoff I am unable to adjust the
> gain to make it lock. If the order increases, it must
> be compensated by the increase of the cutoff frequency.
> 
> If I am right then why all the books I know simply lie? :-)
> 
>     Best regards, Piotr

The math isn't difficult.  You'd probably like Floyd Gardner's classic
"Phaselock Techniques", which has all of that stuff, written by one of
the pioneers.  (I usually find that the best books are written by the
people who invented the technique, because in order to do that they had
to have a simple idea of it.)

Cheers

Phil Hobbs


-- 
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510

hobbs at electrooptical dot net
http://electrooptical.net

[toc] | [prev] | [next] | [standalone]


#478835

FromSteve Wilson <no@spam.com>
Date2017-09-25 13:56 +0000
Message-ID<XnsA7FB651F05685idtokenpost@69.16.179.22>
In reply to#478831
Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> wrote:

> The math isn't difficult.  You'd probably like Floyd Gardner's classic
> "Phaselock Techniques", which has all of that stuff, written by one of
> the pioneers.  (I usually find that the best books are written by the
> people who invented the technique, because in order to do that they had
> to have a simple idea of it.)
 
> Cheers
 
> Phil Hobbs
 
Nice analysis. You forgot the XOR can lock on non-integer ratios and 
deadband in the 4046. Easy to fix if you do your own PFD. DC offset to get 
away from deadband is not allowed.

For the filter, I prefer the following driven by a current source:

        -------------
             |
             |
            ---
            ---
             |
             |------------- TP1
             |          |
             |          /
            ---         \
            ---         /
             |          \
             |          |
            GND         GND
            
TP1 gives you the phase error during lock. You can see ringing and 
overshoot. This is important in octave-bandwidth loops.

[toc] | [prev] | [next] | [standalone]


#478845

FromPhil Hobbs <pcdhSpamMeSenseless@electrooptical.net>
Date2017-09-25 11:45 -0400
Message-ID<xvednfrw-p4TuVTEnZ2dnUU7-InNnZ2d@supernews.com>
In reply to#478835
On 09/25/2017 09:56 AM, Steve Wilson wrote:
> Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> wrote:
> 
>> The math isn't difficult.  You'd probably like Floyd Gardner's classic
>> "Phaselock Techniques", which has all of that stuff, written by one of
>> the pioneers.  (I usually find that the best books are written by the
>> people who invented the technique, because in order to do that they had
>> to have a simple idea of it.)
>  
>> Cheers
>  
>> Phil Hobbs
>  
> Nice analysis. You forgot the XOR can lock on non-integer ratios and 
> deadband in the 4046. Easy to fix if you do your own PFD. DC offset to get 
> away from deadband is not allowed.

Well, I didn't mention the XOR. ;)  The deadband on the 4046 (and the
_horrible_ oscillator nonlinearity on all the HC versions from all
vendors, including the "improved" ones like the 7046, is a topic that
I've ranted on here several times in years past.  The deadband is only a
couple of nanoseconds wide, so usually a 1-M resistor to ground will
pull the loop's operating point far enough to avoid it, without
introducing gross amounts of reference frequency ripple.

The Motorola approach uses two separate outputs for up and down.
They're chosen so they overlap slightly near zero degrees rather than
disappearing like the 4046's single output.

That means that you have two intervals of a few nanoseconds where the
sensitivity is halved, as one pulse disappears while the other gets
wider. Crucially, however, that interval isn't where the loop actually
servos, so it doesn't produce hunting as in the 4046.  Way BITD
(1981ish) I used an MC14152 synthesizer chip that worked like that.

I think JT's MC4044 works like that too.  (It has a separate charge
pump, which I've never used)

> 
> For the filter, I prefer the following driven by a current source:
> 
>         -------------
>              |
>              |
>             ---
>             ---
>              |
>              |------------- TP1
>              |          |
>              |          /
>             ---         \
>             ---         /
>              |          \
>              |          |
>             GND         GND
>             
> TP1 gives you the phase error during lock. You can see ringing and 
> overshoot. This is important in octave-bandwidth loops.

Yup.  I often use /4 Johnson counters in PLLs so that I can have a cheap
lock indication.  I'm not a huge fan of the phase pulses output of the 4046.

I mostly use PLLs in one-offs, and most of them use diode bridges for
phase detectors because they're quiet.  For actual production
instruments it's frequently cheaper to do other things.

A 1:1 PLL can do a wonderful job of cleaning up a spur-infested mess
arising from direct synthesis and frequency multiplication.

But the OP is trying to do it in software. ;)

Cheers

Phil Hobbs

-- 
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510

hobbs at electrooptical dot net
http://electrooptical.net

[toc] | [prev] | [next] | [standalone]


#478836

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 15:59 +0200
Message-ID<oqb24d$11i$1@node2.news.atman.pl>
In reply to#478831
Phil Hobbs wrote:

> or use an op amp integrator with a lead-lag characteristic.

I understand the edge-sensitive PFD with a charge pump. It is
basically a counter incremented/decremented accordingly to the
FSM state, which content can be directly transformed into phase
error. But you've lost me here: and integrate what? And what should
I do with the result?

> The math isn't difficult.

Indeed, but the typically presented model is misleading. I'd
say the first order PLL is in fact a distortion-locked loop
and excessive filtering is the last thing you want. But the
internet books/courses don't say that...

> You'd probably like Floyd Gardner's classic "Phaselock Techniques"

Thank you, will try to get a copy.

	Best regards, Piotr

[toc] | [prev] | [next] | [standalone]


#478838

FromSteve Wilson <no@spam.com>
Date2017-09-25 14:15 +0000
Message-ID<XnsA7FB685C6C65Cidtokenpost@69.16.179.23>
In reply to#478836
Piotr Wyderski <peter.pan@neverland.mil> wrote:

> Phil Hobbs wrote:
 
>> or use an op amp integrator with a lead-lag characteristic.
 
> I understand the edge-sensitive PFD with a charge pump. It is
> basically a counter incremented/decremented accordingly to the
> FSM state, which content can be directly transformed into phase
> error.

The charge pump is not a counter. It is an integrator. The voltage change 
is proportional to the phase error.
 
>> The math isn't difficult.
 
> Indeed, but the typically presented model is misleading. I'd
> say the first order PLL is in fact a distortion-locked loop
> and excessive filtering is the last thing you want. But the
> internet books/courses don't say that...
 
>> You'd probably like Floyd Gardner's classic "Phaselock Techniques"
 
> Thank you, will try to get a copy.
 
>      Best regards, Piotr

You are going to confuse yourself. Gardner is not going to help you much. 

Get LTspice and study some loops using XOR and PFD. The math can help you 
find the filter component values. LTspice will show you how the loop works.

[toc] | [prev] | [next] | [standalone]


#478841

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-25 16:38 +0200
Message-ID<oqb4cs$7qn$1@node1.news.atman.pl>
In reply to#478838
Steve Wilson wrote:

> The charge pump is not a counter. It is an integrator.

Conceptually they are the same. There is no difference in 
charging/discharging a capacitor from two opposite current
sources and incrementing/decrementing a counter by a unit
step based on the edge lead/lag between two signals. If
done sufficiently fast, both results converge.

	Best regards, Piotr

[toc] | [prev] | [next] | [standalone]


#478842

FromSteve Wilson <no@spam.com>
Date2017-09-25 14:53 +0000
Message-ID<XnsA7FB6ED75DB55idtokenpost@69.16.179.23>
In reply to#478841
Piotr Wyderski <peter.pan@neverland.mil> wrote:

> Steve Wilson wrote:
 
>> The charge pump is not a counter. It is an integrator.
 
> Conceptually they are the same. There is no difference in 
> charging/discharging a capacitor from two opposite current
> sources and incrementing/decrementing a counter by a unit
> step based on the edge lead/lag between two signals. If
> done sufficiently fast, both results converge.
 
>      Best regards, Piotr

Incrementing a counter is a bang-bang loop. You are constrained by the 
resolution of the counter. That also determines the phase error at lock. The 
best you can do is +/- one LSB.

That is completely different from integrating a current pulse. The best you 
can do is zero.

These are two completely different loops.

[toc] | [prev] | [next] | [standalone]


#478850

FromPhil Hobbs <pcdhSpamMeSenseless@electrooptical.net>
Date2017-09-25 12:24 -0400
Message-ID<yYqdnSGUx-lQsFTEnZ2dnUU7-RGdnZ2d@supernews.com>
In reply to#478841
On 09/25/2017 10:38 AM, Piotr Wyderski wrote:
> Steve Wilson wrote:
> 
>> The charge pump is not a counter. It is an integrator.
> 
> Conceptually they are the same. There is no difference in
> charging/discharging a capacitor from two opposite current
> sources and incrementing/decrementing a counter by a unit
> step based on the edge lead/lag between two signals. If
> done sufficiently fast, both results converge.
> 
>     Best regards, Piotr

The vital difference is that the response of the integrator is
proportional to the amplitude of the input.  Small input -> small output
slope.  Big input -> big slope.

Counters have a fixed slope for a fixed update rate.  An integrator is
like a multiply-and-accumulate stage, i.e. a 1-pole IIR lowpass.

Cheers

Phil Hobbs

-- 
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510

hobbs at electrooptical dot net
http://electrooptical.net

[toc] | [prev] | [next] | [standalone]


#478895

FromPiotr Wyderski <peter.pan@neverland.mil>
Date2017-09-26 00:14 +0200
Message-ID<oqbv4d$rul$1@node2.news.atman.pl>
In reply to#478850
Phil Hobbs wrote:

> The vital difference is that the response of the integrator is
> proportional to the amplitude of the input.  Small input -> small output
> slope.  Big input -> big slope.
> 
> Counters have a fixed slope for a fixed update rate.  An integrator is
> like a multiply-and-accumulate stage, i.e. a 1-pole IIR lowpass.

That remark is perfectly valid, but in the context of this kind of PFDs:

https://i.stack.imgur.com/HPbAo.gif

there are no big and small inputs, just three possibilities: inject
the unit charge to the capacitor (a function of the charge pump
current and the time quantum implied by the clock), withdraw a 
comparable charge or retain the collected charge. And that reduces
to an analog quantized step integrator/preferably digital counter. Am I 
wrong?

	Best regards, Piotr

[toc] | [prev] | [next] | [standalone]


#478904

Frompcdhobbs@gmail.com
Date2017-09-25 16:16 -0700
Message-ID<48e572c2-3c0c-4e02-86c8-6a1be77a508a@googlegroups.com>
In reply to#478895
>there are no big and small inputs, just three possibilities: inject 
>the unit charge to the capacitor (a function of the charge pump 
>current and the time quantum implied by the clock), withdraw a 
>comparable charge or retain the collected charge. And that reduces 
>to an analog quantized step integrator/preferably digital counter. Am I 
wrong?

The problem is using a PD like that in an unfiltered first-order loop. You'll have a gigantic deadband that the loop will hunt around in. Since you're using software, why is it hard to add a few more bits and use a proper digital filter? 

Cheers

Phil Hobbs

[toc] | [prev] | [next] | [standalone]


Page 1 of 4  [1] 2 3 4  Next page →

Back to top | Article view | sci.electronics.design


csiph-web