2023-06-27 04:48 PM - edited 2023-06-27 05:08 PM
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,
Solved! Go to Solution.
2023-06-28 02:05 AM
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
2023-06-28 02:05 AM
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
2023-06-28 11:21 AM - edited 2023-06-28 11:28 AM
Would using a single pole filter like this be an acceptable solution to read ADC for knobs/pots/sliders? not higher frequency
2023-06-28 11:34 AM
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.
2023-06-28 11:45 AM - edited 2023-06-28 11:47 AM
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.
2023-06-28 11:54 AM
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