Reply by Vladimir Vassilevsky●January 28, 20082008-01-28
Tim Wescott wrote:
> On Sun, 27 Jan 2008 10:24:20 -0600, Vladimir Vassilevsky wrote:
>>Tim Wescott wrote:
>>>On Sat, 26 Jan 2008 13:25:51 -0600, Vladimir Vassilevsky wrote:
>>>
>>>>There is a software PLL with a hardware phase detector. The phase
>>>>detector is done in that way so it outputs the phase difference (+/-
>>>>Pi) and the absolute frequency difference at the same time. What could
>>>>be the best use for the phase and the frequency information in the PLL
>>>>? It is desired to have the guaranteed PLL pull in with the minimal
>>>>wander in the locked state.
>>>>
>>>>I could think of the following methods:
>>>>
>>>>1. Make a classic PID loop. Consider the frequency as 'D' term.
>>>>
>>>>2. Use the frequency information to account for the phase rollovers.
>>>>I.e. implement the state machine phase frequency detector.
>>>>
>>>>3. Integrate the frequency with the "leaky integrator", i.e. LPF. Add
>>>>the integrated frequency information to the phase.
>>>>
>>>>I tried all three ideas. The problem is that all of those methods
>>>>worked about as well indeed :)
>>>>What do you think should be the best approach?
>>>>
>>>>
>>>
>>>If you can be sure to catch the phase rollovers then use method 2 and
>>>ignore the frequency measure -- I've done this with great success using
>>>timers on microcontrollers, but you have to be sampling fast enough
>>>compared to your biggest frequency difference to unambiguously catch
>>>the rollover.
>>
>>
>>>Otherwise I suspect you're stuck with a modal PLL: use a capture mode
>>>that implements a PI loop on the frequency output alone, then when
>>>you've either detected capture or some fixed maximum-time-to-lock
>>>period has passed switch to using the phase detector.
>>>
>>>
>>
>>Since the phase and the frequency are directly related (with the
>>omission of an arbitrary constant), no new information is gained from
>>using them both. Ideally, no extra noise should be added also. So the
>>question is mainly about what could be the best practical algorithm.
>>
>>The whole point of #2 is in using the frequency information to detect
>>the phase rollovers regardless of sampling. Assuming the frequency
>>difference is relatively constant, you can count how many loops did the
>>phase since the last sample. This reduces the requirement for the
>>sampling rate. However it results in rather messy algorithm with
>>branching.
>>
>>I am inclined towards #3 since it makes the straightforward and linear
>>algorithm, and I don't see any pitfalls.
>
>
> I wasn't thinking #3 through well enough, it could be just what you need,
> although the "leaky integrator" will take a while to settle, during which
> your phase will have an offset.
Precisely.
> You'll also have some maximum pull-in
> range beyond which you cannot operate because the output of your leaky
> integrator will top out.
This is not a problem, since this output is added to the phase and
applied to the PI loop.
> You way find that a modal loop, while technically less elegant, will
> settle faster and be easier to tweak for performance -- but that depends
> on your application.
I played with #3 for some time. It works fine, however it has the
inherent tradeoff between the acquisition of the frequency and the
acquisition of the phase. If the one is fast, the other one will be slow.
Finally, I ended up with the combination of the two separate loops with
the different parameters locked by the frequency and by the phase. If
the frequency difference is small enough to avoid the aliasing of the
phase, then the phase loop is working. Otherwise the frequency loop is
on. The memories are transferred between the loops when the loops are
switched.
That resulted in the very fast acquisition and the very messy algorithm.
Fortunately, there is no need to sample fast since the aliasing of the
phase was taken care off.
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Reply by Tim Wescott●January 27, 20082008-01-27
On Sun, 27 Jan 2008 10:24:20 -0600, Vladimir Vassilevsky wrote:
> Tim Wescott wrote:
>
>> On Sat, 26 Jan 2008 13:25:51 -0600, Vladimir Vassilevsky wrote:
>>
>>
>>>There is a software PLL with a hardware phase detector. The phase
>>>detector is done in that way so it outputs the phase difference (+/-
>>>Pi) and the absolute frequency difference at the same time. What could
>>>be the best use for the phase and the frequency information in the PLL
>>>? It is desired to have the guaranteed PLL pull in with the minimal
>>>wander in the locked state.
>>>
>>>I could think of the following methods:
>>>
>>>1. Make a classic PID loop. Consider the frequency as 'D' term.
>>>
>>>2. Use the frequency information to account for the phase rollovers.
>>>I.e. implement the state machine phase frequency detector.
>>>
>>>3. Integrate the frequency with the "leaky integrator", i.e. LPF. Add
>>>the integrated frequency information to the phase.
>>>
>>>I tried all three ideas. The problem is that all of those methods
>>>worked about as well indeed :)
>>>What do you think should be the best approach?
>>>
>>>
>> If you can be sure to catch the phase rollovers then use method 2 and
>> ignore the frequency measure -- I've done this with great success using
>> timers on microcontrollers, but you have to be sampling fast enough
>> compared to your biggest frequency difference to unambiguously catch
>> the rollover.
>
>
>> Otherwise I suspect you're stuck with a modal PLL: use a capture mode
>> that implements a PI loop on the frequency output alone, then when
>> you've either detected capture or some fixed maximum-time-to-lock
>> period has passed switch to using the phase detector.
>>
>>
>
> Since the phase and the frequency are directly related (with the
> omission of an arbitrary constant), no new information is gained from
> using them both. Ideally, no extra noise should be added also. So the
> question is mainly about what could be the best practical algorithm.
>
> The whole point of #2 is in using the frequency information to detect
> the phase rollovers regardless of sampling. Assuming the frequency
> difference is relatively constant, you can count how many loops did the
> phase since the last sample. This reduces the requirement for the
> sampling rate. However it results in rather messy algorithm with
> branching.
>
> I am inclined towards #3 since it makes the straightforward and linear
> algorithm, and I don't see any pitfalls.
I wasn't thinking #3 through well enough, it could be just what you need,
although the "leaky integrator" will take a while to settle, during which
your phase will have an offset. You'll also have some maximum pull-in
range beyond which you cannot operate because the output of your leaky
integrator will top out.
You way find that a modal loop, while technically less elegant, will
settle faster and be easier to tweak for performance -- but that depends
on your application.
--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com
Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by Vladimir Vassilevsky●January 27, 20082008-01-27
Tim Wescott wrote:
> On Sat, 26 Jan 2008 13:25:51 -0600, Vladimir Vassilevsky wrote:
>
>
>>There is a software PLL with a hardware phase detector. The phase
>>detector is done in that way so it outputs the phase difference (+/- Pi)
>>and the absolute frequency difference at the same time. What could be
>>the best use for the phase and the frequency information in the PLL ? It
>>is desired to have the guaranteed PLL pull in with the minimal wander in
>>the locked state.
>>
>>I could think of the following methods:
>>
>>1. Make a classic PID loop. Consider the frequency as 'D' term.
>>
>>2. Use the frequency information to account for the phase rollovers.
>>I.e. implement the state machine phase frequency detector.
>>
>>3. Integrate the frequency with the "leaky integrator", i.e. LPF. Add
>>the integrated frequency information to the phase.
>>
>>I tried all three ideas. The problem is that all of those methods worked
>>about as well indeed :)
>>What do you think should be the best approach?
>>
>
> If you can be sure to catch the phase rollovers then use method 2 and
> ignore the frequency measure -- I've done this with great success using
> timers on microcontrollers, but you have to be sampling fast enough
> compared to your biggest frequency difference to unambiguously catch the
> rollover.
Since the phase and the frequency are directly related (with the
omission of an arbitrary constant), no new information is gained from
using them both. Ideally, no extra noise should be added also. So the
question is mainly about what could be the best practical algorithm.
The whole point of #2 is in using the frequency information to detect
the phase rollovers regardless of sampling. Assuming the frequency
difference is relatively constant, you can count how many loops did the
phase since the last sample. This reduces the requirement for the
sampling rate. However it results in rather messy algorithm with branching.
I am inclined towards #3 since it makes the straightforward and linear
algorithm, and I don't see any pitfalls.
>
> Otherwise I suspect you're stuck with a modal PLL: use a capture mode
> that implements a PI loop on the frequency output alone, then when you've
> either detected capture or some fixed maximum-time-to-lock period has
> passed switch to using the phase detector.
>
On Sat, 26 Jan 2008 13:25:51 -0600, Vladimir Vassilevsky wrote:
> There is a software PLL with a hardware phase detector. The phase
> detector is done in that way so it outputs the phase difference (+/- Pi)
> and the absolute frequency difference at the same time. What could be
> the best use for the phase and the frequency information in the PLL ? It
> is desired to have the guaranteed PLL pull in with the minimal wander in
> the locked state.
>
> I could think of the following methods:
>
> 1. Make a classic PID loop. Consider the frequency as 'D' term.
>
> 2. Use the frequency information to account for the phase rollovers.
> I.e. implement the state machine phase frequency detector.
>
> 3. Integrate the frequency with the "leaky integrator", i.e. LPF. Add
> the integrated frequency information to the phase.
>
> I tried all three ideas. The problem is that all of those methods worked
> about as well indeed :)
> What do you think should be the best approach?
>
>
> Vladimir Vassilevsky
> DSP and Mixed Signal Consultant
> www.abvolt.com
If you can be sure to catch the phase rollovers then use method 2 and
ignore the frequency measure -- I've done this with great success using
timers on microcontrollers, but you have to be sampling fast enough
compared to your biggest frequency difference to unambiguously catch the
rollover.
Otherwise I suspect you're stuck with a modal PLL: use a capture mode
that implements a PI loop on the frequency output alone, then when you've
either detected capture or some fixed maximum-time-to-lock period has
passed switch to using the phase detector.
--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com
Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by Vladimir Vassilevsky●January 26, 20082008-01-26
There is a software PLL with a hardware phase detector. The phase detector
is done in that way so it outputs the phase difference (+/- Pi) and the
absolute frequency difference at the same time. What could be the best use
for the phase and the frequency information in the PLL ? It is desired to
have the guaranteed PLL pull in with the minimal wander in the locked state.
I could think of the following methods:
1. Make a classic PID loop. Consider the frequency as 'D' term.
2. Use the frequency information to account for the phase rollovers. I.e.
implement the state machine phase frequency detector.
3. Integrate the frequency with the "leaky integrator", i.e. LPF. Add the
integrated frequency information to the phase.
I tried all three ideas. The problem is that all of those methods worked
about as well indeed :)
What do you think should be the best approach?
Vladimir Vassilevsky
DSP and Mixed Signal Consultant
www.abvolt.com