8
\$\begingroup\$

In the context of measuring a sinusoidal source with an ADC, coherent sampling (i.e. capturing an integer number of periods) allows the use of a rectangular window without spectral leakage.

How does one actually do this in practice?

I am testing a 16 bit ADC that is sampling at 5 MSPS. I set my source to 97.75 Hz to get 41 periods in \$2^{21}\$ samples. Looking at the result, I am missing about 1/8th of a period, and there is spectral leakage. Using a flattop window, the spectral leakage will be at about -95 dB, which is pretty close to where a 16 bit ADC performs. I don't think it would be good enough for something like a 20 bit ADC.

What is a practical bench setup to measure a sine source with an ADC and sample coherently?

\$\endgroup\$
3
  • \$\begingroup\$ Usually the reason you want to coherently sample (e.g. to keep clocks from drifting relative to one another) implies the way that you would implement coherent sampling (using a clock input to synchronize the clocks). It doesn't seem like this is the case here. What are you actually trying to do? \$\endgroup\$ Commented May 3, 2023 at 2:36
  • 1
    \$\begingroup\$ @user1850479 I'm trying to measure the dynamic performance of an ADC (i.e. SINAD). \$\endgroup\$
    – DavidG25
    Commented May 3, 2023 at 3:10
  • \$\begingroup\$ I am not sure you should really mean this question. The sampling that is now in fashion for measuring low frequencies like 50/60 Hz is to sync the sampler to UTC or TAI (same thing, given integer sampling frequency) and then do the math. You can do a rectangular window that contains non-whole number of samples. \$\endgroup\$ Commented May 3, 2023 at 15:06

3 Answers 3

9
\$\begingroup\$

You can use a PLL (phase-locked loop) to lock the ADC sampling frequency to the input sine signal.

The bandwidth of the PLL has to be chosen to minimize the overall system's phase jitter and drift - if the input signal changes in frequency quickly, the PLL has to have high bandwidth so it can follow these changes properly, and if the input signal is very stable, the PLL should have low bandwidth to minimize its output jitter.

With a good enough PLL (and zero-crossing detector), you can make the ADC start and stop sampling exactly during the zero-crossing of your waveform while still capturing an exact power of two of samples. The PLL will tune the phase and frequency of the ADC's clock signal accordingly.

When designing your own PLL circuitry to generate an appropriate ADC clock, you might want to consider a multi-stage approach: First a low-frequency PLL that multiplies the signal frequency with a factor of (for example) 256 to get it from the 100Hz range into the 20kHz range, then by another 256 or so to get it into the MHz range. If those multiplication factors are still too large, you could use a three-stage design instead: Three cascaded 64x stages will get you to about 26MHz, which is ideal for many ADCs.

\$\endgroup\$
8
  • \$\begingroup\$ Are PLLs available as bench instruments, or would you need to make a board that generates your ADC clock? \$\endgroup\$
    – DavidG25
    Commented May 2, 2023 at 22:28
  • \$\begingroup\$ I'm not aware of any ready-made instruments. You will probably have to design your own PCB, especially since every application is different and there's no one-size-fits-all PLL. There are a lot of PLL chips available with comprehensive guides and app notes on how to configure them. \$\endgroup\$ Commented May 2, 2023 at 22:35
  • \$\begingroup\$ Coherent sampling also works well if you have control of the source and are modulating it \$\endgroup\$
    – D Duck
    Commented May 3, 2023 at 8:12
  • 1
    \$\begingroup\$ @DavidG25 You're looking for a "digital lock-in amplifier". \$\endgroup\$
    – John Doty
    Commented May 3, 2023 at 14:59
  • 1
    \$\begingroup\$ @DavidG25 Use master clock to produce the sinusoidal signal and to clock the ADC that way there is a fixed relationship between the source and the sampling. See archive.org/details/Lock-inAmplifiersPrinciplesAndApplications/… \$\endgroup\$
    – D Duck
    Commented May 4, 2023 at 16:32
7
\$\begingroup\$

In the context of measuring a sinusoidal source with an ADC, coherent sampling (i.e. capturing an integer number of periods) allows the use of a rectangular window without spectral leakage.

Coherent sampling means that your sampling clock is derived from the same clock as your signal source. The two clocks are said to be coherent because they are phase locked.

I am testing a 16 bit ADC that is sampling at 5 MSPS. I set my source to 97.75 Hz to get 41 periods in $2^{21}$ samples. Looking at the result, I am missing about 1/8th of a cycle, and there is spectral leakage.

That is incoherent sampling since you're using an unrelated 5 MHz clock.

The error of 1/8th of a cycle corresponds to a 0.3 % error in the source or the ADC clock. Is the solution to use frequency sources with better accuracy, or manually tune the frequencies until coherent sampling is achieved?

In coherent sampling the error goes to zero as you observe over long periods since the same clock generates both the signal and sampling clock. Typically this involves a PLL or clock divider. So to generate you 97.75 Hz signal, divide down your 5 MHz clock.

\$\endgroup\$
5
  • \$\begingroup\$ Is it practical to generate a sine from a divided down clock? It seems easier to get a clock (square wave) from a sine like in @Jonathan S.'s answer. In your case you would need something like a good bandpass filter while in their case you just need a comparator. \$\endgroup\$
    – DavidG25
    Commented May 2, 2023 at 23:17
  • 1
    \$\begingroup\$ @DavidG25 Normally you would use the clock to drive a DAC if you want to make a coherent function generator. You could filter too, but that's probably harder unless you're ok with a lot of THD. \$\endgroup\$ Commented May 2, 2023 at 23:26
  • \$\begingroup\$ A search for "coherent signal generators" results in RF instruments with minimum frequencies in the MHz range. Is a custom source the only solution for testing baseband circuits? \$\endgroup\$
    – DavidG25
    Commented May 3, 2023 at 0:25
  • 1
    \$\begingroup\$ @DavidG25 You're asking for a DAC with a clock input? Most function generators will provide a reference (clock) input, and there are many similar DAC or frequency generator boards on Google/Amazon that do something like that. \$\endgroup\$ Commented May 3, 2023 at 0:40
  • 2
    \$\begingroup\$ As a really cheap solution, an audio DAC will work just fine to generate a low-distortion sinewave. You can get ones with ridiculously low THD (some are specified for -110dB). Add a microcontroller to generate I²S signals and off you go. \$\endgroup\$ Commented May 3, 2023 at 17:16
0
\$\begingroup\$

The other two answers at this time refer to using a PLL. I want to say what worked for me, in practice.

I connected the 10 MHz sync output of my clock generator to the sync input of my AP555x audio analyzer which I am using to generate the source signal. Selecting the sync input as the reference clock for the AP555x and setting the input frequency to \$M/N\cdot f_s\$ where M is the number cycles in the input signal (41), N is the number of samples (\$2^{21}\$), and \$f_s\$ is my sampling frequency (5 MHz), I was able to take an FFT of the ADC output using a rectangular window with no spectral leakage.

The input frequency was rounded to 3 or 4 decimal places, but it looks like it still worked.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.