cancel
Showing results for 
Search instead for 
Did you mean: 

ADC voltage calculation inaccurate

hassan2
Associate II
Posted on February 05, 2016 at 01:50

I am using a STM32F072RB discovery board and trying to calculate the voltage on a pin (PA1). I attached VDDA to the pin and measured the voltage with a voltmeter and it is 2.97 V.

The raw value that is read using a single-shot configuration is 4029.

4029 * 3.3 / 4096 = 3.246

That is too high. The actual value is 2.97

The value read form 0x1FFF F7BA - 0x1FFF F7BB is 0x60c

calibvalue = *(uint32_t *)  0x1FFF F7BA;

But I am not sure how to use that and make sense of the value.

Appreciate any pointers.
1 REPLY 1
AvaTar
Lead
Posted on February 05, 2016 at 07:33

> 4029 *

3.3

/ 4096 = 3.246

That formula is based upon the assumption that Vref for the ADC is 3.3V.

The Discovery boards use to have Schottky diodes in the different supply lines, to decouple them from each other. That reduces VCC (and also Vref) to about 3.0 ... 3.1 Volt.

For your calculations, take the actual Vref value of the ADC into account.