# DSP Tricks: A/D converter testing techniques and finding missing codes in ADCs

Digital signal processing techniques are often useful in testing of A/Dconverters. Here are two schemes for measuring converter performance;first, a technique using the Fast Fourier Transform (FFT) to estimateoverall converter noise, and second, a histogram analysis scheme todetect missing converter output codes.

Estimating A/D Quantization Noisewith the FFT

The combination A/D converter quantization noise, missing bits,harmonic distortion, and other nonlinearities can be characterized byanalyzing the spectral content of the converter's output.

Converter performance degradation caused by these nonlinearities isnot difficult to recognize because they show up as spurious spectralcomponents and increased background noise levels in the A/D converter'soutput samples.

The traditional test method involves applying a sinusoidal analogvoltage to an A/D converter's input and examining the spectrum of theconverter's digitized time-domain output samples.

We can use the FFT to compute the spectrum of an A/D converter'soutput samples, but we have to minimize FFT spectral leakage to improvethe sensitivity of our spectral measurements. Traditional time-domainwindowing, however, provides insufficient FFT leakage reduction forhigh performance A/D converter testing.

Figure13″22 Ideal A/D converter output when the input is an analog 8fs/128 Hzsinusoid: (a) output time samples; (b) spectral magnitude in dB. |

The trick to circumventing this FFT leakage problem is to use ansinusoidal analog input voltage whose frequency is an integer fractionof the A/D converter's clock frequency as shown in Figure 13″22(a) above .That frequency is mfs/N, where m is an integer, fs is the clockfrequency (sample rate), and N is the FFT size.

Figure 13″22(a) shows the x(n) time domain output of an ideal A/Dconverter when its analog input is a sinewave having exactly eightcycles over N = 128 converter output samples.

In this case, the input frequency normalized to the sample rate fsis 8fs/128 Hz. Recall that the expression mfs/N defines the analysisfrequencies, or bin centers, of the discrete Fourier Transform (DFT),and a DFT input sinusoid whose frequency is at a bin center causes nospectral leakage.

The first half of a 128-point FFT of x(n) is shown in thelogarithmic plot in Figure 13″22(b)above where the input tone lies exactlyat the m = 8 bin center and FFT leakage has been sufficiently reduced.Specifically, if the sample rate were 1 MHz, then the A/D's inputanalog tone would have to be exactly 8(106/128) = 62.5 kHz.

In order to implement this scheme we need to ensure that the analogtest generator be synchronized, exactly, with the A/D converter's clockfrequency of fs Hz. Achieving this synchronization is why this A/Dconverter testing procedure is referred to as coherent sampling.

That is, the analog signal generator and the A/D clock generatorproviding fs must not drift in frequency relative to each other—theymust remain coherent. (We must takecare here from a semantic viewpointbecause the quadrature sampling schemes are also sometimes calledcoherent sampling, and they are unrelated to this A/D converter testingprocedure .)

Figure13″23 Seven-cycle sinusoidal A/D converter output. |

As it turns out, some values of m are more advantageous than others.Notice in Figure 13″22(a), that when m = 8, only nine differentamplitude values are output by the A/D converter. Those values arerepeated over and over. As shown in Figure13″23 above , when m = 7 weexercise many more than nine different A/D output values.

Making m an odd prime number

Because it's best to test as many A/D output binary words aspossible, while keeping the quantization noise sufficiently random,users of this A/D testing scheme have discovered another trick. Theyfound that making m an odd prime number (3, 5, 7, 11, etc.) minimizesthe number of redundant A/D output word values.

Figure 13″24(a) below illustrates an extreme example of nonlinearA/D converter operation, with several discrete output samples havingdropped bits in the time domain x(n) with m = 8. The FFT of thisdistorted x(n) is provided in Figure13″24(b) where we can see theincreased background noise level due to the A/D converter'snonlinearities compared to Figure 13″22(b).

Figure13″24 Non-ideal A/D converter output showing several dropped bits: (a)time samples; (b) spectral magnitude in dB. |

The true A/D converter quantization noise levels will be higher thanthose measured in Figure 13″24(b) above .That's because the inherentprocessing gain of the FFT will pull the high-level m = 8 spectralcomponent up out of the background quantization noise.

Consequently, if we use this A/D converter test technique, we mustaccount for the FFT's processing gain of 10log10(N/2) as indicated inFigure 13″24(b).

To fully characterize the dynamic performance of an A/D converterwe'd need to perform this testing technique at many different inputfrequencies and amplitudes. (Theanalog sinewave applied to an A/Dconverter must, of course, be as pure as possible. Any distortioninherent in the analog signal will show up in the final FFT output andcould be mistaken for A/D nonlinearity. )

The key issue here is that when any input frequency is mfs/N, wherem is less than N/2 to satisfy the Nyquist sampling criterion, we cantake full advantage of the FFT's processing capability while minimizingspectral leakage.

Figure13″25 A/D converter hardware test configuration. |

Applying the sum of two analog tones to an A/D converter's input isoften done to quantify the intermodulation distortion performance of aconverter, which in turn characterizes the converter's dynamic range.In doing so, both input tones must comply with the mfs/N restriction.Figure 13″25 above shows the test configuration.

It's prudent to use bandpass filters (BPF) to improve the spectralpurity of the sinewave generators' outputs, and small-valued fixedattenuators (pads) are used to keep the generators from adverselyinteracting with each other. (Irecommend 3-dB attenuators for this .)

The power combiner is typically an analog power splitter drivenbackward, and the A/D clock generator output is a squarewave. Thedashed lines at the top in Figure 13″25 indicate that all threegenerators arelocked to the same frequency reference source.

Figure13″26 Time-domain plot of an 8-bit converter exhibiting a missing codeof binary value 0010001, decimal 33. |

Detecting Missing Codes

One problem that can plague A/D converters is missing codes. Thisdefect occurs when a converter is incapable of outputting a specificbinary word (a code ). Thinkabout driving an 8-bit converter with ananalog sinusoid and the effect when its output should be the binaryword 00100001 (decimal 33 );its output is actually the word 00100000(decimal 32 ) as shown in Figure 13″26 above.

The binary word representing decimal 33 is a missing code. Thissubtle nonlinearity is very difficult to detect by examiningtime-domain samples or performing spectrum analysis. Fortunately thereis a simple, reliable way to detect the missing 33 using histogramanalysis.

Figure13″27 An 8-bit converter's histogram plot of the number of occurrencesof binary words (codes) versus each word's decimal value |

The histogram testing technique merely involves collecting many A/Dconverter output samples and plotting the number of occurrences of eachsample value versus that sample value as shown in Figure 13″27 above.

Any missing code (like our missing33 ) would show up in thehistogram as a zero value. That is, there were zero occurrences of thebinary code representing a decimal 33.

Usedwith the permission of the publisher, Prentice Hall, this on-goingseries of articles on Embedded.com is based on copyrighted materialfrom “UnderstandingDigital Signal Processing, Second Edition” by Richard G. Lyons. Thebook can be purchased on line.

Richard Lyons is a consultingsystems engineer and lecturer with Besser Associates. As alecturer with Besser and an instructor for the University of CaliforniaSanta Cruz Extension, Lyons has delivered digitasl signal processingseminars and training course at technical conferences as well atcompanies such as Motorola, Freescale, Lockheed Martin, TexasInstruments, Conexant, Northrop Grumman, Lucent, Nokia, Qualcomm,Honeywell, National Semiconductor, General Dynamics and Infinion.