0% found this document useful (0 votes)
147 views49 pages

Analogdigitalis Atalakitok Tesztelese A1

This document discusses testing analog-to-digital converters (ADCs) using maximum likelihood estimation with a sinusoidal excitation signal. It describes standard ADC testing methods and highlights that maximum likelihood estimation can provide more accurate results. It also outlines several challenges of using maximum likelihood estimation in practice and proposes solutions to issues like the size of the parameter space and the effect of measurement noise.

Uploaded by

Madhusmita Panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views49 pages

Analogdigitalis Atalakitok Tesztelese A1

This document discusses testing analog-to-digital converters (ADCs) using maximum likelihood estimation with a sinusoidal excitation signal. It describes standard ADC testing methods and highlights that maximum likelihood estimation can provide more accurate results. It also outlines several challenges of using maximum likelihood estimation in practice and proposes solutions to issues like the size of the parameter space and the effect of measurement noise.

Uploaded by

Madhusmita Panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Budapest University of Technology and Economics

Faculty of Electrical Engineering and Informatics


Department of Measurement and Information Systems

ADC testing in practice, using maximum


likelihood estimation

„TDK” report

Author
Tamás Virosztek

Supervisor
István Kollár

25th October 2013


Contents

Abstract 3

Introduction 4

1 ADC testing with sinusoidal excitation signal 6


1.1 Measurement setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Requirements on the test environment . . . . . . . . . . . . . . . . . . . . . 8

2 Standards for ADC testing 9


2.1 American standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 Standard IEEE-1057 . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.2 Standard IEEE-1241 . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.3 Sine wave fitting in least squares sense . . . . . . . . . . . . . . . . . 12
2.2 European standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.1 Standard IEC-60748-4-3 . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Theoretical background of maximum likelihood (ML) estimation for ADC


testing 15
3.1 General principles of ML estimation . . . . . . . . . . . . . . . . . . . . . . 15
3.2 ML estimation specialized for ADC testing . . . . . . . . . . . . . . . . . . . 16

4 Problems and solutions concerning the size of the parameter space 20


4.1 Reduction of the parameter space . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2 Appropriate estimation of transition levels . . . . . . . . . . . . . . . . . . . 22

5 The role of noise in ML parameter estimation 24


5.1 Noise models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1.1 Gaussian noise model . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1.2 Laplace noise model . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.1.3 Spectral distribution of noise . . . . . . . . . . . . . . . . . . . . . . 26
5.2 Using noise to relax the optimization . . . . . . . . . . . . . . . . . . . . . . 26
5.3 The effect of noise on the accuracy of estimators . . . . . . . . . . . . . . . 30
5.3.1 Case of low noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.3.2 Case of usual measurement noise . . . . . . . . . . . . . . . . . . . . 31

2
6 Behaviour of ML estimators 32
6.1 The method of observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.2 Simulated measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.3 Estimation results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

7 Software tools for ADC testing 36


7.1 ADC Test toolbox for MATLAB . . . . . . . . . . . . . . . . . . . . . . . . 36
7.1.1 Graphical user interface . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.1.2 Data handling functionalities . . . . . . . . . . . . . . . . . . . . . . 37
7.1.3 Data processing possibilities . . . . . . . . . . . . . . . . . . . . . . . 38
7.2 A LabVIEW tool to perform ADC testing . . . . . . . . . . . . . . . . . . . 43

8 Conclusion 45

9 Outlook 46

Bibliography 47

3
Abstract

There are several different test methods to examine analog-to-digital converters (ADCs).
These techniques are available in the literature, used worldwide, and published in European
and American standards. However, it is possible to extract even more information from a
measurement record, than the standardized methods do.
This paper is focusing on a dynamic ADC test method, the estimation of ADC parameters
with sine wave fitting. The maximum likelihood (ML) estimation of sine wave parameters is
not yet standardized, but provides more accurate estimators for the sine wave on the input
of the ADC, than the currently proposed least squares (LS) method. Thus the quality
parameters of the device under test (the datasheet quantities) can be calculated with
more precision. Naturally this theoretically more established process brings along several
practical difficulties. This paper enumerates the challenges of performing ML estimation
in practice, and proposes solutions for them. Also measurement and simulation examples
are provided for the comparison of standardized and unstandardized test methods.

4
Introduction

Analog-to-digital conversion is essential when sensing of the analog environment and di-
gital processing of signals are required. In embedded systems, the measurement and data
aquisition devices necessarily involve analog-to-digital conversion. As these devices can be
found in numerous products designed by electrical engineers, ADC testing became a key
issue in this field. Following the development of ADC devices it is necessary develop the test
methods as well. For simple, low resolution converters it is feasible to measure the transfer
characteristic of the device with a control loop and a sufficiently accurate (dual slope or
multislope) voltmeter [1]. For the ADCs used nowdays (resolution from 8 up to 24 bits,
sampling rate up to the GS/s range) faster and more effective test methods are required.
Documents like standard IEEE-1241 [1] or standard IEC 60748-4-3 [2] describe several
static and dynamic methods for ADC testing. Important parameters of the device under
test, like effective number of bits (ENOB), signal to noise and distortion ratio (SINAD),
spurious-free dynamic range (SFDR), total harmonic distortion (THD), integral nonlin-
earity (INL), differential nonlinearity (DNL), and others can be calculated using these
methods. However, the full information is usually not extracted from the measurement
record.
Maximum likelihood (ML) parameter estimation provides consistent and asymptotic-
ally efficient estimators for parameters of the excitation signal [4]. This way dynamic ADC
parameters like ENOB and SINAD can be determined more accurately. This theoretic-
ally more established test method provides unbiased datasheet quantities with the lowest
possible variance.
This report is focusing on the practical realization of ML estimation for ADC testing
with sinusoidal excitation signal. Chapter 1 describes the basic principles and problems of
ADC testing, introducing the measurement setup. Chapter 2 presents the „state of art”,
the test methods that are currently described in the literature (primarily in the standards).
Chapter 3 focuses on the specialization of the ML estimation for the case of ADC testing
(solving the problem of the continuous parameter space and the discrete distribution of
the output). These chapters do not contain new results, they are necessary to introduce
the problem, and to ground the following sections containing the novel research outcome.
Chapter 4 deals with the size of parameter space: describes problems and provides solutions
for them. Chapter 5 is about the role of the noise in ML estimation: investigates the effect
of measurement noise on the accuracy of estimators, and also describes the problems of low-
noise measurements (with a proposed solution). Chapter 6 investigates the behaviour of ML

5
estimators using simulated measurements. Results of ML and LS estimation are compared
in this section. In chapter 7 implementations of these test methods are introduced in two
different development enviromnents: MATLAB and LabVIEW. Chapter 8 summarizes the
results and provides conclusion. An outlook to possible directions of further research is
presented in chapter 9.

6
Chapter 1

ADC testing with sinusoidal


excitation signal

ADC test methods can be classified using multiple points of view. There are techniques to
examine the static behaviour and there are others to investigate the dynamic behaviour
of the device under test. There are methods to evaluate the performance of the ADC in
time domain and in frquency domain. The type of the excitation signal on the input is
also an aspect of classification. Any type of analog signals can be used for ADC testing.
Comparison of the excitation signal and the digital record always provides information
about the converter. The main problem is to reconstruct the waveform of the analog signal.
The input of the device under test can only be measured with an other digitizing waveform
recorder. Thus to test an ADC it is requred to have an other, much better ADC. This
requirement is absolutely impractical, and rises theoretical questions about how to examine
the better ADCs. The way to avoid this problem is to estimate the analog signal using the
digital record. This process makes the type of excitation signal important. Waveforms that
can be described with only few parameters can be estimated in practice. Signals like multi-
sine waves or arbitrary periodic signals with numerous harmonic components are barely
appropriate for ADC testing, beacuse they have several signal parameters to estimate.
Sawtooth signal can be described with only three parameters (amplitude, frequency, DC
component). It is also useful for histogram testing, because the probability density function
(PDF) of this signal is uniform between the two extrema, and zero elsewhere. But it is
impossible to generate accurate sawtooth signal because of its unlimited bandwidth, and
it is difficult to examine the quality of the signal generated. Other broadband signals like
triangle or square waves rise the same problem.
Exponential signals also can be used for ADC testing. These signals also can be de-
scribed with three parameters, and can be generated with simple RC circuits. Naturally
there are there are problems with generating pure exponential signals [5], but the quality
of an exponential can be described sufficiently [6]. The framework of ADC testing with
exponential stimulus is described in [7].
Choosing sine waves as excitation signal is very attractive. On the one hand with sine
waves the device is tested at one given freqency, so frequency-dependent behaviour of the

7
converter can be observed easily with multiple measurements at different frequencies. On
the other hand the ipmerfections of the sine wave can be observed easily, using a spectrum
analyzer. As generating pure sine wave is a very common task in electrical engineering,
devices with very good parameters are available for laboratories at affordable prices. Ac-
cording to the subject of this report, an introduction to ADC testing with sine waves will
be presented in the following sections.

1.1 Measurement setup

Examinig ADCs with sinusoidal singnals does not require complex measurement setup. A
sine wave generator provides the signal that drives the analog input, and the response of
the device (the digital codes) are recorded, most frequently by a PC. The generator can
be a full analog circuit (based on oscillators, and analog filters) or can be an arbitrary
waveform generator with ditital-to-analog converter (DAC). In each case it is essential
to examine the quality of the signal created: harmonic distortion, peak-to-average ratio
(PAR) and noise variance are important quantities to determine whether the generator is
appropriate for the measurement or not. Recording the digital codes does not require any
effort in case of standalone converters. These are usually connected to the PC with a high
speed interface (USB or Ethernet), and the producer provides software support for the
device. Our measurements were performed with National Instruments devices, the data
were acquired with the NI LabView software. In case of ADCs integrated to a system (e.g.
a DSP or a microcontroller), recording and transmitting the samples is a programming
task to be solved. The block scheme of the measurement setup is on figure 1.1.

Figure 1.1: Measurement setup for ADC testing with sine wave

8
1.2 Requirements on the test environment

According to the simplicity of the measurement setup, there are only a few requirements
to satisfy regarding the test envinronment. The pureness of the sine wave is a key issue in
both static, both dynamic examination of the ADC. In histogram testing with sine wave
the calculations are based on the PDF of the pure sine wave. Harmonic distortion changes
the PDF of the real excitation signal, thus calculations with the PDF of pure sine wave can
be misleading. In dynamic testing a single sine wave is fitted to the measurement record.
If the record conatins higher harmonic components, these appear in the difference of the
record and the fitted sine wave. This difference is treated as the noise and distortion of
the device under test. If the original excitation signal is distorted, it eventuates fake test
results: harmonic distortion of the device appears to be higher than its real value. Presence
noise also can mislead the evaluation of the measurement. Histogram testing is surprisingly
robust regarding the noise on the excitation signal: as noise changes the PDF of sine wave
mostly near the extrema, effect of noise can be eliminated with high amplitude (120..150
% full scale) sine waves, that overdrive the converters [8]. Sine wave fitting methods are
more sensitive to analog noise: similarly to harmonic distortion, noise in the measurement
record is treated as noise of the ADC, so parameters like ENOB and SINAD seem to be
worse than their actual value. On the other hand noise is an important signal parameter
in ML estimation, and numerical optimization cannot be performed without the presence
of some noise on the analog side. Role and properties of noise are detailed in chapter 5.

9
Chapter 2

Standards for ADC testing

Digital measurement of electrical quantities is essential wherever industry has taken root.
Thus ADCs are manufactured and used wordlwide. However there are only two internation-
ally recognized organizations that provide standards for ADC testing. The American IEEE
(Institute of Electrical and Electronics Engineers) and the European IEC (International
Engineering Consortium) both have elaborated documents that clarify the terminology and
test methods. Outside Europe and America the following cases are possible:

• one of the IEEE and IEC standars is used

• a mixture of the American and European standards is used

• other public documents, like [9] are used

• terminology and test methods differ from company to company.

Japanese engineer and researcher Hauro Kobayashi writes „In most Japanese companies
ADC stendards belong to engineers and there is no comprehensive document that can be
used as a Bible of ADC standards and testing methods” ([10]). This article was published
in 2001, when both standards IEEE-1241, IEEE-1057 and IEC-60748-4 were available.
While the usage of these documents is still confused in several cases, there are attempts to
harmonize the American and European standards [11]. Nevertheless a unified and wordwide
used global standard seems to be a remote possibility only. The best choice nowdays is to
choose one of the documents released, and to use it consistently. The following sections
describe the main traits of the internationally used standards, deal with the advantages
and disadvantages of them and counts the deficiencies of them.

2.1 American standards

The American organization of electrical and electronics engineers (IEEE) provides two
documents concerning ADC testing. Standard IEEE-1057 (last revised in 2007) deals with
digitizing waveform recorders, thus its scope is wider than the scope of standard IEEE-1241
(last revised in 2010) that focuses on analog-to-digital conversion only.

10
2.1.1 Standard IEEE-1057
As this document was developed to define specifications and to describe test methods for
each device that records electrical waveforms digitally, aspects outside the problem space
of analog-to-digital conversion are also mentioned in this standard. Digital oscilloscopes,
digitizing waveform analyzers and recorders contain several other elemnts beyond ADCs,
that are subject of examination. According to these requirements, this document provides
definitions and specifications for the following fields of waveform analysis:

• Input impedance: the analog input of the device can be examined with DC excit-
ation and AC excitation at various frequencies. Usage of a vector impedance meter
is recommended. If measured impedances fit the model, input impedance can be ex-
pressed with the parallel combination of a capacitance and a resistance. Measurement
of the reflection coefficient is also recommended using a time domain reflectometer
(TDR). Input impedance can also be calculated from the value of the reflection coef-
ficient, measured with a high quality cable, whose impedance is known accurately.

• Crosstalk: in case of multichannel devices crosstalk can be measured at any desired


frequencies. This quantity is defined for each channel: to measure the multichannel
crosstalk all other channels shall be driven with the maximum amplitude sine wave
that can be applied. It is required to use common phase sine waves to maximize the
effect of interference.

• Common-mode rejection ratio (CMRR): for signal analyzers with differen-


tial input other quantities can be specified. CMRR can be measured using a large
mplitude sine wave that drives both terminals of the differential input. This way
the excitation signal contains no differential mode component, but a large common
mode component. In the case of ideal device no signal should be recorded. The sine
wave that appears in the waveform record is the effect of the common mode signal
applied. Comparing the amplitude of the applied and measured sine wave, CMRR
can be calculated.

• Trigger delay and trigger jitter: In digitizing oscilloscopes time delay between the
trigger pulse, and the first sample recorded is also an important parameter. Trigger
jitter is the deviation of the trigger delay. It can be estimated performing several
trigger delay measurements. (Affined quantities aperture delay and aperture jitter
are properties of ADCs, so these are detailed in standard IEEE-1241)

• Out-of-range recovery: input voltages outside the full scale range (FSR) of the
digitizer can cause stray effects like saturation of an amplifier, or thermal effects
bacause of the higher power dissipation. The recovery time of the device under test
from the anomalous state to the state of normal operation can be measured using
sine wave fitting. A large (A < 120%F SR) and slow (f < 0.05fsampling ) sine wave
shall be recorded. When the signal leaves the treshold domain and returns to the full
scale range, abnormal samples (samples not fitting to the sine wave) can be observed.

11
Time delay between the return of the signal and the disappearance of the abnormal
samples can be estimated. The so called „mod T plot” of residuals can be very useful
to observe out-of-range recovery.

In the paragraphs above fundamental parameters, measurement setups and evaluation


procedures were itemized regarding digital waveform measurement and analysis excluding
analog-to-digital conversion. As analog-to-digital conversion is a key issue in digital wave-
form measurement, several chapters regarding ADCs appear in this standard. Thus there
is a large overlap between the standards IEEE-1057 and IEEE-1241. Important quality
parameters and standardized test methods for ADCs are detailed in section 2.1.2.

2.1.2 Standard IEEE-1241


This document is focusing on terminology and test methods for analog-to-digital converters
only. Overlapping parts of standard IEEE-1057 and standard IEEE-1241 are introduced in
this section. The main quality parameters of an ADC are the followings:

• Gain and offset: The spread of the real full scale range can be expressed with the
highest and lowest code transition voltage (T [1] and T [2N − 1]). However, it is more
expressive to define quantities offset and gain. Offset denotes the difference between
the endpoints of the theoretical and real full scale range, gain denotes the ratio of
the theoretical and the real average code bin width.

• Linearity: The static transfer characteristic of and ADC is the set of code transition
levels. Code transition level T [k] is a DC voltage value, where the probability of
output code k −1 and k are equal (50-50%). In case of linear ADCs distances between
transition levels are equal, thus:

Tideal [k] = T [1] + Q · (k − 1) (2.1)

where Q denotes the average code bin width. Integral nonlinearity (INL) is the dif-
ference between the ideal and real code transition levels. Thus INL can be evaluated
for each code transition:

T [k] − Tideal [k]


INL[k] = (2.2)
Q

On datasheets integral nonlinearity appears in two different ways. In some cases a


typical INL characteristic of the device is provided, INL[k] is plotted according to
the transition levels. In other cases INL is given as the maximal absolute linearity
error, thus

2N −1
INL = max (|INL[k]|) (2.3)
k=1

12
• Noise and distortion: The most important quality parameters of an ADC are
related to noise and distortion. Signal to noise ratio (SNR), signal to noise and
distortion ratio (SINAD), effective number of bits (ENOB), are both evaluated using
the sine wave fit method in time domain. In these measurements a pure analog sine
wave is recorded, then samples of a sine wave are fitted to the digital record. Sine
wave fitting algorithms are detailed in section 2.1.3.

• Step response: Examining the step response is a very manifest test method for any
device in signal processing. For ADC testing it is required that the imperfections
of the test signal (transition duration, settling time and overshoot) shall not be
greater than the 25 % of the imperfections expected from the device under test. By
processing the record of the step response, quantities of the ADC can be calculated
such as transition duration, overshoot, settling time, limits of slew rate, and many
other parameters.

• Frequency response parameters: Examining the performance of the converter in


the frequency domain is also important to provide useful information for the users.
Frequency domain is usually sweeped from DC to the Nyquist frequency of the device.
To investigate the magnitude of aliasing it also makes sense to use excitation signals
over the Nyquist frequency. Bandwidth and gain flatness can be examined observing
the amplitude response of the ADC in various frequencies. Most of the converters
have no lower -3dB frequencies, as they are capable to measure DC voltages. The
higher boundary of the passband is more important and can be expalined with mul-
tiple reasons. The limited bandwidth of the analog anti-aliasing filter (AAF) reduces
the bandwidth of the entire device. Also slew rate limitations can be sources of lower
amplitude response in higher frequencies. Gain flatness is a useful quantity do de-
scribe the wost case gain error in the passband:

G(f ) − G(fref )
EG (f ) = (2.4)
G(fref )

N
EG = max |EG (fi )| (2.5)
i=1

where fr ef is the reference frequency, where the amplitude response is considered


ideal (in DC coupled devices usually the zero frequency), and fi denotes the freqency
values where the gain was examined.

2.1.3 Sine wave fitting in least squares sense


Three parameter sine wave fit in least squares sense

Fitting samples of a sine wave to a measurement record can be performed minimizing the
following cost function:

13
M
X
CFLS = (y[m] − A cos(2πf tm ) − B sin(2πf tm ) − C)2 (2.6)
m=1

where M denotes the length of the record, tm is the sampling time of the mth sample, A
is the cosine coefficient, B is the sine coefficient, and C is the DC component, and f is the
frequency of the of the fitted sine wave. This cost function shall be minimized with respect
to three parameters, A, B and C. The frequency of the signal is fixed. This least squares
problem is linear in parameters, solution can be calculated in one step with simple matrix
operations:

p = (DT D)−1 Dy (2.7)

where
 
A
p = B  (2.8)
 

C
and
 
cos(2πf t1 ) sin(2πf t1 )
1
 cos(2πf t2 ) sin(2πf t2 ) 1
 
D=
 .. .. ..  (2.9)
. . .


cos(2πf tM ) sin(2πf tM ) 1
and y is the measurement record:
 
y[1]
 y[2] 
 
y= . 
 (2.10)
 .. 

y[M ]

Four parameter sine wave fit in least squares sense

The minimization of the cost function is more complicated, when the frequency of the
signal is also a parameter to estimate. In this case an iterative solution can be performed:
an initial frequency estimator f0 shall be computed, and initial estimators for A0 , B0 and
C0 shall be determined using three-parameter LS fit with given frequency f0 . Then four
parameters Ai , Bi , Ci and ∆fi are to be calculated with the following equation:
 
Ai
 
 Bi 
pi = 
  = (Di T Di )−1 Di y (2.11)
C
 i

∆fi
where

14
 
cos(2πfi t1 ) sin(2πfi t1 ) 1 −Ai t1 sin(2πfi t1 ) + Bi t1 cos(2πfi t1 )
 cos(2πfi t2 ) sin(2πfi t2 ) 1 −Ai t2 sin(2πfi t2 ) + Bi t2 cos(2πfi t2 )
 

Di =  .. .. .. ..  (2.12)
. . . .
 
 
cos(2πfi tM ) sin(2πfi tM ) 1 −Ai tM sin(2πfi tM ) + Bi tM cos(2πfi tM )

Then frequency shall be adjusted: fi = fi−1 + ∆fi−1 , and matrix Di shall be calculated
again with fi . Iteration can be terminated when frequency step ∆f reaches a boundary
defined previously.

2.2 European standards

In Europe, standards for electronic devices are provided by the International Electrotech-
nical Comission (IEC). Standard IEC-60748-4-3 [2] is regarding the dynamic criteria for
analog-to-digital converters. This document has been elaborated by the subcommittee 47A
(integrated circuits) of IEC technical committee 47 (semiconductor devices). First edition
of the standard has been released in 2006.

2.2.1 Standard IEC-60748-4-3


This document is a brief summary of terminology and test methods for ADC testing. Con-
tains only 36 pages instead of the american standards, that contain approximately 150
pages. However, parts of the standard IEC-60748-4 „Semiconductor devices - integrated
circuits” [3] are referenced in this document. Terms and definitions for static behaviour
and characteristics of ADCs are described in Chapter II and Chapter III of the document
referred. In the fist part of standard IEC-60748-4-3 fundamental terms like coherency,
equivalent sampling, code transition, linearity, SINAD, ENOB and others are defined very
briefly. In the second part dynamic test methods like sinusoidal excitation, step response
examination, ramp signal excitation are detailed. In these sections definitions for calcu-
lated quantities such as THD or linearity error are provided. Mathematical derivations,
restrictions on signal generators and figures regarding the measurement setups appear in
the annexes.

15
Chapter 3

Theoretical background of maximum


likelihood (ML) estimation for ADC
testing

3.1 General principles of ML estimation

Maximum likelihood estimation is a very attractive method to estimate parameters of a


model observing the output of the system. To perform estimation, a set of independent
observations (x1 , x2 , ..., xn ) are required. The parameters of the model (α) can be estimated
via the so called likelihood function. To specify the likelihood function, it is necessary to
express the joint density function of all observations:

n
Y
f (x1 , x2 , ..., xn |α) = f (xi |α) (3.1)
i=1

where f (xi |α) denotes the conditional probability density function of the observations with
parameter α. The advantage of the independency of observations is obviously taken in this
case. As we have fixed observations and an unknown parameter vector to estimate, the
joint density function can be used in the following way:

n
Y
L(α|x1 , x2 , ..., xn ) = f (x1 , x2 , ..., xn |α) = f (xi |α) (3.2)
i=1

The likelihood function (denoted by L) specifies the „agreement” of the parameter vector
with the observations. Maximum likelihood estimator of α can be calculated maximizing
the likelihood function:

α̂ML = arg max L(α|x1 , x2 , ..., xn ) (3.3)


α

To ease numerical computation, usually log-likelihood or average log-likelihood functions are


optimized with respect to the parameters. Log-likelihood function is the natural logarithm
of the likelihood function:

16
n
X
l = ln L(α|x1 , x2 , ..., xn ) = ln f (xi |α) (3.4)
i=1

Average log-likelihood is normalized with the number of observations:

n
1 1X
lavg = ln L = ln f (xi |α) (3.5)
n n
i=1

Since logarithm function is strictly increasing, extrema of likelihood and log-likelihood


functions are identical. However a sum can be derived more easily than a product, thus for
optimization algorithms that require to calculate gradient or Hesse-matrix, it is strongly
recommended to use the log-likelihood instead of the likelihood function.
Maximum likelihood estimator has the following properties [4]:

• Consistency: with sufficiently large number of observations, the real model para-
meters can be approximated with arbitrary precision. The ML estimator convergs to
the real value of the parameters.

lim P[|α̂ML − α| > ] = 0 (3.6)


M →∞

where M is the number of independent observations, and  is an arbitrary positive


real number.

• Efficiency: with number of observations tending to infinity, variance of the estimat-


ors reaches the Cramér-Rao bound.

• Asymptotic normality: the distribution of ML estimators is Gaussian with α mean,


when number of samples tends to infinity.

Cramér-Rao bound, Fisher information, and covariance of estimators in case of ML estim-


ation for ADC testing will be discussed in section 3.2.

3.2 ML estimation specialized for ADC testing

For maximum likelihood estimation of ADC testing the following model has been developed
[12]. The converter is described with a set of code transition levels. Transition level T [k] is
the value of the input voltage, that results code k − 1 with probaility of 50%, and code k
with probability of 50% as well. The N-bit quantizer provides codes from 0 up to 2N − 1,
and has 2N − 1 transition levels. The reduced full scale of the converter is the voltage range
between T [1] and T [2N − 1]. Voltage values above the highest transition level result code
2N − 1 and voltages below the lowest transition level result code 0. Quantization can be
described with a function q(x) where

17

0,

 if x < T [1]

q(x) = m, if T [m] < x < T [m + 1] (3.7)


2N − 1, if x > T [2N − 1]

The sinusoidal excitation signal can be described with four parameters:

x(t) = A cos(2πf t) + B sin(2πf t) + C (3.8)

where A is the cosine coefficient, B is the sine coefficient, and C denotes the DC component
of the signal. The frequency of the sine wave is denoted with f . The electronic noise of
the devices, and the imperfections of the measurement environment are modelled with
additional noise on the excitation signal. Multiple noise models can be suitable for ML
estimation, these will be itemized in chapter 5. The most manifest is to assume Gaussian
noise with zero mean and σ standard deviation. Let n(t) denote the realization of the
additive noise. In this model the spectrum of the noise is white, so n(τ1 ) and n(τ2 ) are
independent, if τ1 6= τ2 .
This noisy sine wave is quantized and sampled (the sequence is interchangeable), thus the
output of the ADC can be described this way:

y(k) = q(x(tk ) + n(tk )) (3.9)

where tk denotes the kth sampling time moment (k = 1..M).


The parameters of the model to be estimated to be estimated are the followings:

• The code transition levels of the quantizer: T [1], T [2], ..., T [2N − 1]

• The cosine coefficient of the sine wave: A

• The sine coefficient of the sine wave: B

• The DC component of the sine wave: C

• The frequency of the sine wave: f

• The standard deviation of noise on the excitation signal: σ

As uniform sampling is assumed (effects of incidental nonideal sampling are not considered
in this model), the frequency of the sine wave can be described using the angular frequency
normailzed to the sampling frequency:

f
θ = ωTs = 2π (3.10)
fs
where Ts is the sampling time, and fs denotes the sampling frequency. Thus the parameter

18
vector to be estimated is the following:
 
A
B
 
 
 

 C 

θ
 
 
 
 σ 
p= (3.11)
 
 T [1] 

 
 T [2] 
 
 .. 

 . 

N
T [2 − 2]
 

T [2N − 1]

To express the likelihood of the parameters, it is necessary introduce a vector of discrete


random variables, denoted by Y. Value Y (k) belongs to the k th sample of the measurement
record and can achieve 2N values: it can be any of the output codes of the ADC form 0 to
2N − 1 with a given probaility. These probailities can be described using the error function:
Z x
2
erf(x) = e−z dz (3.12)
π 0
" ! #
1 T [1] − x(tk )
P(Y (k) = 0) = erf p +1 (3.13)
2 σ (2)
" !#
N 1 T [2N − 1] − x(tk )
P(Y (k) = 2 − 1) = 1 − erf p (3.14)
2 σ (2)
" ! !#
1 T [l + 1] − x(tk ) T [l] − x(tk )
P(Y (k) = l) = erf p − erf p (3.15)
2 σ (2) σ (2)

where l = 1..2N -2
To avoid using three different cases it is useful to define two „virtual” transition levels of
the ADC: T [0] = −∞ and T [2N ] = +∞. This way the value of Y (k) can be expressed in
one equation:
" ! !#
1 T [l + 1] − x(tk ) T [l] − x(tk )
P(Y (k) = l) = erf p − erf p (3.16)
2 σ (2) σ (2)

where l = 0..2N -1
The likelihood function for the entire measurement is:

M
Y
L(p) = P(Y (k) = y(k)) (3.17)
k=1

where y(k) is the k th sample of the digital record. Merging the equations above, one can
express the likelihood function this way:

19
M
" ! !#
Y 1 T [y(k) + 1] − x(tk ) T [y(k)] − x(tk )
L(p) = erf p − erf p (3.18)
2 σ (2) σ (2)
k=1

For computations it is feasible to define a cost function, which is the negative log-likelihood
function:

CF(p) = − ln L(p) (3.19)

20
Chapter 4

Problems and solutions concerning


the size of the parameter space

As it is described in chapter 3, the number of parameters strongly depends on the bit num-
ber of the conversion. As the parameter vector contains five signal parameters (A,B,C,θ,σ)
and 2N − 1 code transition levels, the length of parameter vector rises exponentially de-
pending on the number of bits. As quantizers used in practice usually provide from 8 upto
24 bits resolution, the explosion of the parameter space rises serious challenges regarding
computation time and numerical stability. To perform even the most simple numerical op-
timization algorithm, the negative gradient method, it is required to calculate the gradient
of the cost function in each iteration:
 ∂CF(p) 
∂A
 ∂CF(p) 
 ∂B 
∂CF(p)
 
 
 ∂C 
 ∂CF(p) 
 ∂θ 
∂CF(p)  ∂CF(p)

∇CF(p) = = (4.1)
 
∂σ
∂p

 ∂CF(p) 

 ∂T [1] 

 ∂CF(p) 
 ∂T [2] 
 .. 
.
 
 
∂CF(p)
∂T [2N −1]

The most obvious problem is to calculate 2N + 4 partial derivatives in each iteration cycle.
However, this challange can be answered allocating suffucient brute force (e. g. GPU-s)
for the computation. The properties of partial derivatives with respect to the transition
levels are more problematic. To examine this question, it is necessary to express the partial
derivatives. The cost function is the negative log-lokelihood function:

M     
X 1 T [y(k) + 1] − x(k) T [y(k) − x(k)]
CF(p) = − ln erf √ − erf √ (4.2)
2 2σ 2σ
k=1

21
where x(k) is the k th sample of the pure sine wave:

x(k) = A cos(kθ) + B sin(kθ) + C (4.3)

To ease overview of formulas, it is feasible to introduce the following notation:


   
T [y(k) + 1] − x(k) T [y(k) − x(k)]
arg(k) = erf √ − erf √ (4.4)
2σ 2σ
The first order partial derivative of the cost function are expressed below:

M   2  2 
∂CF X 1 2 T [y(k)]−x(k)
√ cos(kθ) T [y(k)+1]−x(k)
√ cos(kθ)
=− e 2σ · √ −e 2σ · √ (4.5)
∂A arg(k) π 2σ 2σ
k=1

M   T [y(k)]−x(k) 2 
T [y(k)+1]−x(k) 2
 
∂CF X 1 2 √ sin(kθ) √ sin(kθ)
=− e 2σ · √ −e 2σ · √ (4.6)
∂B arg(k) π 2σ 2σ
k=1

M   T [y(k)]−x(k) 2 
T [y(k)+1]−x(k) 2
 
∂CF X 1 2 √ 1 √ 1
=− e 2σ · √ −e 2σ ·√ (4.7)
∂C arg(k) π 2σ 2σ
k=1

M
∂CF X 1 ∂arg(k)
=− · (4.8)
∂θ arg(k) ∂θ
k=1

where

  T [y(k)+1]−x(k) 2 T [y(k)]−x(k) 2

A sin(kθ)k − B cos(kθ)k A sin(kθ)k − B cos(kθ)k
 
∂arg(k) 2 √ √
= e 2σ · √ −e 2σ · √
∂θ π 2σ 2σ
(4.9)

M
∂CF X 1 ∂arg(k)
=− · (4.10)
∂σ arg(k) ∂σ
k=1

where

 2 2 
T [y(k)] − x(k) T [y(k) + 1] − x(k)
 
∂arg(k) 2 T [y(k)]−x(k)

T [y(k)+1]−x(k)

= e 2σ · √ −e 2σ · √
∂σ π 2σ 2 2σ 2
(4.11)
The partial derivatives with respect to transition levels are more complicated:

M
∂CF X 1 ∂arg(k)
=− · (4.12)
∂T [l] arg(k) ∂T [l]
k=1

where

22
∂arg(k)
=0 (4.13)
∂T [l]
if y(k) 6= l − 1 and y(k) 6= l. For the majority of k values (for the majority of the samples
in the record), the elements of the sum are zero. Elements are nonzero only if y(k) = l − 1,
in this case
 2
∂arg(k) 2 T [l]−x(k)
√ 1
= e 2σ ·√ (4.14)
∂T [l] π 2σ
and if y(k) = l, in this case
 2
∂arg(k) 2 T [l]−x(k)
√ 1
=− e 2σ ·√ (4.15)
∂T [l] π 2σ
Summarizing the facts detailed above, optimizing the cost function in the entire parameter
space is very problematic. The number of parameters increases exponentially depending
on the bit number of the device under test, and partial derivatives with respect to the
transition levels are very small, or even can be identically zero. Howewer, it is possible to
find a satisfying approximate solution for the maximum likelihood problem.

4.1 Reduction of the parameter space

To perform approximation, it is required to get transition level estimators using other


methods, and optimizing the cost function with respect to the parameters that are domin-
antly determine the likelihood: the four signal parameters (A, B, C, θ), and the deviation
of the noise (σ). Noise is a special parameter in ML estimation, properties and effects
of noise are detailed in chapter 5. To estimate static transfer characteristic of the ADC
it is manifest to use histogram testing. As probability density function (PDF) of a sine
wave is well-known, it is possible to estimate intergal nonlinearity (INL) and differential
nonlinearity (DNL) of the device, using a sinusoidal excitation signal. It is very important
to be able to perform histogram test using a sine wave. As there is no more information
available, than the measurement record, histogram testing and sine wave fitting shall be
computed using the same data: the samples of the sine wave recorded.

4.2 Appropriate estimation of transition levels

To perform histogram test properly, there are some requirements that are easy to describe
in theory, and can barely be satified in practice. These requirements are to ensure that the
distibution of samples in the phase space is uniform between 0 and 2π.

• Coherence: a record is cohenent, if integer number of sine wave periods are sampled.
For M samples and Ts sampling time

M · Ts = N · T0 (4.16)

23
where N is a positive integer, and T0 is the reciprocal of the sine wave frequency.

• Relatively prime condition: the number of periods in a record (N ) and the number
of samples (M ) shall be relatively primes. This condition ensures that each sample
is in a uniqe phase position.

To fulfil these requirements, it is necessary to set the frequency of the sine wave generator
appropriately. Howewer, as both the ADC under test and the generator have frequency
uncertainties, the record can be misleading. It is necessary to investigate coherency after
the measurement, using a very accurate frequency estimator. This way, based on an es-
timator of the real f /fs value, it is possible to discard samples of the record outside the
coherent part, or to suggest to set other frequency values on the generator, to achieve bet-
ter phase distribution of samples. [13] provides detailed information about the framework
of coherency examination. Using proper measurement records, the transition levels can be
estimated with any desired accuracy at a given confidence level using enough number of
samples in a record. Formulas to calculate the required number of samples are described in
[8]. As required record length can be long at higher bit numbers (e. g. for a 16-bit converter
it is not superfluous to acquire multiple million samples), it is a feasible option to estimate
the transition levels from the entire record, and to perform the ML sine wave fit using a
shorter section. This procedure might be useful to speed up computation. Behaviour of
estimators with increasing amount of data is examined in chapter 6.

24
Chapter 5

The role of noise in ML parameter


estimation

5.1 Noise models

There are two requirements regarding the noise model used for ML estimation in ADC
testing. On the one hand this model must be compatible with the physical phenomena that
appear in electronic devices, on the other hand it must be treatable in the mathematical
model.

5.1.1 Gaussian noise model


In this model the noise is assumed to be Gaussian with µ = 0 mean and σ standard
deviation. Thus the probability density function (PDF) of the noise is

1 (x−µ)2
fµ,σ (x) = √ e− 2σ2 (5.1)
2πσ
Assuming that the electronic noise has many independent sources, and the resultant noise
is the sum of many independent random variables, the Gaussian noise model is very attract-
ive. Mathematical properties of this distribution are also suitable: the PDF can be derived
any times anywhere, thus calculating partial derivatives of the cost function with respect
to the parameters can be performed. To validate this model, real PDF of noise can be
estimated taking long measurements with zero excitation, and creating a histogram. These
results show that Gaussian model is a good approximation, however real measurement
noise significantly differs from exact Gaussian distribution. Figure 5.1 shows a histogram
of 1 million measured samples of noise.

25
Figure 5.1: Histogram of noise using 1 million samples

The distribution is not symmetric (skewness is nearly 0.5), and the kurtosis is more than
150% of the kurtosis of normal distribution. To model the more outlier-prone distribution
of noise, other noise models can be considered.

5.1.2 Laplace noise model


The noise can also be modeled with a random variable following the Laplace-distribution
with µ = 0 mean and λ scale parameter. Thus the PDF of the noise is

1
f (x) = λeλ|x−µ| (5.2)
2
This distribution assumes more outliers, and has an other desirable numerical property:
the cumulative distribution function (CDF) can be evaluated using simple exponential
calculations:

Z x  1 eλ(x−µ) , if x < µ
2
F (x) = f (u)du = (5.3)
−∞ 1 − 1 eλ(x−µ) , if x ≥ µ
2

This fact can be important regarding computation time: using Gaussian noise model the
the error function is evaluated very numerous times (at least two times for each sample
of the record). Evaluating a simple exponential is significantly faster than evaluating the
error function that only can be approximated using numerical methods.
The derivatives of the PDF exist anywhere except for the 0. Thus the cost function can be
derived partially with respect to the parameters except for those situations, when a sample
of the pure sine wave in the model is equal with the value of a transition level. In these
cases PDF cannot be derived, thus partial derivation of cost function cannot be performed.

26
5.1.3 Spectral distribution of noise
Maximum likelihood estimation requires independent observations on the output of a sys-
tem to be estimated. To fulfil this requirement, samples of additive noise shall be inde-
pendent at any sampling frequency. Thus spectral distribution of noise must be uniform.
Examining long measurement records of noise show that white noise model is a very good
approximation of the real noise spectrum. Figure 5.2 displays the amplitude spectrum of a
noise measurement record containing 2 million samples. The sampling frequency is fs = 200
kHz, thus the frequency resolution is ∆f = 0.1 Hz. Some minor peaks appear near 20 kHz:
these indicate the electromagnetic pollution of switching-mode power supplies. The emis-
sion of powerlines can also be detected at 50 Hz, however these tiny imperfections no not
question the validity of the white noise model.

Figure 5.2: Spectrum of measurement noise

5.2 Using noise to relax the optimization

As it was mentioned above, noise is a special parameter of the likelihood function. On


the one hand σ is one of the parameters to be estimated: the σ̂ML estimator provides
the maximum likelihood estimation for the deviation of noise. On the other hand in case
of low-noise measurements, σ is rather a tool for the optimization algorithm to find the
extrema of the cost function numerically. This special behaviour is detailed below.
As L(p) is a product of probabilities, defined by the error function, the value of each prob-
ability determines the overall likelihood of the measurement. For the kth sample y(k), the
probability of being between the two corresponding transition levels T [y(k)] and T [y(k)+1]
is the integral of the PDF of Gaussian distribution between T [(k)] and T [y(k) + 1]. The
mean of this distribution is the k th sample of the pure sine wave, desribed using parameters
A, B, C and θ.

27
    
1 T [y(k) + 1] − x(k) T [y(k)] − x(k)
P[T [y(k)] < x(k)+n(k) ≤ T [y(k)+1]] = erf √ − erf √
2 2σ 2σ
(5.4)
where x(k) denotes the k th sample of the pure sine wave: x(k) = A cos(kθ) + B sin(kθ) + C,
and n(k) is the k th sample of the gaussian noise. With the same sine wave parameters and
different noise variance these probabilities can be very different. On figure 5.3 the sample
of the pure sine wave is between transition levels T [y(k)] and T [y(k) + 1]. In case of low
noise variance, only output code y(k) is compatible with the sine wave parameters A, B, C
and θ. Increasing parameter σ, the adjacent codes also become compatible, they can occur
with a finite probability.

Figure 5.3: Probability density of a noisy sample with different noise devi-
ations

This connection between noise and output codes can be reversed to likelihood: with a
given mesurement record, the set of compatible parameter vectors depends on the noise
deviation. Permitting high σ a wide range of parameter vectors become compatible with
the measurement, but none of them is very likely. In case of low noise, only a narrow scale
of parameter vectros is compatibe, but their likelihood is high, can be nearly 1. When
noise is arbitrary low (lim σ → 0), each sample can be totally compatibe with the sine
wave parameters (the likelihood of the parameters for that sample is 1) or can be totally
incompatible (the likelihood of parameters for that sample is 0). This way the likelihood
function can also be either 0 or 1 for a given parameter vector. In this case the first and
second order partial derivatives (elements of the gradient and the Hess-matrix) are 0 or
do not extist. Thus numerical optimization algorithms based on derivatives such as Gauss-
Newton method or Levenberg-Marquardt method cannot optimize this likelihood function.
The solution for this problem can be described in a few steps:

1. Calculate initial estimators for parameters A, B, C, and θ using four parameter sine
wave fit in least squares sense.

28
2. Calculate estimators for transition levels using histogram of the record (be sure to
fulfil requirements of histogram test).

3. Calculate initial estimator for noise using the quantized pure sinewave and the real
measurement record:

v
u M
u 1 X
σ0 = t (q(xLS (k)) − y(k))2 (5.5)
M −1
k=1

where xLS (k) is the k th sample of sine wave assembled using LS estimators. If σ0 = 0
(the quantized pure sine wave is identical with the measured sine wave), or too low,
increase σ0 artificially. Setting σ0 = 0.5 LSB is a good decision according to our ex-
perience. Depending on the numerical evaluation of error function, it is recommended
to increase σ0 artificially if σ0 is below 0.1 LSB.

4. Start optimization. The Levenberg-Marquardt method with scale factor (λ) adjusted
appripriately at each iteration converges to the minimum of the cost function. If
optimization fails according to numeric problems, the initial noise estimator might
be too low. It shall be increased artificially as described in step 3.

The following figures trace the progress of optimization in case of low-noise measurement.
The likelihood function is displayed with respect to two parameters: A and B. DC com-
ponent and frequency are kept constant, and the deviation of noise changes in each step.

Figure 5.4: Initial LS estimators are incompatible with the measurement: the
likelihood is 0 and no derivatives can be calculated

29
Figure 5.5: Increasing σ smoothes the likelihood function: partial derivatives
can be calculated, optimization can be initialized.

Figure 5.6: The smoothed cost function can be optimized numerically: estim-
ators find the extremum.

30
Figure 5.7: Decreasing the noise deviation sharpens the likelihood function.

Figure 5.8: Noise is decreased to arbitrary low value: the likelihood of the para-
meters reaches 1

5.3 The effect of noise on the accuracy of estimators

The Cramér-Rao bound is the theoretical lower bound for the covariance of ML estimators.
The covariance of estimators cannot be lower than the inverse of the Fisher-information.
Fisher information is defined using second order partial derivatives of the log-likelihood

31
function:

∂ 2 ln L(p)
 
I(p) = −E (5.6)
∂2p
As the cost function is the negative logarithm of the likelihood function, the Fisher inform-
ation can be expressed using the Hess-matrix of the cost function.
 ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF

∂2A ∂A∂B ∂A∂C ∂A∂θ ∂A∂σ
 ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF 
∂2B
 ∂B∂A ∂B∂C ∂B∂θ ∂B∂σ 
 2
∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF 

I(p) = E ∂ CF (5.7)
 ∂C∂A ∂C∂B ∂2C ∂C∂θ ∂C∂σ 
 ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF 
 ∂θ∂A ∂θ∂B ∂θ∂C ∂2θ ∂θ∂σ 
∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF ∂ 2 CF
∂σ∂A ∂σ∂B ∂σ∂C ∂σ∂θ ∂2σ

As Hess-matrix of the cost function is calculated in each iteration cycle to perform Levenberg-
Marquardt step, Cramer-Rao bound can be estimated using the Fisher information matrices
calculated in the last iteration cycle.

cov(p) ≥ I−1 (p) (5.8)

5.3.1 Case of low noise


As it is visible on figure 5.8, in case of low noise there is a set of parameter vectors with
likelihood 1, and the likelihood of parameter vectors outside this set is 0. Each parameter
vector with likelihood 1 is maximum likelihood estimator of the sine wave. Depending
on the initial estimators and settings of the optimization algorithm, different parameter
vectors with likelihood 1 can be reached. The Cramér-Rao bound cannot be calculated
for this case: as the cost function is flat (constant 0) in the minima, the Hess-matrix is
identically zero. Thus Fisher infromation matrix cannot be inverted and the theoretical
lower bound for variance cannot be calculated.

5.3.2 Case of usual measurement noise


If measurement noise is high enough, shape of the likelihood function (and the cost func-
tion) is smoother: the curvature of the cost function near the minima can be calculated.
This way it is possible to estimate the Fisher information (the expected value of Hess-
matrices), and to calculate the Cramér-rao bound.

32
Chapter 6

Behaviour of ML estimators

Properties of maximum likelihood estimators are detailed in chapter 3. In the following


sections experimental results are provided to observe behaviour of ML estimators used for
ADC testing.

6.1 The method of observation

To examine the quality of estimators it is required to know the exact value of the given
parameter. Investigating estimator properties such as consistency or variance is impossible
without the theoretical value of the parameter estimated. In case of real measurements
only other estimators are available regarding the signal parameters. Thus simulated meas-
urements shall be performed to examine behaviour of estimators. The framework of invest-
igation contains the following steps:

1. Chose a fix set of signal parameters. These will be used in the steps detailes above.

2. Perform multiple simulated measurements with the same signal parameters and the
same amount of noise. As the realization of noise is different in each case, but signal
parameters do not change, variance of estimators can be observed through these
repeated measurements.

3. Create different sets of measurements, varying the number of sample, amount if noise,
resolution, etc.

4. Process the simulated measurement record and store the estimators achieved.

5. Compare the calculated estimators to the real parameters: observe variance, consist-
ency, etc.

6.2 Simulated measurements

Instead of using simulated measurement data created by myself, I have processed data
provided by Ing. Jozef Liptak, PhD student of the Technical University of Kosice. In
these simulations the device under test is an 8-bit nonlinear ADC. The static transfer

33
characteristic has been derived from the measured transfer characteristic of the device
NI-USB-6009 (see figure 6.1).

Figure 6.1: Integral nonlinearity of the simulated ADC under test

Amplitude, phase and DC component of the signal was fixed. Each set of simulated meas-
urements contains 20 records, these records are results of simulations with identical signal
parameters, and different realization of noise. To observe consitency and asymptotic beha-
viour of estimators, the number of samples increased from 1000 up to 100000. To ensure
coherency, in each case 1 total period of the sine wave has been recorded, thus the fre-
quency varied depending on the number of samples: f /fs = 1/M , where M denotes the
length of the record.

6.3 Estimation results

Seven sets of simulated measurement have been processed. The lengths of the records
in these sets are 1000, 2000, 5000, 10000, 20000, 50000 and 100000 respectively. Twenty
different data vectors have been processed in each set: thus expected values and variances of
the estimators have been calculated. As both LS and ML estimators have been computed,
behaviour of the two different types of estimators can be compared. To create readable
illustrations, only three values have been drawn for each estimator: the expected value,
and the µ + 3σ and µ − 3σ boundaries. Figures 6.2, 6.3, 6.4 and 6.5 displays the results
achieved: the relative errors of estimators depending on the length of record.

34
Figure 6.2: ML and LS estimation of the cosine coefficient

Figure 6.3: ML and LS estimation of the sine coefficient

35
Figure 6.4: ML and LS estimation of the DC component

Figure 6.5: ML and LS estimation of the sine wave frequency

These results show the difference between LS and ML estimators: while LS estimator finds
the best fitting sine wave in the output code domain, the nonlinearity of the converter
misleads the LS estimators. ML estimators find the most likely sinewave that produces the
recorded output: nonlinearity of ADC is handled in this model.

36
Chapter 7

Software tools for ADC testing

To perform ADC testing in practice, it is necessary to have software tools to automate


the process of data acquisition, signal processing, and evaluation of measurement results.
In this section two software tools are presented: one of them is a MATLAB toolbox for
offline data processing, the other is a LabVIEW virtual instrument (VI). Both of them
are developed by the author: though the ADC Test toolbox is based on the idea of the
previous versions of ADC testing software developed by János Márkus, the functionality
has been extended very largely, and the program code has been completely re-written (only
the four parameter sine wave fit algorithm has been merged from the old toolbox). The
LabVIEV VI contains very important MathScript codes written by Vilmos Pálfi, however
data acquisition, dataflow programming, user interface and other MathScript codes have
been developed by the author.

7.1 ADC Test toolbox for MATLAB

This program is a set of coherent MATLAB functions using Graphical User Interface (GUI).
The goal of this software is to ease the process of ADC testing: using this envinronment,
offline signal processing and measurement evaluation can be performed without any pro-
gramming or deeper domain knowledge required. This toolbox provides the following main
functionalities:

• Assembling measurement descriptors from acquired data and circumstances.

• Storing and handling measurement descriptors.

• Processing maeasurement records and evaluating results in multiple ways, such as

– Sine wave fitting in least squares sense


– Histogram testing using sine waves
– Sine wave fitting using maximum likelihood estimation
– Frequency domain analysis (FFT test)

37
7.1.1 Graphical user interface
The main window of the program is presented in figre 7.1. The functionalities appear
separately on the screen. Information about the actual measurement descriptor is displayed
in the center frame. On the top of the window, current measurement can be selected from
the list of descriptors loaded, using a popup-menu. The data handling functionalities appear
on the right side of the screen. Data processing possibilities are itemized in the lower frame
of the main window.

Figure 7.1: Main window of the user interface

7.1.2 Data handling functionalities


The toolbox provides the following options to handle measurement descriptors:

• Import: Importing entire measurement descriptors from the MATLAB workspace.

• Export: Exporting entire measurement descriptors to the MATLAB workspace.

• Load: Loading measurement descriptor from a specific XML file.

• Save: Saving measurement descriptor to a specific XML file.

• Delete: Removing actual measurement descriptor from the memory (does not affect
files on disk).

• New: Creating new measurement descriptor: it can be assembled using the raw data
(imported from the workspace) and the measurement circumstances.

• Edit: Editing existing measurement descriptor: more circumstances can be added,


or incorrect information can be fixed.

38
The „New” option also allows the user to perform simulated measurements. This feature can
be reached using the „Simulate measurement” pushbutton. Parameteres of the simulated
measurement can be set such as the parameters of the excitation sine wave, the noise on the
analog signal, and the transfer characteristic of the ADC under test. This characteristic can
be previously measured, or assembled arificially. In the previous case the vector containing
the INL values can be loaded from the MATLAB workspace, in the latter case the INL
vector can be assembled from shapes (like sine wave or Hann window) and additive noise
(like Gaussian or uniformly distributed).

7.1.3 Data processing possibilities


The main goal of the software tool is to process and evaluate measurements. There are
multiple methods to process a measurement for ADC testing, in this toolbox four of them
are implemented.

Four parameter sine wave fit in least squares sense

This dynamic test method has been developed to determine the effective number of bits
(ENOB), and the signal to noise and distortion ratio (SINAD). The excitation signal is
sinusoidal, thus a sine wave shall be fitted to the measurement record. The numerical
methods used to perform the fit properly are described in section 2.1.3. The results are
displayed in a dialog box, shown on figure 7.2. The estimated sine wave parameters and the
calculated ADC parameters appear numerically, and the fitting residuals are displayed in
two ways: statistical properties can be observed via the histogram, and Mod-T plot shows
the location of the residuals in the phase space.

Figure 7.2: Results window for LS fit

39
Histogram test using sine waves

Estimation of static transfer characteristic of the ADC is also possible using sine waves. To
perform histogram test properly, it is very important fo fulfil a few requirements regarding
the settings of the excitation signal and the sampling. These requirements are itemized in
section 4.2. This feature of the toolbox performs two tasks:

• Investigates whether the measurement record is appropriate for histogram testing or


not.

• Calculates and displays estimators for integral and differential nonlinearity.

In case of inappropriate measurement records, warning meaasages appear to notice the user
about the problems and the reasons (such as low number of samples, fractional periods, low
signal amplitude, etc.). Figure 7.3 shows the estimated integral and differential nonlinearity
of a 16-bit successive approximation ADC.

Figure 7.3: Results window for histogram test

FFT test

Frequency domain processing of a measurement record is also a useful option. Examining


the DFT of the measurement record provides information about the harmonic distortion,
the amount of noise and the spurious components. A very important quantity, the Spurious-
free dynamic range, SFDR of the ADC under test can be calculated using the FFT of the
record. In the results window (see figure 7.4), frequencies and magnitudes of the harmonic
components appear. The SFDR is calculated relative to the carrier, and relative to the full

40
scale (FS) of the converter. The amplitude spectrum of the record is also displayed from
DC up to the Nyquist-freqency.

Figure 7.4: Results window for FFT test

In frequency domain analysis it is very important to avoid spectral leakage. In this toolbox
three different windowing functions can be applied in time domain: Hann, Blackman, and
3-term Blackman-Harris windows are available. Naturally DFT can be performed without
windowing, choosing the „None (rect)” option in the „Windowing” popup menu.

Sine wave fitting using maximum likelihood estimation

The most complex task implemented by the toolbox is the maximum likelihood estimation
of sine wave parameters. Theoretical fundamentals, practical difficulties and solutions are
detailed in the previous chapters. In this section ML estimation will be described only from
the user’s perspective. To perform estimation it is required to achieve initial estimators
for both the excitation signal parameters and the code transition levels. These can be
calculated using four parameter sine wave fit and histogram test. An initial estimator for
the noise variance also shall be calculated as it is described in section 5.2. Then extrema
of the likelihood function can be reached via numerical optimization. Figure 7.5 shows the
framework of ML estimation.

41
Figure 7.5: Framework of ML parameter estimation

Calling „ML fit” from the main window implicitly calls four parameter LS fit and histogram
testing routines. Settings of LS fit shall be specified in a dialog box, and histogram test
routine displays information (warnings, if necessary) regarding the appropriateness of the
record. The numerical optimization can be followed via the GUI. As shown in figure 7.6,
the actual values of the parameter estimators and the cost function are displayed in each
iteration cycle. The scaling factor of the Levenberg-Marquardt step (λ) changes in each
iteration, thus value of λ is also updated continuously. The user can specify the termination
criteria for the optimization (such as termination tolerance, maximum number of iterations,
or maximum number of cost function evaluations). Iteration can be stopped, paused and
resumed using the pushbuttons on the right side of the window.

42
Figure 7.6: Following iterations cycles of ML estimation

Extremum of the cost function found by the optimization algorithm provides the ML
estimators for the sine wave parameters. This way sine wave fit can be performed using
the sine wave estimated in LS sense, and using the sine wave estimated via the maximum
likelihood method. ADC parameters (datasheet quantities like ENOB and SINAD) can be
calculated using both the ML and LS estimators. This way results of ML and LS fit can
be compared easily in a comparison window (see figure 7.7). On the screenshot provided,
ML and LS estimation is performed for a nonlinear ADC, thus differences in the fitted sine
wave and the calculated device parameters can be observed. Note that the LS fit minimizes
the mean squared value of residuals, thus minimizes the power of noise and distortion. This
way SINAD and ENOB cannot be higher than their values calculated using LS estimators.

43
Figure 7.7: Comparison of results using ML and LS estimators

7.2 A LabVIEW tool to perform ADC testing

The LabVIEW environment provides advanced software interfaces to measurement and


data acquisition devices. The MathScript module also allows the developer to implement
complex signal processing algorithms in a text-based programming language. This way
excitation signal generation, data acquisition, and data processing can be integrated into
one software component: a virtual instrument (VI). The front panel of the VI (see figure
7.8) provides the user interface. On the front panel

• settings of the signal generator (DAC) and parameters of the sine wave generated
can be specified,

• settings of data acquisition (sample rate, length of record) can be specified,

• data acquisition can be performed and repeated using a pushbutton,

• data processing results are displayed numerically and graphically.

44
Figure 7.8: Front panel of the virtual instrument

To generate analog excitation signal, this VI uses an NI 9263 analog output module contain-
ing a 16-bit DAC. The data acquisition device is an NI 9201 analog input module containg
a 12-bit ADC. This ADC is the device under test in this project. To write scalable and
maintainable code, the complex signal processing algorithms are encapsulated in subVIs.
Each subVI performs a general task like sine wave fitting, coherency investigation or INL
estimation. These elements can be called from multiple different top level VIs depending
on the purpose of the application.

45
Chapter 8

Conclusion

This report is focusing on the practical issues of ADC testing using ML parameter estim-
ation. To introduce this topic it is necessary to motivate the usage of the ML method.
Thus currently standardized and used techniques are also described in this paper. The
first three chapters present the state of art, the other chapters contain the results of my
research efforts. These results can be summarized in the following points:

• Maximum likelihood estimation can be performed despite of the problems detailed


in chapter 4 and chapter 5, using the solutions proposed in those sections.

• Properties of ML estimators have been examined via simulated measurements.

• The ML method has been implemented in MATLAB and LabVIEW envinronments.


The MATLAB toolbox is available on the web [14]. The LabVIEW VI performs
excitation signal generation, data acquisition and signal processing in one software
unit.

The majority of this study deals with the challenges and difficulties of the realization.
The most important outcome of this research is that maximum likelihood estimation of
ADC parameters is feasible, and does not require excessive efforts. However, the process
of measurement evaluation is more complex than that of the standard methods. To cal-
culate ML estimators properly, it is necessary to perform supporting computations like
examination of coherence, histogram testing and four parameter sine wave fit in LS sense.
Nevertheless the entire framework of ML estimation can be integrated into one software
tool (see chapter 7), and measurement evaluation can be performed with acceptable time
consumption. For a usual measurement record (from 10000 up to 1 million samples, resol-
ution from 12 up to 16 bits), total computation (from the raw measurement data to the
calculated datasheet quantities) takes a few or a few tens of seconds.
Sine wave fit using maximum likelihood estimation is realizable, and provides more
accurate datasheet quantities than the ones calculated using standard methods. Using ML
parameter estimation for ADC testing is recommended in each case, when it is worth
making more efforts to increase the precision.

46
Chapter 9

Outlook

Using maximum likelihood estimation for ADC testing is a new and yet unusual method
to examine quality of analog-to-digital converters. Researchers working in this area have
developed the theoretical background of this method, and investigated the properties of ML
estimation. The results are partly achieved via simulations, because examining a parameter
estimation method without the exact value of the model parameters is impossible. In case
of simulated measurements some of the nonideal phenomena are modeled, but all kinds
of disturbances cannot be described and simulated properly in one model. Processing real
measurement records highliths excellently the practical challenges that appear in ADC
testing using ML estimation. Most of the problems investigated in the previous chapters
occured when real measurement records were processed. The following aims are attractive
for further efforts:

• Describing nonideal phenomena appearing in measurements.

• Extending the model to handle nonideal sampling (jitter).

• Decreasing the computation time of numerical optimization:

– Implementing the core of the algorithm in lower level computing language (e.g.
C/C++ instead of MATLAB or LabVIEW).
– Parallelizing the algorithm wherever it is possible. This way computation time
can be improved significantly using technologies like OpenMP API or general
purpose GPUs.

• Improving the robustness of the algorithm to be prepared to handle almost all the
problems that can occur in real measurement.

The topics itemized above are closely related to the questions that are raised and largely
answered in this report. Thus examination of the problems collected in this outlook can
be based on the results described in the previous chapters.

47
Bibliography

[1] Standard IEEE-1241-2010, IEEE Standard for Terminology and Test Methods for
Analog-to-Digital Converters, 2011

[2] International Standard IEC 60748-4-3, Interface integrated circuits - Dynamic criteria
for analog-to-digital converters, 2006

[3] International Standard IEC 60748-4, Semiconductor devices - Integrated circuits - In-
terface integrated circuits, 1997

[4] Schnell, László (Ed.): Jelek és rendszerek méréstechnikája (Measurement technology of


Signals and Systems), Műszaki Könyvkiadó, Budapest, 1985. (in Hungarian)

[5] Linus Michaeli, Michal Sakmár, Ján Saliga Some errors of analogue signal sources
for ADC exponential stimulus histogram test, Proceedings of the 15th IMEKO TC-4
International Symposium on Novelties in Electrical Measurement and Instrumentation,
September 18-22, Iasi, Romania, pp. 51-56

[6] Carni, D.L.; Grimaldi, D.; Michaeli, L.; Saliga, J. Measurement of the exponential signal
distortion, IEEE Intsrumentation and Measurement Technology Conference (I2MTC),
Graz, 13-16th May, 2012. DOI.: 10.1109/I2MTC.2012.6229424

[7] Jan Saliga, Linus Michaeli, Michal Sakmár, Jan Busa Processing of bidirectional expo-
nential stimulus in ADC testing, Measurement, 2010

[8] Jerome Blair Histogram Measurement of ADC Nonlinearities Using Sine Waves, IEEE
Transactions on Instrumentation and Measurement, vol. 43, No. 3, June 1994, pp. 373-
383.

[9] Analog Devices Analog-Digital Conversion: Testing data converters,


http://www.analog.com/library/analogdialogue/archives/39-
06/Chapter%205%20Testing%20Converters%20F.pdf

[10] Hauro Kobayashi et al. ADC standard and testing in Japanese industry, Computer
Standards and Interfaces 23 (2001) pp. 57-64

[11] E. Balestrieri, P. Daponte, S. Rapuano ADC Standard Harmonization: Comparison


of Test Methods, I2MTC 2008 - IEEE International Instrumentation and Measurement
Conference, Victoria, Vancouver Island, Canada, May 12-15, 2008

48
[12] L. Balogh, I. Kollar, A. Sárhegyi Maximum likelihood estimation of ADC paramet-
ers I2MTC 2010 - IEEE International Instrumentetion and Measurement Conference,
Austin, Texas, USA, May 3-6, 2010

[13] Vilmos Pálfi, István Kollár Improving the result of the histogram test using a fast
sine fit algorithm, 19th IMEKO TC 4 Symposium and 17th IWADC Workshop: Ad-
vances in Instrumentation and Sensors Interoperability. Barcelona, Spain, 18/07/2013-
19/07/2013. Paper 118.

[14] ADCTest project site: http://www.mit.bme.hu/projects/adctest

49

You might also like