Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DDS and quality od sinus according om DAC sample rate and DAC resolution?

Status
Not open for further replies.

asrock70

Full Member level 4
Joined
Oct 9, 2010
Messages
201
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
3,252
Is Mathematical dependence between quality of generated sinus , for example THD and number of point generated with DAC in DDS?
Alternatively between DAC resolution and THD ?

For example DDS AD9833 have 10bit DAC and 25MSPS , for sinus on 100kHz generate 250point in period
DAC in STM32F303 have 1MSPS and 12bit DAC for sinus 100kHz generate 10 point on period
how quantify qualitative difference between sin generated from AD9833 and STM32F3?
 

Effect of DAC resolution can be estimated by quantization noise calculation. https://en.wikipedia.org/wiki/Quantization_(signal_processing)#Quantization_noise_model

Sampling rate will theoretically not affect THD as long it's above the Nyquist rate and a sufficient reconstruction (anti-aliasing) filter is used. Existence of the filter is presumed in any DDS application, see DDS chip data sheets. For non-ideal filter stop band, the generated harmonics can be calculated, it's e.g. done in Analog Devices DDS tools.

Ideal quantization noise (uniform error distribution) would appear as phase noise of the generated sine. A real DAC doesn't have uniform error distribution, respectively spurious frequency components at N*fsignal +/- M*fsample can appear in output spectrum. Predicting it exactly is almost impossible, instead DDS datasheets give an upper limit for spurious signals.
 

Reconstruction (anti-aliasing) filter works only on frequency near frequencky it was designed.
For example we have 5th filter for 100kHz and saw (2point on periode) DAC this filter make sin with THS obout 0,2% on 100kHz but on 10kHz THD 12%, this is saw rather than sine.
at the same time filter change phase engel and It costs money.
Number of points improves the situation, the question is how and what is the difference between, for example, 100 and 1000 points on the period on 10kHz and filter on 100kHz
 

DAC this filter make sin with THS obout 0,2% on 100kHz but on 10kHz THD 12%, this is saw rather than sine.
Wonder how the 12 % THD sine is obtained? In case of a DDS, we can assume that sampling frequency is fairly above double filter cut-off frequency. Even a tiny 8-bit DAC with a very small sine table would produce a better signal quality. So something is seriously wrong with the signal generation scheme.
 

Total Harmonic Distortion THD=20*logSqrt((V2^2+V3^2+V4^2+V5^2+V6^2)/V1)
where:
V1 is the rms amplitude of the fundamental.
V2, V3, V4, V5, and V6 are the rms amplitudes of the second
through sixth harmonics.
The more the output signal from the DAC differs from the ideal sine the stronger is V2 to V6
Now make simulation signal source si SAW 100kHz and SAW 10kHz over 5th 100kHz LPF
100kHz.png

10kHz.png

Filter.png
 
Last edited:

The more the output signal from the DAC differs from the ideal sine the stronger is V2 to V6
Now make simulation signal source si SAW 100kHz and SAW 10kHz over 5th 100kHz LPF

The simulation shows what you can expect. DDS purpose is to generate sine or other cyclic waveforms with variable frequency. If you want a sine output signal, you need a sine lookup table, not a sawtooth.
 

You're right
I responded to your sentence
"Sampling rate will theoretically not affect THD as long it's above the Nyquist rate and a sufficient reconstruction (anti-aliasing) filter is used"
SAW is extreme example sin with 1 sample point on 1/2 period :-D
sinx-1.gif

The more points, the more the curve is close to ideal sine function (dropping weight V2 to V6)
ie there must be a mathematical relationship between sample rate DAC and THD output sinus.
In other words
Should any point output function does not in V1 reduce weight V1 and increase V2 to V6
 

Hi,

SAW is extreme example sin with 1 sample point on 1/2 period
This is OFF nyquist specification. Nyquist says "more" than half of the sampling rate.

Lets say you have a saw signal (triangle) and a sample rate of 3 times the saw frequency.
--> this also violates nyquist theoreme. If you look at the fourier series of a trangle you see that there are odd overtones = 3f, 5f, 7f...
Even the first overtone with 3f violates nyquist. If you eleiminate the 3rd and all folowing overtones of a trainge, then .... a simple sine with the frequency of the triangle remains. Nothing else.
This is what a reconstruction filter makes. it forms a pure sine when your input is 3 points per fullwave.

***
The error is more visible when you perform ADC conversions. Here you need a so called "anti aliasing filter" in front of the ADC. This filter ensures, that no signal frequency above f_sample/2 (nor funtamental, nor overtone) receives the ADC. So with the triangle example above: Feed the triangle into the AAF and the output will be a pure sine. Without the AAF - in this special case - you will see a "disorted" sine with random DC offset (as digital values).

***
BTW: There is only one true reconstruction filter: It is sin(x)/x. The problem is, that this requirement can´t be fulfilled neither with analog filters, nor with digital filters, nor with a combination of them. We have to use filters that come "close" to this filter function. Good audio DACs have built in these filters (digital). Combined with oversampling and relatively simple analog filters they come very close to the optimum.

Klaus
 

The time discrete DDS sine output should be modeled as a staircase (first order hold element) rather than a line interpolation (second order hold).

The operation principle of DDS involves that the sampling rate is fixed while signal frequency changes. The 100 kHz reconstruction low-pass filter would be used with e.g. 250 kHz sample rate. In so far a 10 kHz signal with only 2 sampling points can't occur, it has 25.

Low number of sampling points (e.g. generating a sine signal above 50 kHz with the 250 kHz DDS) is however a problem in exact phase and magnitude representation, but won't cause large THD.

There is only one true reconstruction filter: It is sin(x)/x. The problem is, that this requirement can´t be fulfilled neither with analog filters, nor with digital filters.
It's no problem to make a FIR filter very close to sin(x)/x. You'll have serious difficulties to see the difference in a real measurement. But sin(x)/x in time domain (= exactly rectangular filter characteristic in frequency domain) is only ideal in some regards and may be unwanted in others. I remember one of the first DSOs that was presented by HP salesman. They implemented either a sin(x)/x anti-alias filter or a respective function for the reconstruction towards display. As a result, the step response was a nice ringing. Caused much laughter...
 

Hi,

As a result, the step response was a nice ringing. Caused much laughter...
I agree. When I have a square wave, digitize it and show the digital values on a screen, then one expects a square wave on the screen.. with sharp edges.
--> this is the numan expectiation of how a scope should work.

In opposite to audio.
As Sony and Philips specified the audio CD. They wanted to capture the whole audio frequency range, considered to be up to 20kHz.
But on the other side they wanted to keep the sampling rate low to keep the data volume low. (Thanks Beethoven 74 minutes of music on a 12 cm disc)
So they tried to go close to nyquist. They decided to use 44100Hz (44056Hz) sampling rate.
With all frequencies above 20kHz cut off.
And yes - a step response in digital audio data will result in some "ringing" at the analog output. Indeed the ringing is caused by the "missing" overtones to generate a sharp edge and a flat top.

A question of what you want to achieve.

Klaus
 

Ok her is final solution.
1. Effect of DAC Resolution
DAC resolution make quantization distorsion (quantization error)
Code:
 SQR=1.76+6,02B (dB)
B is DAC resolution
for 10 bit DAC SQR= 61.96 dB
for 12 bit DAC SQR= 74.00 dB
for use full DAC resolution

2. effect of reduction full scale DAC
if not used ful scale DAC
Code:
 SQR=1.76+6,02B  + 20log(FFS) (dB)
for exmple if use only 70% full resolution DAC FFS=0.7
for 10 bit DAC SQR= 58.86 dB
for 12 bit DAC SQR= 70.90 dB
for use 70% DAC resolution

3. Effect of oversamplign i.e sample rate DAC

Code:
 SQR=1.76+6,02B  + 20log(FFS) + 10log(FSos/Fs) (dB)

Where Fs is the Nyquist sampling rate and FsOS is the oversampling rate.
for exmple output freuency Fo=100kHz, FS=2*Fo, for 1MSPS DAC FSos=1MHz oversampling 5x

for 10 bit DAC SQR= 68.95 dB
for 12 bit DAC SQR= 80.99 dB
for use 100% DAC resolution
 
Thanks you
I calculate SQR for 10bit DDS on 10MSPS and 12bit DAC 1MSPS in STM322F303
In 100Hz -100kHz is DAC in STM32F303 2.04dB worse than 10bit DDS
for example on 100khz DDS 78.95dB and DAC 80,90dB 1kHz 98.95fB and 100.99 dB plus there is a savings of $ 4 per chip DDS.

This leads us to question
I search example implementation DDS in MCU (ideal STM32Fxxx)
On first look it is simple DAC +DMA + SIN table but The devil is in the details
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top