cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Readings Lower than Ideal

patrickwright
Associate II

I am using an STM32L562VET6Q MCU.  I have been having issues getting a valid reading from the ADC.  The signal is essentially DC (i.e., no fast high frequency measurements) so I conservatively set the ADC sampling time to its maximum.  My reference voltage is 3.3V and I am using a 12-bit ADC.  By my calculations, this means that each ADC step should correspond to 3.3V / (2^12 - 1) = 3.3/4095 = 0.806mV.  I am making measurements in the range between 0 and about 200mV.  However, when my input voltage was on the low end (about 10 to 20mV), my ADC is usually reading a value of zero.  I performed a series of ADC measurements across the range and compared them to the ideal readings (see the graph below).

patrickwright_0-1699541628321.png

It appears that my readings are linear, however the ADC reads on average 50 "points" lower than what I would expect.

I read through AN2834 to see if that would help me find a solution, but I wasn't able to glean much for the case where the ADC reads lower (if its higher you can use the offset registers).  My only thought was to use a pre-amplifier opamp so that the signal is more towards the "middle" of the ADC range.

 

What could be the source of this problem?  What are some possible solutions?

 

 

5 REPLIES 5
MasterT
Senior III

What is connected to inputs?  Caps in paralel , to lower impedance?

For DC shift up and down you don't need an amp, resistors could do same things

Here is a snipped of the relevant portion of the schematic:

 

patrickwright_0-1699557161535.png

The ADC is being used to measure the current drawn by an attached device (between the STR_PWR+ and STR_PWR- pins) via a 1ohm resistor.  The ADC pin is connected directly to the STROBE_MEAS pin (which is the negative terminal of the attached device).

 

Tinnagit
Senior II

you should do 3 necessary things.
one, you should Calibrate your ADC, there is ADC calibrate function.
second, you should read Vref from ADC which Vref is about 1211-1213 depending on temperature and calculate it to mV per bits and use it to find Reading Voltage from ADC channel.
last, Calibration by linear equation to map actual value and ADC Reading value.

I 'd recommend to use op-amp, DS says uCPU has "• 2x operational amplifiers with built-in PGA" but for different reason than impedance buffering - not required with just 1 Ohm.  Reason is safety - 15V demands at least 15 kOhm resistor in series with analog inputs to keep injected current in any case below 1 mA, otheways uCPU or just ADC could be easily destroyed  by loading device malfunctioning or during transition state - charging/ discharging etc. 

Piranha
Chief II

As Tinnagit already said, the offset is there because the ADC calibration has not been done. In addition the ADC range is 4096 units, not 4095. And yes, the ADC doesn't measure up to a full VREF+ level. The AN2834 explains pretty it clearly.