Electronic – STM32F0 ADC reads wrong values

adcmicrocontrollerstm32stm32f0

I am using STM32F030F4P6 MCU for a project. This MCU has no Vref+ pin and using VDDA pin for A/D conversions, PLL etc. While prototyping the circuit that I am going to use on my project, I shorted VDDA and VDD pins together with 10uF and 100nF capacitors to the ground. I am giving exact 3.3V to these pins with an DC power supply.

ADC will be reading voltage with max amplitude of 16.8V. Therefore I've used 10k / 2k voltage divider, to bring this voltage to logic level. Since I will be reading mostly DC values, I've set the sampling time to highest possible which is 239.5 adc clock cycle – 17.1 microseconds.

The problem is values that I read are way different than voltages I measure with multimeter. For example, ADC is reading ~2.8V when I measure 2.87V.

As you know these MCUs have Vref built-in which you can read through ADC_IN17. When I try to use this to calibrate my ADC, this time measured voltage is lower than read voltage. For example, read voltage is 2.8V when I measure 2.72V.

ADC resolution is 12 bit and ADC accuracy table is shown below.

enter image description here

Best Answer

For calibrating with internal VREF you would need to post your code.

For the case without calibration it might actually be the input impedance - the MCU ADC has input impedance of around 50k which might be too low in the case of your divider - try buffering the measured voltage and measuring it again.