AN2834
3.2.13
Component placement and routing
Place the components and route the signal traces on the PCB so as to shield analog inputs.
Components like resistors and capacitors must be connected with very short leads. You can
use surface-mounted device (SMD) resistors and capacitors. You can place SMD capacitors
close to the microcontroller for decoupling purposes.
Use wide tracks for power, otherwise the series resistance of the tracks would cause a
voltage drop. Indeed, narrow power tracks have a non-negligible finite resistance, so that
high load currents through them would cause a voltage drop across them.
Quartz crystals must be surrounded by ground tracks/plane. The other side of the two-layer
PCB below the crystal should preferably be covered by the ground plane. Most crystals
have a metallic body that should be grounded. You should also place the crystal close to the
microcontroller. You can use a surface-mounted crystal.
3.3
Software methods to improve precision
•
Averaging samples:
–
•
Digital filtering (50/60 Hz suppression from DC value)
–
–
•
Fast Fourier Transform (FFT) for AC measurements
–
–
•
ADC calibration: offset, gain, bit weight calibration
ADC calibration decreases internal ADC errors. However, the internal ADC structure
must be known.
•
Minimizing the internal noise generated by CPU
The application has to be designed
–
–
3.3.1
Averaging samples
The principle of this method is to increase ADC precision but decrease ADC conversion
speed (oversampling). If the measured analog signal produces unstable ADC values, then
the mean value of the given input signal can be obtained by averaging a set of values.
Variation can be caused by signal noise or noise generated by the microcontroller itself
(high speed digital signals capacitively coupled to the analog input signal).
Averaging is performed by choosing an appropriate number of samples to be averaged.
This number depends on the required precision, minimum conversion speed and the level of
other ADC errors (if another error has a greater influence on ADC precision, then increasing
the number of averaging values has no effect on total measurement precision).
Averaging decreases speed but can improve accuracy
A proper sampling frequency is set (the trigger from timer is useful in this case).
Software post-processing is performed on sampled data (e.g.comb filter for 50 Hz
noise and its harmonics suppression).
This methods allows showing harmonic parts in measured signal.
It is slower due to the use of more computation power.
to use minimum disturbance from the microcontroller during ADC conversion.
to minimize digital signal changes during sampling and conversion (digital
silence).
DocID15067 Rev 3
How to get the best ADC accuracy
35/49
48
Need help?
Do you have a question about the STM32 and is the answer not in the manual?
Questions and answers