Eric Smith wrote:
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?
Eric, thanks for the detailed response.
I'm still new to many of the concepts so please bear with me.
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.
So my nominal frequency is 500khz, with my period being 2us. The actual
window is the duration in which if a pulse occurs within it, it produces
a valid raw mfm bit(aka a '1' bit)? And if no pulse is received in that
window, then we assume a '0' bit?
So then how big would my window be? 2us? The pulse produced by most
drives are around 250-350ns.
When you say at each iteration, do you mean each received pulse?
I'm working with a 50mhz system clock, so my clock ticks are at 20ns.
If we are adding the period to phase counter, then it sounds like the
phase counter would be decrementing. We want to detect the edge in the
middle of the window, so the trigger point for "window open" might be
0+(1/2 window size), with the "window closed" point being at 0-(1/2
window size) or something.
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.
Makes sense.
(Note that the absence of a pulse is not considered
to have a phase error of zero.)
I really have to do more reading on this.
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;
And so your alpha and beta just prevent a large phase error from
immediately throwing around the window. It takes many similar large
phase errors to adjust the window by the whole phase error amount.
If my period is already adjusted for the phase error, and added to the
phase counter, why are we now modifying the phase counter again with
phase error? We modify the long term period (frequency) AND make sure
that the current cycle gets the adjustment too?
Thanks
Keith