12
\$\begingroup\$

I was designing an electronic circuit that requires precise frequency control when I realized how much I don't know about the frequency synthesis itself.

For example, when I take my low-end 2-channel arbitrary waveform generator, I'm able to set one of the channels to a sinewave with a frequency of 6.00000000 MHz and the other one to 5.99999999 MHz. When I multiply those two signals and filter out the higher frequency what I get is a precise sine signal with a frequency of 10 millihertz. So the period difference between the two waveforms should be the astonishing 278 attoseconds. That would require a 3.6 PHz of bandwidth just to distinguish the difference over one period! And yet my AWG is able to generate any frequency from 0 to 6MHz with 10mHz precision and with the thermal and phase drift accuracy of a crystal oscillator. (I've checked with an oscilloscope and the frequency is stable up to a 6-digit precision, can't check any further).

So it happens to be beyond my understanding how this can be accomplished (especially under $60). Using frequency division/multiplication would be unthinkable at that bandwidth and any VCO I know of has far more jitter and will eventually drift too much.

Am I missing something? Does any of you engineers know what's happening inside such cheap digital generators?

\$\endgroup\$
10
  • 9
    \$\begingroup\$ So the period difference between the two waveforms should be the astonishing 278 attoseconds. That would require a 3.6 PHz of bandwidth just to distinguish the difference over one period! True, IF you would want to measure that using only one period of the 6.00000000 MHz signal. If you would instead us 10 periods that goes down to 0.36 PHz. If you ever use a frequency counter you would notice that getting as many digits on the display as "5.99999999 MHz" requires a longer measurement time. So many periods of the signal are used, not just one! \$\endgroup\$ Commented Jan 7, 2021 at 10:04
  • \$\begingroup\$ yep, came here to remark exactly that: people who think they can define a frequency to the millihertz without observing the signal for an order of 1000 s ignore the fundamental math of spectra. \$\endgroup\$ Commented Jan 7, 2021 at 10:24
  • 3
    \$\begingroup\$ @MarcusMüller With assumptions of the nature of the periodic waveform there is no such limitation. Reciprocal frequency counters use the time between 'n' zero crossings to calculate the frequency to much higher resolution than would be possible with an equivalent gate time. \$\endgroup\$ Commented Jan 7, 2021 at 10:38
  • 5
    \$\begingroup\$ Note that your low-end generator does not generate precisely 5.99999999MHz and 6.0000000MHz. It thinks it is, but actually it's generating 6.00014526MHz (for example) and 6.00014528MHz. Still a small difference, but don't mistake that for precision. \$\endgroup\$
    – user20574
    Commented Jan 7, 2021 at 22:38
  • 1
    \$\begingroup\$ @SpehroPefhany That's how square waves used to have to be generated. In the last decade or two, patented products have been using a band-limited transition which is interpolated to the correct timing, basically stepping through a low-pass filtered edge by choose some FIR coefficients from a table. I'm very disappointed that the FY6800 (el cheapo banggood DDS) does not do this and has horrible jitter on its squarewaves, and claims the next version produces proper square waves. \$\endgroup\$
    – Neil_UK
    Commented Jan 8, 2021 at 7:27

4 Answers 4

19
\$\begingroup\$

That sort of generator uses DDS, or Direct Digital Synthesis

It keeps track of the phase of the required output in a register, and outputs the cosine of the phase.

To use nice round numbers, let's say you have a 10 MHz clock, and want to generate 1.000000 MHz. Each 100 ns clock cycle, your phase register gets incremented by 0.1 of a cycle. If you want to generate 1.000 000 001 MHz, then each clock you'd increment by 0.100 000 000 100 of a cycle.

Frequency resolution is cheap, you just give your phase register enough LSBs. In this case, mHz resolution with a 10 MHz clock, you'd need 10 digits if the sums were done in decimal, or as more likely at least 34 bits if they were done in binary. With binary arithmetic, sometimes the master clock will be a nice 'binary' frequency to get nice Hz resolution. With cheaper generators the designers often just throw another load of LSBs at the phase register, and have very fine resolution of a nasty binary Hz fraction, which is 'fine enough'. My low cost generator has μHz!

Only the top few MSBs, typically 10 to 16 depending on the quality (cost) of the output, get to drive the phase -> cosine converter. As a result, the phase at your output is never more accurate than a few parts per thousand. However, the output phase error is non-cumulative, and over time, the waveform will keep the correct average rate of change of phase (aka frequency) with respect to the clock, and to any other channels being generated by the same clock.

So the frequencies are precise, the phases approximately so. It's this approximation to phase that means that DDS outputs have phase noise spurious outputs. These cannot be seen on an oscilloscope, but will be visible on any modest spectrum analyser.

\$\endgroup\$
3
  • \$\begingroup\$ Now I get it. So basically the amplitude accuracy of the signal gets sacrificed (due to quantization even beating occurs at the most extreme cases) but the period can be precisely controlled. \$\endgroup\$
    – user17152
    Commented Jan 7, 2021 at 10:41
  • \$\begingroup\$ @user17152 while you're right, the period might be precisely controlled, it might just be that you can't notice that if the number of quantization steps is too low – sines of similar frequencies look identical if your quantization is too low for a loooong time. \$\endgroup\$ Commented Jan 7, 2021 at 11:39
  • \$\begingroup\$ @user17152 normally we call it "phase noise", not an amplitude error. \$\endgroup\$
    – hobbs
    Commented Jan 8, 2021 at 3:13
6
\$\begingroup\$

You can teardown your cheap function generator, I am certain you will find a DDS chip or a FPGA doing the same. However it is possible to increment/decrement frequency in range of milihertz but the precision is relative to XTAL precision. So you are able to get a sinewave of mHz when you subtract two generated frequencies from the same XTAL. If you would have a separate function generator, you would notice difference in frequencies of two sources.

The solution is to have a reference clock as the input of multiple function generators. GPSDO (GPS Disciplined Oscillator) can be used for precise synchronization.

\$\endgroup\$
1
  • \$\begingroup\$ Surely a "cheap" device won't have an FPGA, but a microcontroller driving a R-2R ladder or so. Of course my definition of "cheap" might not match yours. I have a device that is definitely cheap, it came as a kit which I assembled, just a circuit board with no plastic case. \$\endgroup\$
    – user20574
    Commented Jan 8, 2021 at 17:07
3
\$\begingroup\$

Neil and Marko have already responded in great detail. From my superficial point of view: the generator contains a DAC (or several DAC channels) and performs PCM wave playback. The design tradeoffs are approximately:

  • how stable a reference clock you can get
  • DAC resolution (bit depth) and sampling rate are factors (and a partial mutual tradeoff)
  • computing power - how many cosines (or sines) a second you can calculate, or approximate using a look-up table, down to what amplitude-wise resolution
  • how smooth (and adaptive) an analog filter you can build for the DAC output

Obviously money is the overall envelope in all those items.

\$\endgroup\$
0
\$\begingroup\$

That would require a 3.6 PHz of bandwidth just to distinguish the difference over one period!

You misunderstood that. I can set an average frequency to a very high precision without a high bandwidth. For distinguishing frequencies precisely, just do the exercise which you did over 1000 seconds, and suddenly the requirement goes down. What you need to look at is the phase noise or jitter of your source, whic you did not specify - it is actually very likely that, would you measure the jitter of your cheap source you actually would end definitely up above the 100ps range - I once use a super high-end AWG (think about a one family home in price) and got after careful calibration an estimated jitter of 20ps.

You for signal synthesis have 2 ways:

  • DDS (like @neil_UK excellent answer) for low frequencies, high relative bandwidth and arbitrary Waveform generation - remark: DDS is also pretty cool for fast generation of sine signals which change the frequency instantaneously, but depending on the application the filtering can be tricky.

  • PLL for high frequencies, lower noise and sine waves and/or genration of harmonics: in such a setup precision you always use your VCO in a phased locked loop. Here drift and long-term noise don't matter. Example high-bandwidth synthesizer: https://www.ti.com/product/LMX2820

Both methods use a fixed frequency reference (which in turn may be locked to an external signal like GPS or the 32kHz time signal in France)

Edit: typically achieving a jitter in the ps range fro the reference signal is possible with of-the-shelf components: e.g. see the specs of: https://www.orolia.com/products/atomic-clocks-oscillators/gxclok-500-gps-gnss-ocxo-clock-module

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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