Commit d4cefa6e authored by Federico Asara's avatar Federico Asara

Documentation update.

parent a94a3ced
......@@ -75,29 +75,33 @@ theorems-ams
\begin_layout Title
ACT
\begin_inset Newline newline
\end_inset
\end_layout
\begin_layout Subtitle
ADC Characterization Toolkit
\end_layout
\begin_layout Author
Federico Asara
\begin_inset Newline newline
\end_inset
Juan David Gonzalez Cobas
\end_layout
\begin_layout Abstract
In this article I will provide a brief introduction to ADCs and their performanc
e parameters, along with the procedures to calculate them.
In this document I will provide a brief introduction to ADCs and their performan
ce parameters, along with the procedures to calculate them.
\end_layout
\begin_layout Abstract
Then I will present you ACT, the ADC Characterization Toolkit, a Python-powered
application that interfaces with ADCs via the Python ADC INterface API,
PAIN.
ACT presents three characterization modalities, depending on the input
given to the ADC: single-tone input wave, two-tone input wave, and a frequency
sweep in order to evaluate the ADC transfer function.
application to evaluate the performances of ADCs.
The goal of this tool is to work with three different kind of signals:
a single sinusoidal wave, to evaluate static and dynamic parameters; two
sinusoids with very close frequencies, to evaluate the intermodal distortion;
sinusoidal wave with frequency sweep, to evaluate the ADC frequency response.
\end_layout
\begin_layout Section
......@@ -105,12 +109,418 @@ Brief introduction to ADCs
\end_layout
\begin_layout Standard
Last summer student's work should be enough.
Analog-to-digital converters, in short ADCs, are electronic devices which
translate analog quantities in digital numbers.
Usually analog input variables are converted by transducers into voltages
or currents.
An ADC is defined by three parameters:
\end_layout
\begin_layout Description
N the number of bits used to store each sample;
\end_layout
\begin_layout Description
FSR Full Scale Range, range of the analog values that can be represented
by the device;
\end_layout
\begin_layout Description
LSB Least Significant Bit, is the minimum change in the input that guarantees
a change in the output, defined as
\begin_inset Formula
\begin{equation}
LSB=\frac{FSR}{2^{N}}\label{eq:LSBdef}
\end{equation}
\end_inset
\end_layout
\begin_layout Standard
The transfer function of an ADC shows the relation between the input and
the output, and also shows the quantization error generated by the conversion.
A transfer function of an ideal ADC is show in
\begin_inset CommandInset ref
LatexCommand formatted
reference "fig:Ideal-ADC-transfer"
\end_inset
.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\noindent
\align center
\begin_inset Graphics
filename images/adc_ideal.png
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Ideal-ADC-transfer"
\end_inset
Ideal ADC transfer function
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Subsection
Parameters explained
\end_layout
\begin_layout Standard
DNL stands for Differential Non Linearity, and it is defined as the difference
between an actual step width of the transfer function and the LSB.
An ideal ADC will thus have
\begin_inset Formula
\[
DNL_{i}=0\quad\forall i
\]
\end_inset
since every step is exactly 1 LSB.
The DNL is defined as follow:
\begin_inset Formula
\[
DNL_{i}=\frac{f(V_{x+1})-f(V_{x})}{LSB}-1\quad i\in]0,2^{N}-2[
\]
\end_inset
\end_layout
\begin_layout Remark
If the DNL respect the following condition:
\begin_inset Formula
\[
DNL_{i}\leq1\, LSB\quad\forall i
\]
\end_inset
\end_layout
\begin_layout Remark
then the transfer function
\begin_inset Formula $f(x)$
\end_inset
is monotonic, with no missing codes.
\end_layout
\begin_layout Standard
INL, Integral Non Linearity, is described as the deviation, in LSB or as
a FSR percentage, of an actual transfer function from a straight line.
The INL error magnitude depends directly on the position chosen for this
straight line.
The theoretical formula of measuring INL is the following:
\begin_inset Formula
\[
INL=\left|\frac{f(V_{x})-f(V_{0})}{LSB}-x\right|\quad i\in]0,2^{N}-1[
\]
\end_inset
\end_layout
\begin_layout Standard
The SNR, Signal to Noise Ratio, show how much a signal has been corrupted
by noise.
The theoretical value of the SNR is defined as follows:
\begin_inset Formula
\[
SNR_{th}=6.02*N+1.76\quad[dB]
\]
\end_inset
\end_layout
\begin_layout Standard
The THD, Total Harmonic Distortion, is defined as the ratio of the signal
to the RSS of a specified number of harmonics of the fundamental signal.
IEEE Std.
1241-2000 suggests to use the first 10 harmonics.
A THD rating < 1% is desired.
\begin_inset Formula
\[
THD_{n}=10\log\left(\sum_{i=2}^{n}10^{\left[\frac{h_{i}}{20}\right]^{2}}\right)
\]
\end_inset
\end_layout
\begin_layout Standard
where
\begin_inset Formula $h_{i}$
\end_inset
is the i-th harmonic expressed in dB.
\end_layout
\begin_layout Section
Formulae and alghorithms
Parameters evaluation formulae and algorithms
\end_layout
\begin_layout Subsection
Incoherent sampling
\end_layout
\begin_layout Standard
The biggest
\emph on
problem
\emph default
we have to account for when evaluating performances of an ADC is incoherent
sampling: a sampling is incoherent if
\begin_inset Formula
\[
\frac{f_{s}}{f_{0}}\notin\mathbb{N}
\]
\end_inset
\end_layout
\begin_layout Standard
Incoherency in sampling will produce the so-called spectral leakage;
\begin_inset CommandInset ref
LatexCommand formatted
reference "fig:spectral_leakage"
\end_inset
shows how an incoherently sampled sine-wave suffers from spectral leakage:
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
http://gaussianwaves.blogspot.com/2011/01/fft-and-spectral-leakage.html
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\begin_inset Graphics
filename images/sineWave_FFT_spectral_leakage.png
width 100text%
\end_inset
\begin_inset Caption
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:spectral_leakage"
\end_inset
Spectral leakage of an incoherently sampled sine-wave
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Since it interferes with all our formulae, we must find a way to
\emph on
artificially remove
\emph default
it.
The best way so far only works assuming that we have a single tone signal
\begin_inset Formula $x[n]$
\end_inset
.
\end_layout
\begin_layout Standard
First of all we compute the DFT:
\begin_inset Formula
\[
X[f]=DFT\left\{ x[n]\right\}
\]
\end_inset
and then we compute:
\begin_inset Formula
\begin{equation}
\alpha_{1}=\arg\max\left|X[f]\right|\label{eq:alpha1}
\end{equation}
\end_inset
and:
\begin_inset Formula
\begin{equation}
\alpha_{2}=\begin{cases}
\alpha_{1}+1 & \left|X[\alpha_{1}+1]\right|\geq\left|X[\alpha_{1}-1]\right|\\
\alpha_{1}-1 & otherwise
\end{cases}\label{eq:alpha2}
\end{equation}
\end_inset
\end_layout
\begin_layout Standard
\begin_inset Formula $\alpha_{1}$
\end_inset
is the index of the highest peak in
\begin_inset Formula $\left|X[f]\right|$
\end_inset
, and
\begin_inset Formula $\alpha_{2}$
\end_inset
is its follower.
From these values we can compute the strength of the incoherency:
\begin_inset Formula
\begin{equation}
\beta=\frac{M}{\pi}\arctan\left(\frac{\sin\frac{\pi}{M}}{\cos\frac{\pi}{M}+\frac{X[\alpha_{1}]}{X[\alpha_{2}]}}\right)\label{eq:beta}
\end{equation}
\end_inset
\end_layout
\begin_layout Standard
The peak lies between
\begin_inset Formula $\alpha_{1}$
\end_inset
and
\begin_inset Formula $\alpha_{2}$
\end_inset
:
\begin_inset Formula
\begin{equation}
\alpha=\alpha_{1}+\beta\label{eq:alpha}
\end{equation}
\end_inset
\end_layout
\begin_layout Standard
We can then use
\begin_inset Formula $\alpha$
\end_inset
as the initial frequency guess for the sinefit4 algorithm, obtaining
\begin_inset Formula $\bar{\omega_{0}}$
\end_inset
.
Then:
\begin_inset Formula
\begin{equation}
\alpha_{0}=\frac{\bar{\omega_{0}}}{\omega_{s}}M\label{eq:alpha0}
\end{equation}
\end_inset
is an improvement over
\begin_inset Formula $\alpha$
\end_inset
.
We can then use this to trim
\begin_inset Formula $x[n]$
\end_inset
:
\begin_inset Formula
\begin{equation}
x_{c}[n]=x[n]\quad\forall n=0..i\label{eq:trim}
\end{equation}
\end_inset
where:
\begin_inset Formula
\[
i=\left\lfloor 0.5+M\frac{\left\lfloor \alpha_{0}\right\rfloor }{\alpha_{0}}\right\rfloor
\]
\end_inset
\end_layout
\begin_layout Standard
We can use
\begin_inset Formula $x_{c}[n]$
\end_inset
to compute all the other parameters; from now on we will refer to
\begin_inset Formula $x[n]$
\end_inset
as a coherently sampled signal, unless otherwise specified.
\end_layout
\begin_layout Subsection
......@@ -133,24 +543,161 @@ ideal histogram
The signal used in this case is a sinusoid.
\end_layout
\begin_layout Standard
The histogram should theoretically have
\begin_inset Formula $R_{t}=2^{N}$
\end_inset
bars: for high N values, however, we will have to many bins, slowing down
the computation.
We fix a resolution limit
\begin_inset Formula $R_{l}$
\end_inset
such that we have:
\begin_inset Formula
\begin{equation}
R=\min\text{\left(R_{l},R_{t}\right)}\label{eq:histres}
\end{equation}
\end_inset
\end_layout
\begin_layout Standard
A good value of
\begin_inset Formula $R_{l}$
\end_inset
could easily be 256 or 512, and it should preferably be a power of two.
\end_layout
\begin_layout Subsubsection
Ideal histogram generation
\end_layout
\begin_layout Standard
To generate the ideal histogram we need few information:
\end_layout
\begin_layout Itemize
the resolution
\begin_inset Formula $R$
\end_inset
\end_layout
\begin_layout Itemize
the number of samples M
\end_layout
\begin_layout Itemize
the first and last values of the signal,
\begin_inset Formula $x[0]$
\end_inset
and
\begin_inset Formula $x[M-1]$
\end_inset
\end_layout
\begin_layout Standard
We can then evaluate:
\begin_inset Formula
\[
\phi=\sin\left(\frac{\pi}{2}\frac{M}{M+x[0]+x[M-1]}\right)
\]
\end_inset
\end_layout
\begin_layout Standard
which will keep the ideal sinusoid we are simulating just below the full
scale.
We can then define the value of each bar:
\begin_inset Formula
\[
h_{i}[n]=\frac{M}{\pi}\left(\arcsin\frac{n-\frac{R}{2}}{\frac{R}{2}}-\arcsin\frac{n-1-\frac{R}{2}}{\frac{R}{2}}\right)\quad\forall n\in[0,\, R-1]
\]
\end_inset
\end_layout
\begin_layout Subsubsection
Real histogram generation
\end_layout
\begin_layout Standard
To generate the real histogram
\begin_inset Formula
\[
h_{r}[n]\quad\forall n\in[0,\, R-1]
\]
\end_inset
no particular method is needed.
For example,
\emph on
numpy
\emph default
provides the
\emph on
hist
\emph default
function, that calculate an histogram of an array with a given number of
bins.
\end_layout
\begin_layout Subsection
Non linearities
\end_layout
\begin_layout Standard
We use histograms when evaluating DNL and INL in order to speed up the calculati
on.
\end_layout
\begin_layout Subsubsection
DNL
\end_layout
\begin_layout Subsubsection
INL
\begin_layout Standard
We can easily compute an histogram of the DNL provided we have the ideal
and real histograms:
\begin_inset Formula
\[
DNL[n]=\frac{H_{r}[n]}{H_{i}[n]}-1
\]
\end_inset
\end_layout
\begin_layout Subsubsection
Two-tone intermodulation distortion
INL
\end_layout
\begin_layout Subsection
Signal windowing (why?)
\begin_layout Standard
The INL is evaluated from the DNL:
\begin_inset Formula
\[
INL[n]=\sum_{i=0}^{n}DNL[i]
\]
\end_inset
\end_layout
\begin_layout Subsection
......@@ -160,12 +707,13 @@ Sinusoidal wave frequency detection
\begin_layout Standard
In order to compute the SNR of a single tone signal, we need to know the
wave's parameters.
IEEE offers two different ways to solve this problem, wheter we know or
not the wave's frequency.
IEEE proposes two different ways to solve this problem, whether we know
or not the wave's frequency.
\end_layout
\begin_layout Standard
A wave is represented this way with five parameters:
A wave can represented as a superposition of two waves and a constant term,
using five parameters:
\begin_inset Formula
\[
A\cos\left(\omega_{0}t+\theta\right)+B\sin\left(\omega_{0}t+\theta\right)+C
......@@ -177,7 +725,8 @@ A\cos\left(\omega_{0}t+\theta\right)+B\sin\left(\omega_{0}t+\theta\right)+C
\end_layout
\begin_layout Standard
The amplitude and the phase of the frequency can then be evaluted this way:
The amplitude and the phase of the frequency can then be evaluated this
way:
\begin_inset Formula
\begin{eqnarray*}
V & = & \sqrt{A^{2}+B^{2}}\\
......@@ -194,12 +743,12 @@ sinefit3
\end_layout
\begin_layout Standard
This alghorithm evaluates A, B, C starting from
This algorithm evaluates A, B, C starting from
\begin_inset Formula $\omega$
\end_inset
.
The algorithm is well described in --INSERT BIBLIOGRAPHY HERE--.
\end_layout
\begin_layout Subsubsection
......@@ -207,7 +756,7 @@ sinefit4
\end_layout
\begin_layout Standard
This alghorithm evaluates A, B, C and
This algorithm evaluates A, B, C and
\begin_inset Formula $\omega_{0}$
\end_inset
......@@ -233,10 +782,13 @@ where
\end_inset
the number of samples of the signal.
Based on sinefit3, this algorithm is essentially a least square fit of
the four parameters, and it's well described in --INSERT BIBLIOGRAPHY HERE--.
\end_layout
\begin_layout Subsection
Performance parmeters
Performance parameters
\end_layout
\begin_layout Standard
......@@ -253,7 +805,7 @@ The SNR is a rather important parameter, and its general formula is the
following:
\begin_inset Formula
\[
SNR=\frac{P_{s}}{P_{n}}
SNR=20\log_{10}\frac{P_{s}}{P_{n}}\quad[dB]
\]
\end_inset
......@@ -262,57 +814,209 @@ with
\begin_inset Formula $P_{s}$
\end_inset
being the signal-only power and
being the signal power and
\begin_inset Formula $P_{n}$
\end_inset
the noise-only power.
the noise power
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
It doesn't take into account the harmonic distortions, in addition to DC
and the meaningful signal.
\end_layout
\end_inset
.
This ratio will always be greater than one.
The noise power is computed this way:
\begin_inset Formula
\begin{eqnarray*}
C[f] & = & \begin{cases}
0 & f\in\{0,\, i\alpha_{0},\, M-1-\alpha_{0}\}\quad\forall i\in[0,\left\lfloor \frac{M}{\alpha_{0}}\right\rfloor ]\\
X[f] & otherwise
\end{cases}\\
P_{n} & = & \frac{\sum C[f]^{2}}{M}
\end{eqnarray*}
\end_inset
\end_layout
\begin_layout Subsubsection
SINAD: SIgnal to Noise And Distortion ratio
\end_layout
\begin_layout Standard
To compute with great precision this value, we compare our wave with a synthetic
one.
Using the data obtained from sinefit4 we can generate a signal that represents
with greater precision (as a perfect ADC) the sinusoid.
We then compute the power of the synthetic wave and the power of the difference
between the original and the synthetized waves.
We can use these powers to easily compute the SNR.
with great precision (as a perfect ADC) the sinusoid, so we can compute
the noise signal:
\begin_inset Formula
\begin{eqnarray*}
s[k] & = & C+A\cos(\frac{\omega_{0}}{f_{s}}k)+B\sin(\frac{\omega_{0}}{f_{s}}k)\,\,\forall k\in[0,\, M[\\
n[k] & = & x[k]-n[k]
\end{eqnarray*}
\end_inset
\end_layout
\begin_layout Subsubsection
SINAD: SIgnal to Noise And Distorsion ratio
\begin_layout Standard
At this point we calculate:
\begin_inset Formula
\begin{eqnarray*}
RMS_{n} & = & \sqrt{\frac{1}{M}\sum_{i=0}^{M-1}n[k]^{2}}\\
RMS_{x} & = & \frac{\max x}{\sqrt{2}}
\end{eqnarray*}
\end_inset
\end_layout
\begin_layout Standard
And then we can define the SINAD:
\begin_inset Formula
\[
SINAD=20\log_{10}\frac{RMS_{x}}{RMS_{n}}\;[dB]
\]
\end_inset
\end_layout
\begin_layout Subsubsection
THD: Total Harmonic Distorsion
THD: Total Harmonic Distortion
\end_layout
\begin_layout Standard
The THS is evaluated in the following way:
\begin_inset Formula
\[
THD=-20\log_{10}\frac{X[\alpha_{0}]}{\left\Vert h_{i}\right\Vert }
\]
\end_inset
\end_layout
\begin_layout Standard
where:
\begin_inset Formula
\begin{eqnarray*}
\alpha_{0} & = & \arg\max X[f]\\
h_{i} & = & X[\alpha_{0}i]\quad\forall i\in[2,\,2-i[
\end{eqnarray*}
\end_inset
\end_layout
\begin_layout Subsubsection
ENOB: Effective Number Of Bits
\end_layout
\begin_layout Standard
Let's define the full scale range as:
\begin_inset Formula
\[
R_{FS}=2^{N-1}
\]
\end_inset
\end_layout
\begin_layout Standard
The data range, instead, is the following quantity:
\begin_inset Formula
\[
R_{data}=\frac{\min x[t]+\max x[t]}{2}
\]
\end_inset
\end_layout
\begin_layout Standard
Therefore, we define
\begin_inset Formula $f$
\end_inset
as follow:
\begin_inset Formula
\[
f=20log\frac{R_{FS}}{R_{data}}
\]
\end_inset
in order to avoid penalization for a signal that doesn't cover all the full
scale range.
The effective number of bits can then be defined as:
\begin_inset Formula
\[
ENOB=\frac{SINAD+f-1.76}{6.02}
\]
\end_inset
\end_layout
\begin_layout Subsubsection
SFDR: Spurious Free Dynamic Range
\end_layout
\begin_layout Section
ACT: ADC Characterization Toolkit
\begin_layout Standard
The spurious free dynamic range is, simply put, the difference between the
main peak and the highest harmonic distortion peak in dBc:
\begin_inset Formula
\[
SFDR_{i}=10\log\frac{\max X[f]}{\max h_{i}}
\]
\end_inset
A good value of
\begin_inset Formula $i$
\end_inset
is 10.
\end_layout
\begin_layout Subsection
Single tone mode
\begin_layout Section
ACT: ADC Characterization Toolkit
\end_layout
\begin_layout Standard
When using this modality, the program will analyze data read either from
an ADC or a file.
The data must have been generated by sampling a single sinusoidal wave.
When using this mode, the program will analyze data read either from an
ADC or a file.
The application only support files at the day of writing.
\end_layout
\begin_layout Subsection
Single tone mode
\end_layout
\begin_layout Standard
The file structure is rather easy:
The data supplied to the application is the digitization of a sinusoidal
wave.
The file structure is rather easy, and contains all the information we
need to compute everything:
\end_layout
\begin_layout Standard
......@@ -374,13 +1078,5 @@ data a list of integers that represent the signal, always preceded by a
\end_layout
\begin_layout Subsection
Two tone mode
\end_layout
\begin_layout Subsection
Transfer function mode
\end_layout
\end_body
\end_document
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment