# How to improve ADC accuracy

I am using aTI C2000 f28027. I am modelling my program on the examples from controlSUITE. One example that demonstrates ADC (code) connects the ADC internally to an internal temperature sensor. The ADC has 12 bits of resolution. When the program is run and monitored with the debugger values returned by the ADC vary by one count between sampling. Another example that demonstrates the ADC reads values from external pins. When I connect the pins to stable and known voltages (0, 3.3, etc), hte values reurned vary easily by 100 counts (out of 4096) between samples that are displayed by the debugger (I am sure the debugger doesn't display at the same high frequency that the ADC samples).

Is that to be expected with wire connected and unsoldered connections. By default the board uses an internal voltage reference. The temperature sensor code uses a 40 cycle sampling window; I changed the sampling window in the other code but it didn't make a difference. I tested on a voltage from a reliable power supply which was connected to nothing else.

Update: output

• First off, you are talking about precision and not accuracy. Second, there are many possible sources for the external variation. We'd need to see a circuit. Some might be correlated (for example, something nearby that is driven by AC mains that is also significantly affecting your input source) or it might be uncorrelated -- Poisson events integrate into Gaussian shaped curves around a mean. We'd need a LOT more information, given that most of us have to survive without a working crystal ball. (Of course, it might be that the C2000 F28027 is a piece of junk. But I don't think so.) – jonk Feb 18 '18 at 17:38
• I am using a development kit. This happens if i connect the ADC pin to ground or Vss. It happens with voltage diving resistors on a breadboard. To test with a completely independent source a used a 5V source and voltage dividers on a breadboard. – rur2641 Feb 18 '18 at 17:48
• Did you read the datasheet on your 5V source and have you determined that its specifications are NOT related to what you are seeing? Capture your data and show us a plot of it. – jonk Feb 18 '18 at 17:59
• The ADC is triggered by a PWM (ADC_setSocTrigSrc())at 915 Hz, but data is only output at 10 Hz. Could the internal temperature sensor have a low pass filter? Does the signal need to be filtered because the ADC is triggered at a high frequency? – rur2641 Feb 18 '18 at 20:05
• Thanks. Have you read the datasheet, yet? Did you notice the value of the ripple on the DC supply? Have you attempted to use a simple battery for your divider and just grounding one end? I'd like to know if that presents different results. – jonk Feb 18 '18 at 20:06

How quiet do you expect the VDD and the GND to be for the ADC? how quiet might the silicon substrate be? lets compute some numbers.

Assume 100,000 gates are active during any time the MCU is clocking, and that each gate pulls 100uA for 100 picoseocnds, as the gate output transitions between logic levels. With 100,000 gates consuming 100uA*100pS or 1e-4 * 1e-10 = 1e-14 coulombs in each gate, scaled by 100,000 (1e+5), the charge demanded during each clocking event is 1e-14 * 1e+5 = 1e-9 coulombs.

Assume the onchip well-substrate capacitance (some of that "parasitic" C is in each gate) is 0.1uF (or 0.1pF per each of 1,000,000 total gates). What is the VDD sag during this very fast demand for charge?

Q = C * V, dV = dQ/C = 1e-9 coulomb / 0.1uF = 1e-9 / 100e-9 = 0.01 volts.

Thus the onchip rails bounce around by 10 milliVolts, as the ADC tries to perform comparisions (in an analog comparator operating from the noisy rails) good to 3.3/4,096 = 800 microVolts.

You might expect a CodeSpread of 0.01 / 0.000,8 = 12 quanta.

========================================

Now, how about the VDD (and GND) bounce from Output Pin Driver activity. Can you compute that? assume 5nH inductance; assume 3.3v in 330 picosecond into 10pF Cload.

The average Iout is C * dV/dT = 10pF * 10 volts/nanosecond = 1e-11 * 1e+10 = 0.1 amps. Average. Assume the peak I is 0.2 amps, that peak Iout reached in 160 pS. The dI/dT = 0.2 amps * 1/160pS = 0.2 * 6Billion = 1.2 billion amps/second.

What is the rail bounce, as the output driver charges up the external+Cesd load?

V = L * dI/dT = 5e-9 * 1.2 e+9 amp/sec = 6 volts.

Yet you expect the ADC, attempting to operate during Output Pin Driver slewing, to achieve "quiet" operation?

               ===================edit March 9


Here we are discussing a high-current onchip Output driver, having purpose of moving a 10pF load (onchip ESD and FET drain_to_bulk/well/substrate isolation diodes and offchip PCB capacity and the input capacity of the IC being driven with the 330picoSecond edge) by 3.3 volts in 0.33 nanoseconds.

To charge up that 10pF Cload, the output driver pulls the current from the VDD pin, and that VDD pin inductance will show a 6 volt spike if the predicted current (0.2 amps) is realistic; but the collapse of the VDD voltage to zero , and then to negative tells us the Output Driver cannot provide 0.2 amps with 330picoSecond edge speed. So what happens? the edge become much slower, probably 1 or 1. 5 nanoseconds (1,500 picoSeconds) so the FET still have some voltage across itself and can charge up that 10pF Cload.

Thus the VDD pin, hopefully not shared by the ADC, is trash. For this reason MCUs usually have separate AnalogVDD and DigitalVDD pins.

On the other hand, when the Output Driver needs to discharge the 10pF from 3.3 v down to 0.0 volts, the GND pin gets trashed; that likely upsets the substrate, and the substrate is shared by all the circuits. Some "GND" pins might be used as "shields", surrounding analog regions; these shields are effective only if the region is very small, and surrounded by the shield.

• Thank you for the explanation. I understand the first part. But for the second one, what pin is being driven? The ADC pin? – rur2641 Feb 19 '18 at 14:28
• +1 Nice listing of various sources and mechanisms - albeit probably somewhat overwhelming for the OP. – Russell McMahon Feb 11 '20 at 21:31

I am using a Launchpad development board. When the ADC pin is connected to an adjacent ground pin with a jumper, the correct results are returned. As long wires are used, precision deteriorates. Having a capacitor between the signal and ground close to the board solved the problem.

• It's good to have a small cap on the ADC input to hold the voltage steady while the internal sample & hold capacitor charges – user28910 Mar 9 '18 at 14:35
• What's the size of the capacitor you used? – csg May 7 '18 at 14:05
• @canberk_gurel 820 pF worked well – rur2641 May 8 '18 at 14:37