Electronic – How do digital function generators generate precise frequencies

frequencyfrequency-synthesisfunction generator

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?

Best Answer

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.