# Integral and Differential Nonlinearity (INL/DNL)

## Contents

- What are Integral and Differential Nonlinearity?
- How do we measure it?
- Test Methodology
- Results
- Why does the DNL Spike?
- Conclusion
- References

## What are Integral and Differential Nonlinearity?

In an ideal ADC, a range of input voltages produces the same digital output value. In ideal ADCs, the size of the range of voltages that produces the same output value is precisely the same for every step. In real ADCs, this is not the case.

Differential nonlinearity is the deviation of each step from the ideal ADC step size. If the DNL for every step is less than one, then there are no missing outputs; if the width of a step is greater than one, that means that can mean that other outputs never appear.

DNL is calculated as:

\[\mathrm{DNL}(\mathrm{i})=\frac{V_{\text {out }}(i+1)-V_{\text {out }}(i)}{\text { ideal LSB step width }}-1\]Integral nonlinearity is the deviation of a particular output code from the ideal. For example, if your 12 Bit ADC has an INL of 10 LSBs, you know that the output it reports is always within $10/2^{12} = 0.25\%$ of the “true” output code.

## How do we measure it?

INL and DNL can be measured by applying a full-scale sine wave to the input and recording *a lot* of points. We can calculate the number of points required with the formula below, where $N$ is the number of ADC bits, $Z$ is the two sided Z-score for the confidence level we want (2.576 for 99%), and $\beta$ is the DNL resolution.

In the testing, 10 Million points were collected, giving 0.07 LSB accuracy at a 99% confidence level (0.05LSBs at 95%)

### DNL Calculation

We can calculate the DNL by comparing the number of times we saw a particular output to the number of times we expected to see it; if we saw more hits than we expected, then that output code is wider than it should be. Or more input voltages correspond to that output than we expect. Vice-versa, if it is smaller than we expect, then it has fewer voltages than we expect to map to that voltage.

The probability of a particular code being hit for a sine wave is below. Where $N$ is the number of bits in the ADC, $n$ is the code, the ADC input is $\pm V_\mathrm{FS}$, and the sine wave has an amplitude of $A$:

\[p(n)=\frac{1}{\pi}\left[\sin ^{-1}\left[\frac{V_{\mathrm{FS}}\left(n-2^{N-1}\right)}{A \times 2^{N}}\right]-\sin ^{-1}\left[\frac{V_{\mathrm{FS}}\left(n-1-2^{N-1}\right)}{A \times 2^{N}}\right]\right]\]We can calculate the DNL as, with the below equation, where we caculate the expected number of hits for that code based on the total number of samples collected times the probability of that code:

\[\mathrm{DNL}(n)=\frac{\text{# of hits}_\text{Actual}}{\text{Total # of hits} \times p(n)}-1\]### INL calculation

The INL is the integral of the DNL; it can be calculated as:

\[\mathrm{INL}(n)=\sum_{i=0}^{n} \mathrm{DNL}(i)\]The problem you can run into is the INL measurement error is much higher than the DNL, measurement error. The errors in DNL measurement are (approximately) normally distributed, so as you integrate the DNL, the error will grow with the root sum of squares of the accuracy above. The accuracy at the highest code is:

\[\text{INL Accuracy} = \sqrt{2^N \times M^2}\]We can calculate the INL accuracy for this test as:

\[\text{INL Accuracy} = \sqrt{2^{12} \times {0.07 \text{ LSB}}^2} = 4.48 \text{ LSB 99% confidence}\] \[\text{INL Accuracy} = 1.09 \text{ LSB 50% confidence}\]## Test Methodology

I generated a 1kHz sine wave with a Rigol DG4000 function generator. I used the following code to sample the ADC at its full rate (500ksps) then dump the samples out the USB serial interface: