0

I'm unable to figure out how to implement an ADPLL on an FPGA that can take in an arbitrary periodic input and lock onto its frequency (some finite range is okay) and phase. A square wave output will do.

As a first step I thought of assuming that the input is a sine wave. I know how to digitise the same using the onboard ADC. How do I proceed from here?

Any links to existing code repositories that implement all or parts of this are welcome.

  • Do you understand the standard 2FF/1Nand_Feedback_to_clear topology? What continuously-tuned VCO will you use? – analogsystemsrf Aug 29 '18 at 03:14
  • @analogsystemsrf I haven't heard of the topology, I shall look it up - is this the formal term for it? I have an NCO based implementation in mind-like I mentioned. It's an All Digitall PLL – thebionicandroid Aug 29 '18 at 05:46

1 Answers1

0

Sine waves are easy.

Obviously, your PLL comprises a phase/frequency detector, a loop filter and an oscillator. Your NCO provides I and Q outputs, which make it easy to make a phase measurement of the input signal. (Two multiplication operations)

Think of this measurement as a vector, and the main thing we're concerned with is the angle of this vector (atan2 operation). This vector will be rotating (phase increasing or decreasing from one sample to the next) if there is a frequency error; the direction of the rotation tells you whether the frequency is too high or too low. Once you get the frequency matched, you can drive the output phase to the desired relationship to the input phase.

Is this enough of a hint to get you on your way?

Dave Tweed
  • 168,369
  • 17
  • 228
  • 393
  • Thanks for the reply! So, the trend in phase change that is detected will give the frequency difference. Is that what you're trying to say? And once the frequency is matched, whatever is the constant phase that is detected is the phase difference. Correct? – thebionicandroid Aug 29 '18 at 15:24
  • I think I can implement the part in the comment above. However, this seems specific to a sine wave. Any suggestions to extend it to any arbitrary periodic input? – thebionicandroid Aug 29 '18 at 15:30
  • "Arbitrary periodic input" is tough. If you can reduce it to something that only has two zero crossings per period, then you can use a comparator to turn it into a square wave. Then, you'll have to integrate your measurements over a full period (or more) in order to get a meaningful phase value. – Dave Tweed Aug 29 '18 at 16:16