On 06/11/2010 10:06 AM, Keith M wrote:
Can you please give me an approximate idea of how you
did this? Did
you have a counter, then constantly adjust the output based on the
time of arriving pulses?
Yes. a variable for the period (inverse of frequency), and a counter
for the phase. At each iteration the period is added to the phase
counter. The phase counter is used to identify the windows for the
pulses. When the leading edge of a pulse is detected, the amount of
time before or after the nominal location in which the pulse is expected
is the phase error. (Note that the absence of a pulse is not considered
to have a phase error of zero.) For a second-order DPLL, the phase
error is filtered to adjust both the period and the phase; the transfer
functions of the filter are the critical adjustments.
I had two coefficients I called alpha and beta. These were just my
names for them; there are probably official names for them in control
theory, but I haven't looked into what they would be. What I did was:
period := period + alpha * phase_error;
phase := phase + beta * phase_error;
Both alpha and beta should be very small, e.g., under 0.01. For a
first-order DPLL, beta would be zero. Non-zero beta provides for better
tracking of instantaneous phase changes, but if it is too high, causes
the jitter to have more effect on the period.
Using control theory it is possible to do an analysis of the performance
of the DPLL, but that seemed like too much work to me, so I just
experimented with the parameters manually.
Eric