# 04 Spectral Test

### Prof. Dr. Jörg Vollrath

Previous: 03 INL, DNL Error

## Video Laboratory: Web report and ADC, DAC simulation

 Video is not visible, most likely your browser does not support HTML5 video Länge: 01:06:27 0:0:0 Save Webpage.zip file 0:1:10 Extract files 0:2:20 Start LTSPICE 0:3:15 Downloaded LTSPICE files 0:4:20 0 0:4:20 Directories 0:5:18 Copy group directory and change name 0:5:52 0 0:5:52 Open our .html report file 0:7:31 Open with Notepad++ 0:8:41 Webpage in Browser 0:9:28 HTML content 0:14:31 HTML slide Overview 0:16:56 Installation of webpage template 0:24:4 Start with LTSPICE 0:25:45 LTSPICE files 0:26:51 Copying of LTSPICE files, New slide 0:28:31 Insert image 0:30:3 LTSPICE simulation started 0:31:41 Add voltage source with pulse and ramp 0:32:31 Ramp voltage 0:34:20 Automatic Webpage update 0:35:26 Update report 0:35:36 Simulation starts 0:37:56 Output voltage for each code? 0:38:42 Cursor measurement 0:39:6 .measure statements 0:43:21 Measurement file saved and executed 0:44:21 Execute measurement file 0:45:12 Output voltage results 0:46:50 Copy bitmap of output, irfanview, save 0:47:56 HTML tag 0:49:22 Comment into report 0:53:14 Enable local file load for Firefox 0:55:21 about:config privacy_file_unique_origin 0:57:50 Real DAC example 1:0:26 Simulation started with levels 1:2:6 Setting up level measurements 1:4:44 Measurement results 1:6:36 Look at INL and DNL calculation 1:9:36 Zip your folder.

## Video 4. Lecture: Spectral test

 Video is not visible, most likely your browser does not support HTML5 video Länge: 01:06:27 0:0:0 0 0:1:33 Signal to noise ratio 0:2:5 Quantization error 0:3:40 ADC Dynamic Range SNR = N · 6.02 dB 0:6:18 ADC Dynamic Range SNR = N · 6.02 dB´+ 1.76 dB 0:8:30 ENOB = (SNR -1.76 dB)/6.02 dB 0:9:15 Signal to quantization noise numbers 0:14:32 Aliasing 0:15:42 Filtering prevents aliasing 0:18:18 Nyquist zones 0:18:42 Data converter classification: Nyquist, oversampling, undersampling 0:22:33 ADC Error simulation with FFT 0:25:22 Frequency noise table 0:27:52 Signal to noise ratio example 0:30:32 u(t) = 0.5 + 0.5 sin(ω t) 0:31:42 SQNR 0:35:36 Distributing noise over NFFT/2 bins: 10 log(NFFT/2) 0:39:2 Noise level estimation not possible only calculation 0:40:42 Signal to distortion 0:42:17 fsignal equal fsampling/2 0:45:42 Non integer number of periods 17.6 causes bleeding 0:47:15 Windowing split signal to adjacent bins 0:50:2 Kaiser and Nutall, simulation guides measurement 0:52:10 Power of 2 number of periods causes pattern in spectrum 0:53:42 Prime number of periods 0:56:47 Noise and signal, amplitude and level 0:59:2 INL, DNL non linearity error and FFT harmonic 1:2:47 Single distortion 1:9:2 FFT Challenges 1:10:14 Why Web application and not Matlab, Excel, C program 1:11:47 FFT Application spectrum

# Review and Overview

• Integral non linearity: INL
• Differential non linearity: DNL
• Histogram testing

• Quantization error
• Spectral analysis
• Aliasing, oversampling, undersampling
• FFT: simulation, measurement
• Relationship of INL, DNL and SFDR, SNDR

Reading:

# Quantization Error

 Quantization error is the difference between the quantized signal and the original signal. The quantization error stays between $\pm \frac{1}{2} LSB$ for the input range.
Quantization error can be modeled adding an extra signal εq to the original signal.

# ADC dynamic range

 First approximation: Vsp: signal peak full scale voltage Vqp: peak quantization noise voltage $SNR \approx 20 \cdot log\frac{V_{sp}}{V_{qp}} \approx 20 \cdot log\frac{LSB \cdot 2^{N}}{LSB} dB$ $SNR = 20 \cdot N \cdot log(2) = 6.02 \cdot N dB$

# ADC dynamic range

 Second approximation: $SQNR = 6.02 \cdot N dB + 1.76 dB$ Using integral over quantization error function. $\overline{\epsilon_{q}^2} = \frac{1}{T} \int_{- \frac{T}{2}}^{+\frac{T}{2}} ( k \cdot t )^2 dt$
Root mean square value for quantization error is calculated with the integral over one period T, when the quantization error goes from $+\frac{T}{2}$ to $-\frac{T}{2}$:
$\overline{\epsilon_{q}^2} = \frac{1}{T} \int_{- \frac{T}{2}}^{+\frac{T}{2}} ( k \cdot t )^2 dt$
with $k = - \frac{LSB}{T}$ giving $T = - \frac{LSB}{k}$:
$\overline{\epsilon_{q}^2} = - \frac{k}{LSB} \int_{+ \frac{LSB }{2 \cdot k}}^{- \frac{LSB}{2 \cdot k}} ( k \cdot t )^2 dt = - \frac{k^3}{LSB} \left( - \frac{LSB^{3}}{8 \cdot 3 \cdot k^3} - \frac{LSB^{3}}{8 \cdot 3 \cdot k^3} \right) = \frac{LSB^2}{12}$
$\epsilon_{q} = \frac{LSB}{\sqrt{12}}$

$SQNR = 20 \cdot log \frac{\frac{1}{\sqrt{2}} \frac{LSB \cdot 2^{N}}{2}}{\frac{LSB}{\sqrt{12}}} dB = 20 \cdot log \frac{\sqrt{12}\cdot 2^{N}}{2 \cdot \sqrt{2}} dB$
$SQNR = 20 \cdot log \left( 2^{N} \sqrt{\frac{3}{2}} \right) dB = N \cdot 20 \cdot log (2) dB + 20 \cdot log \left( \sqrt{\frac{3}{2}} \right) dB$

$SQNR = 6.02 \cdot N dB + 1.76 dB$

# Signal to Quantization noise

Signal to Quantization Noise Ratio:

$SQNR = 6.02 \cdot N dB + 1.76 dB$

Signal to noise and distortion ratio:
SINAD
without distortion:

SINAD = SQNR = 6.02 N dB + 1.76 dB

Effective Number of Bits:

$ENOB = \frac{SINAD - 1.76 dB}{ 6.02 dB}$

 N SQNR [dB] 8 50 12 74 16 98 20 122

# Spectrum Analysis

• Motivation
• Signal transmission
• Aliasing
• Fold back of signals
• Filters
• Nyquist sampling, oversampling, undersampling (subsampling)
• Fast fourier transformation (FFT)
• Number of samples: $2^{N_{Bits}} \cdot 2^{k}$ (k improves resolution)
• Number of signal cycles: prime number
• Y axis dB and log frequency scale
• Windowing, total power, noise level
• SPICE simulation output file size
• Simulation of relationship of INL, DNL and SFDR, SNDR

# Uniform sampled time signals: Aliasing

Samples spaced with sampling period $T_S = \frac{1}{f_S}$.
Multiple continous timesignals can generate the same discrete time signal.

fsample = 4 Hz, Tsample = 0.25 s,
fsignal = 2.4 Hz, Tsignal = 0.417 ms,
falias = fsample - fsignal = 1.6 Hz, Talias = 0.625 ms,

Red: sample points; blue and green 2 possible signals
The frequencies fsignal and n fsample ± fsignal, n integer, are indistinguishable in the discrete time domain.

# Frequency Domain: Aliasing

 The frequencies fx and nfs ± fx, n integer, are indistinguishable in the discrete time domain Nyquist zones 1st: 0..fs/2; 2nd: fs/2..fs; 3rd: fs..3/2fs; 4th: 3/2 fs..2fs Anti aliasing filter
Having a sampling frequency fS gives a frequency spectrum from 0 to fS/2.
Only this range of interested is highlighted in the figures.
The number of sampled points NFFT gives the minimum frequency and the frequency resolution:
fmin = fstep = fS * 2 / NFFT
The figure shows a linear scaling of the frequency x-axis.
Most of the time a logarithmic frequency scaling is used.

# Data converter classification

• ## Nyquist rate:

fsignal < fsampling/2
Basic ADC circuits
• ## Oversampling:

fsignal << fsampling/2
High resolution AD converters
Limited analog circuit complexity, higher stability concerns, high digital signal processing effort
• ## Undersampling (sub-sampling):

fsignal > fsampling/2
Wireless, software defined radio
Analog filter limits the band of interest

# FFT simulator

 The JavaScript simulator can be used: ADCharacteristic 8-bit ADC, 0.5 V Amplitude, 0.5 V offset, 17 periods, 4096 points FFT. Lowest frequency shows in this simulation DC magnitude. Signal magnitude is -9 dB for frequency 17: 500 mV amplitude gives $20 \cdot log \left( \frac{0.5}{\sqrt{2}} \right) = -9 dB$ Total noise is -58 dB which is -9 dB - 6.02*8 dB -1.76 dB = -58 dB using 8 bits. Since the noise is distributed over 4096 bins the noise is distributed around: -58 dB - 10 log (2048) dB = -91 dB. Unfortunately there is a lot of noise, so it is difficult to estimate the -91 dB.
Experiments using 8 bits resolution:
16 times the number of ADC levels are used as number of samples for FFT.
28 · 16 = 4096 samples for FFT.

## Aliasing

- Number of periods 4096+17 = 4113

## Bleeding

- Non integer number of periods shows bleeding.

## Windowing

- Windowing reduces bleeding. The signal peak is distributed over some bins and the magnitude a little reduced.

## Noise pattern

- Non prime integer number of periods shows noise pattern.

## DNL, INL and spectral analysis

Errors: Sine amplitude 0.01 is 1 %. It is expected to loose more than 1 bit.
INL is -2.5 and could be centered.
FFT without windowing shows a signal level at fsignal of -9 dB and a harmonic at 2 fsignal with -48 dB.
This gives an ENOB of (-9 dB - (-48 dB) - 1.76 dB) / 6.02 dB = 6 bits.

## White noise

A noise of 0.01 shows no clear steps in the transfer characteristic any more.
As expected the random INL will vary with every simulation run. Maximum absolute INL is around 3.
FFT without windowing shows a signal level at fsignal of -9 dB and a total noise level of -34 dB.
This gives an ENOB of (-9 dB - (-34 dB) - 1.76 dB) / 6.02 dB = 4 bits.

## Single distortion in INL, DNL

What happens with the error, if there is one bad conversion.
8 bits and 17 periods simulation.
Distortion start 0.49, distortion length 0.0036 and distortion amplitude of 0.004.
INL and DNL is 0.9 LSB. Noise floor is 58.13 dB compared to 58.23 dB.
Distortion start 0.49, distortion length 0.0078 and distortion amplitude of 0.01.
From INL and DNL the value of -2 LSB is critical. Noise floor is 56.88 dB compared to 58.23 dB.
Very precise INL, DNL and FFT measurements are needed to catch missing codes.

## Amplitude modulation

Windowing is like amplitude modulation spreading the power:
ω is ω + δ and ω - δ

# Practical FFT

 Application Matlab Can not simulate actual circuit Excel Cumbersome LTSPICE Difficult to operate, inconsistent results, post processing cumbersome Program Code JavaScript, HTML, Web Oscilloscope Built in real time limited dynamic range, resolution 8..10 Bit Spectrum analyzer High dynamic range Issues Prime integer number of cycles Spectral leakage, windowing Number of samples Power of 2: 1024, 16384 100 times quantization level to get a good error accuracy The DFT noise floor wrt total noise: $-10 log_{10}(\frac{N_{FFT}}{2}) [dB]$ below the actual noise floor. Log frequency scale Total noise power Band stop filter

# FFT Application Spectrum

A simulation is shown:
(8-bit, 17 periods, nonlinearity sine amplitude 0.005, 1 period)
The lowest frequency shows the DC content.
The signal at frequency 17 has -9 dB magnitude.
The first harmonic at frequency 34 has -54.31 dB magnitude.
The average noise level is -80 dB giving a total noise of -52 dB (without Harmonic of -58 dB).

ADC characteristic can be determine:
 Signal to noise ratio: SNR = -9 dB - (- 58 dB) = 49 dB. Signal to distortion ratio: SDR = -9 dB - (-54 dB) = 45 dB Signal to noise and distortion ratio: SNDR = - 9 dB - (- 52 dB) = 43 dB Spurious free dynamic range: SFDR = -9 dB - (- 54 dB) = 45 dB
Since there is only one harmonic SDR and SFDR is the same.
Signal to distortion ratio (SDR): signal to total distortion power (all harmonics).
$SDR = 10 \cdot \log \left( \frac{Signal \; power}{Total \; distortion \; power}\right)$

Signal to distortion ratio (SNDR): signal to noise and distortion power.
$SNDR = 10 \cdot \log \left( \frac{Signal \; power}{Noise \; and \; distortion \; power}\right)$

Spurious free dynamic range (SFDR): signal to highest harmonic.
$SFDR = 10 \cdot \log \left( \frac{Signal \; power}{Largest \; harmonic \; power}\right)$

The objective should be to have all numbers the same getting the expected ENOB.
Harmonics should be eliminated correcting non linearities.
Harmonics can also be eliminated, if the power supply during conversion is not stable.
Non harmonic peaks can come from the power supply or radio interference.
The total noise without harmonics can be increaed due to device parameters: high resistors, low capacitance values, high transistor or operational amplifier input noise.

Diagnosis tries to determine the exact root cause for errors to guide the circuit designer to a better design.
Unfortunately there is little literature available about diagnosis strategies.

# FFT Application Effort

A 16 bit pipeline ADC should be measured.

16 bit means at least 65k points * 16 = 2 Million points for FFT.
The sine generator should have an accuracy of amplitude of 16 bit meaning 1/65000 = 15 ppm.
Without windowing the same is true for the frequency.

# FFT Application Considerations

• FFT gives the same information as INL, DNL testing
• Like for the histogram test the number of FFT points NFFT should be at least 8..16 times the number of codes 2N. Otherwise not all codes are tested with sufficient accuracy.
• The time measurement data can be resorted giving half a period of a cosine signal and used to calculate INL, DNL according to a histogram test.
The reference INL and DNL can be calculated using an ideal half period of a cosine signal.
JavaScript ADC FFT histogram application
• FFT gives the same information as INL, DNL testing
• Tools: Reading and preprocessing of LTSPICE and oscilloscope data to integer values.
Reading LTSPICE data
Reading oscilloscope data

# Practical Test

LTSPICE simulation data has no fixed time data step size and is non monotonic.
Oscilloscope data can have many samples per output code.
At the moment the FFT tool uses integer data, since ADCs are generating integer data.

 ADC ideal, DAC Test Ramp One sample per code ADC ideal, DAC Test Ramp Many samples per code ADC ideal, DAC Test Sine One or many samples per code ADC Test, DAC ideal Ramp One sample per code with missing codes ADC Test, DAC ideal Ramp Many samples per code with missing codes ADC Test, DAC ideal Sine Many samples per code with missing codes

# Next:

05 DAC Architectures

Hochschule für angewandte Wissenschaften Kempten, Jörg Vollrath, Bahnhofstraße 61 · 87435 Kempten
Tel. 0831/25 23-0 · Fax 0831/25 23-104 · E-Mail: joerg.vollrath(at)fh-kempten.de
Impressum