cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Reading Consistency

LMorr.3
Senior II

I am feeding 1.75V into an ADC input on a STM32F407 and see the voltage source is clean and consistent on a scope.  I continuously read the value every 20ms.  I see the ADC value change between 2108 to 2130.  How consistent should the value be?  I'm guessing it's not likely I will see the exact same value each time the ADC is read, but am wondering if the range I'm seeing is what should be expected as 'stable' reading.   I'm using a separate 3.3V source for the analog.  If I use a 4 layer board and separate analog ground, what is the consistently I should expect to see in consecutive ADC readings?  I'm turned up all of the ADC peripheral settings to see if consistency would improve but it stays in the same range.

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions

The STM32F4 is primarily a relatively high integration digital circuit, where the analog is not a primary concern. 22 bins of dispersion is not entirely unexpected even with adequate source impedance/sampling time and stable VREF+.

There is an STM32F4-ADC-specific appnote, AN4073, review it.

JW

View solution in original post

5 REPLIES 5

The STM32F4 is primarily a relatively high integration digital circuit, where the analog is not a primary concern. 22 bins of dispersion is not entirely unexpected even with adequate source impedance/sampling time and stable VREF+.

There is an STM32F4-ADC-specific appnote, AN4073, review it.

JW

Would using a single pole filter like this be an acceptable solution to read ADC for knobs/pots/sliders?  not higher frequency

 
#define SINGLE_POLE(out, in, coefficient) out += (coefficient) * ((in) - out);
 
Using 0.1f as a coefficient
Nikita91
Lead II

A popular method for slow acquisitions like yours is to take 8 or 16 measurements and take an average (add all the measurements then divide by the number of measurements).

Using DMA it can go fast.

I did see the code I need to average in the AN4073 doc.  Thanks for suggesting this as well.  That is what I'll implement.  I won't disable prefetch or ART though since I don't fully understand the consequences and think this would be an option best suited for higher frequency requirements.  Having 0LSB dispersion would be great but overkill in my case of pots/sliders.

Use whatever filter fits your purpose - averaging is a filter, too. Manual controls also sometimes work well using some "slack" (hysteresis). Also, for manual controls, often 8 bits of resolution is enough.

While the 'F4 ADC is far from being stellar (that's why that appnote) and other STM32 may have better performing ADC, any ADC can be made worse by improper routing, grounding, power supply decoupling, analog domain separation, crosstalks, etc.

JW