# [time-nuts] spur prediction DDS software

Bruce Griffiths bruce.griffiths at xtra.co.nz
Sun Jan 30 18:30:48 UTC 2011

```Magnus Danielson wrote:
> On 27/01/11 14:33, jimlux wrote:
>> On 1/27/11 5:17 AM, Luis Cupido wrote:
>>> Hi,
>>>
>>> Is there a DDS spur prediction software around ?
>>
>> Not generically..
>>
>> There is a dissertation out there with some matlab code. I'll see if I
>>
>> Most of the time what I do is write a little program in matlab/octave,
>> run a bunch of samples, and FFT it. That way you can model things like
>> error feedback or truncation effects.
>
> What I do is to write a little C program that keeps accumulating away.
> Whenever the wrapped value becomes lower than the previous value I
> have a cycle completed. Just print the values of each such phase-wrap
> and you will readily see the phase movements. You will also notice
> that this is a number of phase movements overlayed ontop of each
> other. Each such overlay structure has an integer number of cycles
> over the DDS period. It really takes very little time to break them
> out and get their relative amplitudes using this method. This is a
> healthy exercise to do to learn what DDS phase noise can result in.
>
> Thinking a bit more about it, you realize that you can see the same
> pattern as being the result of a sawtooth being wrapped up on itself
> around the nyquist frequencies. Pondering some more over it you
> realize that there is DDS frequencies in which these overtones will
> wrap on top of each other in the wrapped spectrum, This condition will
> avoid close-in spurs, so an analogue clean-up has a fair chance of
> doing something with them. It also becomes clear that small shifts can
> produce larger shifts of spurs...
>
> Having a fixed M/N situation where N=2^n (common for many DDSes) will
> limit the frequencies with the "good" condition of spurs being far
> away, but shifting to a variable N improve things in this context, but
> makes some control aspects messy.
>
> A problem with using a 2^(n-1) < N < 2^n is that the phase-sequence
> will run short compared to the usual binary bits taken from the top of
> the DDS, so this will needs to be handled. It takes some extra tricks
> to avoid the phase-jump and hence sawtooth phase modulation.

The AD9913 (when operating in the variable modulus mode) merely adds an
extra 1 (lsb) to the main accumulator whenever the auxiliary (variable
modulus) accumulator overflows.
Thus to avoid phase modulation of the output the combined result of the
2 accumulators has to result in the main accumulator always having zeros
in the lower b-p bits where p is the width of the truncated phase word
and b is the width of the main accumulator.

>
> The good thing about DDSes is that you with very cheap hardware can
> get a linear scale over a large frequency range. It will not
> necesserily align up to the intended frequency (as dialed in). More
> elaborate schemes will reduce these effects.
>
> ... and that was prior to do phase quantization prior to sine shaping.
>
> Cheers,
> Magnus
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>
Bruce

```