How to get the best ADC accuracy AN2834
36/49 DocID15067 Rev 3
In STM32L0 and STM32L4 microcontrollers, averaging can be performed by using the
hardware oversampling feature: the ADC performs built-in hardware averaging according to
configurable parameters (number of samples to average and final right bit shift of result).
The advantage of averaging is to improve ADC precision without any hardware changes.
The drawback is that the conversion speed is lower as well as the frequency response (it is
equivalent to decreasing effective sampling frequency).
3.3.2 Digital signal filtering
This method uses digital signal processing techniques.
In principle, averaging is also a simple digita
l filter with a specific frequency response.
However if the noise frequency spectrum is known, a digital filter can be designed which
minimizes noise influence and maximizes ADC frequency response. For example, if the
noise in the measured signal is coming from the 50 Hz power lines, then an appropriate
dig
i
tal filter suppresses only the 50 Hz frequency and delivers data signal without this noise.
The disadvantage of this method is that it requ
ires appropriate microcontroller processing
power and resources: CPU speed and data/program memory usage.