Groups | Search | Server Info | Login | Register


Groups > comp.dsp > #35342

Re: DDS question: why sine lookup?

From john larkin <jl@glen--canyon.com>
Newsgroups sci.electronics.design, comp.dsp
Subject Re: DDS question: why sine lookup?
Date 2025-05-06 15:50 -0700
Organization A noiseless patient Spider
Message-ID <9u2l1kh2o87dmqec5o69paej05htbvi714@4ax.com> (permalink)
References <o3ak1k9ifikv6c1tmfnd89k6vfj4vigj37@4ax.com> <vvdm8h$3i2ju$2@dont-email.me> <7dd00187-0adf-9f30-dc8b-f6a123ef08e8@electrooptical.net>

Cross-posted to 2 groups.

Show all headers | View raw


On Tue, 6 May 2025 16:46:16 -0400, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>On 2025-05-06 15:00, Jeroen Belleman wrote:
>> On 5/6/25 17:48, john larkin wrote:
>>> A DDS clock generator uses an NCO (a phase accumulator) and takes some
>>> number of MSBs, maps through a sine lookup table, drives a DAC and a
>>> lowpass filter and finally a comparator. The DAC output gets pretty
>>> ratty near Nyquist, and the filter smooths out and interpolates the
>>> steps and reduces jitter.
>>>
>>> But why do the sine lookup? Why not use the phase accumulator MSBs
>>> directly and get a sawtooth, and filter that?
>>>
>>> The lowpass filter looks backwards in time for a bunch of ugly samples
>>> to average into a straight line. The older sine samples are the wrong
>>> polarity! If the filter impulse response is basically zero over the
>>> period of the sawtooth, and we compare near the peak, we'll average a
>>> lot of steps and forget the big sawtooth reset. [...]
>> 
>> Two things are immediately obvious: First, the sawtooth will have
>> a variable frequency, and the filter won't have a zero response
>> for all possible frequencies.
>> 
>> Second, the usual reconstruction filters do *not* interpolate
>> into straight lines.
>> 
>> Beyond that, I would have to think this over a bit more.
>> 
>> Jeroen Belleman
>> 
>> 
>> 
>
>You don't want to use a sawtooth if you can help it, because it has huge 
>contributions from all harmonic orders.  It also puts a lot of demands 
>on the slew rate and settling of the DAC and any amplifiers used in the 
>filtering.  Errors there are of course nonlinear, because once an amp is 
>in slew limiting, it stops responding to its inputs for a bit.

I was thinking that my DAC is just 5 or 6 resistors hanging off some
FPGA pins, and that drives a 3rd order (CLC) LC filter and the
comparator. So no opamps.



>
>It also emphasizes the close-in spurs.  Say you have two N-bit DDSes 
>running at the same average frequency but different phases.  The DAC 
>samples only the M high-order bits. It happens that at time t=0 the 
>accumulator overflows on the same clock cycle on both.
>
>This will continue to happen until one of them overflows a cycle early 
>because the bottom N-M bits rolled over.
>
>The resulting voltage difference between them is a full-scale, 
>one-clock-wide pulse, followed by a noisy baseline as the bottom N-M 
>bits roll over into the DAC's LSB at different times.  This will repeat 
>every cycle until the other DDS catches up.  This scenario will play out 
>some number of times in a full period, i.e. the least common multiple of 
>the accumulator size and the increment in clocks.
>
>The energy in that glitch is much larger than in the noisy baseline, and 
>its timing is variable in complicated ways.
>
>A triangle would be better, and of course that could be done pretty 
>simply, e.g. with a flip flop controlling a bunch of XOR gates, if you 
>don't mind halving the frequency.
>
>Once you have a lookup table, a sine is as easy as anything else, and 
>minimizes the demands on the DAC, filters and amplifiers.
>
>Cheers
>
>Phil Hobbs

If I'm using, say, 8 MS phase accumulator bits and a 5-bit DAC and
synthesizing one octave of frequency, the sine table is no big deal.
256 bytes of RAM per DDS unfolded.

I've been playing with sims. The sawtooth works OK but may be too
cute. I'll compare it to sines.

The pseudo-DAC output is always positive. It can go into one
comparator input and I can RC lowpass filter same into the other, to
switch on the waveform midpoint.

I reall need to get my FPGA kids to run the phase accumulator at 160
MHz. Run way below Nyquist.

Back to comp.dsp | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-06 08:48 -0700
  Re: DDS question: why sine lookup? Jeroen Belleman <jeroen@nospam.please> - 2025-05-06 21:00 +0200
    Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-06 12:33 -0700
    Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-06 16:46 -0400
      Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-06 15:50 -0700
        Re: DDS question: why sine lookup? Arie de Muijnck <noreply@ademu.nl> - 2025-05-07 11:44 +0200
          Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-07 06:32 -0700
            Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-08 01:58 +1000
      Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-07 06:55 -0700
        Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-07 11:31 -0400
          Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-08 02:11 +1000
  Re: DDS question: why sine lookup? Gerhard Hoffmann <dk4xp@arcor.de> - 2025-05-06 21:27 +0200
    Re: DDS question: why sine lookup? "Don" <g@crcomp.net> - 2025-05-06 20:10 +0000
    Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-06 13:35 -0700
  Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-07 16:27 +1000
  Re: DDS question: why sine lookup? Martin Brown <'''newspam'''@nonad.co.uk> - 2025-05-07 20:32 +0100
    Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-07 13:01 -0700
      Re: DDS question: why sine lookup? bitrex <user@example.net> - 2025-05-07 20:27 -0400
        Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-07 19:21 -0700
          Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-08 22:49 +1000
          Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-08 14:20 -0400
            Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-08 11:58 -0700
              Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-08 16:24 -0400
                Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-08 14:18 -0700
                Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-08 22:28 +0000
                Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-08 16:24 -0700
                Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-08 23:57 +0000
                Re: DDS question: why sine lookup? piglet <erichpwagner@hotmail.com> - 2025-05-09 04:48 +0000
                Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-09 12:53 -0700
                Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-10 18:53 +1000
                Re: DDS question: why sine lookup? Lasse Langwadt <llc@fonz.dk> - 2025-05-10 19:52 +0200
                Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-10 11:53 -0700
                Re: DDS question: why sine lookup? dplatt@coop.radagast.org (Dave Platt) - 2025-05-10 16:50 -0700
                Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-10 17:39 -0700
                Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-11 16:27 -0400
                Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-11 16:55 +1000
                Re: DDS question: why sine lookup? Lasse Langwadt <llc@fonz.dk> - 2025-05-11 22:03 +0200
                Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-09 15:52 +1000
        Re: DDS question: why sine lookup? Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-10 00:44 +0000
      Re: DDS question: why sine lookup? Martin Brown <'''newspam'''@nonad.co.uk> - 2025-05-09 09:32 +0100
  Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-10 17:00 -0700
  Re: DDS question: why sine lookup? antispam@fricas.org (Waldek Hebisch) - 2025-05-13 23:25 +0000
    Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-13 20:22 -0400
      Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-13 18:40 -0700
      Re: DDS question: why sine lookup? antispam@fricas.org (Waldek Hebisch) - 2025-05-14 15:35 +0000
        Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-14 15:05 -0400
          Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-14 14:53 -0700
            Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-14 19:16 -0400
              Re: DDS question: why sine lookup? john larkin <jl@glen--canyon.com> - 2025-05-14 17:10 -0700
                Re: DDS question: why sine lookup? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2025-05-15 12:40 -0400
          Re: DDS question: why sine lookup? Bill Sloman <bill.sloman@ieee.org> - 2025-05-15 17:23 +1000

csiph-web