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

  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Dave Tweed
    Commented May 30, 2018 at 12:20

2 Answers 2


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.


From the comments the issue seems to be related to the corelation between MOSFET switching time and ADC reading time.

The 100 mV noise is most likely a periodic noise and readings in phase with the noise cannot lead to an average value, it's like averaging sin (t) at 2*pi*n + c points

Filtering the ADC input might help reduce the corelation if the noise path is not inductive.

If oversampling to a higher rate than switching time is not an option then at least moving the sampling point far from transitory area could help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.