S253 of 55
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

S2 · Lesson 53 · Project: a SAR ADC with capacitor mismatch

A behavioral model, its DNL and INL by the histogram test, and its ENOB by FFT

A successive-approximation converter is a capacitor DAC, a comparator and a little logic doing a binary search. Its accuracy is the DAC's: each bit's capacitor should be exactly twice the next, and random mismatch (lesson 34) makes them not quite. In this project you'll build a behavioral model of a 10-bit SAR ADC with random capacitor mismatch, then measure it the way a lab would. A slow ramp and a histogram of output codes give the DNL and INL. A coherently sampled sine and an FFT give the SINAD and effective number of bits. Then you can see how much matching a design needs.

Predict

A 10-bit SAR ADC's MSB capacitor is 2 LSB larger than it should be, and everything else is perfect. Where does its worst DNL appear?

Name it

The model

  • Capacitor DAC: bit k (k = 0 for the LSB) has a capacitor of 2k unit capacitors, each with independent relative mismatch σ, so its weight is wk=2k+σ2kεk with εk standard normal. A dummy unit capacitor 1+σεd completes the array, and the total is CT=∑wk+wd.
  • DAC level for a code with bits bk: V=Vref∑bkwkCT.
  • Binary search: start from code 0; for k from N − 1 down to 0, try setting bit k, and keep it if vin ≥ the DAC level of the trial code. Vectorize over an array of inputs.

The histogram test

Feed a slow, uniform ramp across full scale, many samples per code, and count how many samples land in each code (dropping the two end codes, which collect out-of-range inputs). Then

DNLc=countcmean count−1,INLc=∑j≤cDNLj

with the INL's end-point straight line removed.

The sine test

Sample a sine of amplitude just under full scale with an integer, odd number of cycles in the record (coherent sampling, so no window is needed), convert, and take the FFT of the codes. SINAD is the signal bin's power over everything else except DC; ENOB=SINAD−1.766.02.

What you'll write

  1. make_dac(N, sigma, seed=1) returning (w, total), and sar(vin, w, total, vref=1.0) returning integer codes.
  2. dnl_inl(w, total, per_code=64) returning (dnl, inl) arrays for codes 1 to 2N−2.
  3. enob(w, total, samples=4096, cycles=127) returning (enob, sinad_dB).

Worked example

What DNL and INL does a 10-bit DAC with its MSB 0.5 LSB heavy have?

Show the solution
  1. Midscale transition. The MSB's extra 0.5 LSB delays the midscale transition by 0.5 LSB, so code 511 is 1.5 LSB wide.
  2. DNL. That makes DNL = +0.5 at code 511, and zero elsewhere.
  3. INL. After removing the end-point line, the INL steps by 0.5 at midscale and so swings ±0.25 LSB.
  4. Check against the model. The model's histogram test returns exactly that: DNL 0.5 at code 511, maximum INL 0.25.

Answer DNL is +0.5 LSB at code 511 and zero elsewhere, and INL swings ±0.25 LSB.

Worked example

With unit mismatch of 0.5%, how big is a typical worst-case DNL for 10 bits?

Show the solution
  1. Midscale spread. The midscale transition swaps all 1023 unit capacitors' worth of bits, so its error has spread 0.0051023≈0.16LSB and it's usually the worst.
  2. Simulated arrays. Across 200 random arrays the median worst DNL is 0.15 LSB.
  3. The tails. The tails are long: one of those arrays drew an MSB error beyond 3σ and reached 0.57 LSB.
  4. Design consequence. Production yield is set by those tails, so designers size unit capacitors (and therefore kT/C noise and power) for the mismatch spec at 3σ or more.

Answer a typical worst-case DNL is about 0.15 LSB (a midscale spread of 0.16 LSB), though a rare array can reach 0.57 LSB.

Check

Step 1. Write make_dac and the vectorized sar.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 2. Write dnl_inl(w, total, per_code=64) by the histogram test.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 3. Write enob(w, total, samples=4096, cycles=127) by the coherent sine test.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

An 8-bit SAR DAC uses unit capacitors with 0.5% mismatch. What's the spread of its midscale DNL?

Check

A SAR DAC's MSB is 1 LSB heavy. What's the peak INL after removing the end-point line?

Check

A 12-bit SAR ADC samples at 1 MS/s, spending one clock cycle sampling and one per bit. What internal clock does it need?

Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.

Explain why

Why is a SAR converter's linearity set by its capacitor matching rather than its comparator?

Practice

Keep practicing

6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.