cancel
Showing results for 
Search instead for 
Did you mean: 

ADC VREFINT value not accurate?

Florian Moser
Senior

Hi!

MCU: STM32L433VCT

CubeMX, HAL

12bit ADC

ADC clock is 250kHz

637,5 cycles on every channel

VREFBUF is disabled

VDD is 3V3

I'm currently trying to measure VREFINT and "compare" it to the value stored in the flash, to get accurate ADC measurements. The stored value for VREFINT is 1656 for 3V. As I have 3V3, I need to calculate the "equivalent" for 3V3. To do so, 1656 is devided by 1.1 (3V3 / 3V) which is 1505. The measurement result for VREFINT is 1440, which is way off what I expect.

My VDDA to VSSA and my VREF+ to VREF- voltage are both 3.302V. The ripple is around 5mV.

According to the datasheet of the STM32, VREFINT is min. 1,182, typ. 1,212, max. 1,232.

vrefint_3V0_flash = 1656 => (1656/4095) * 3V = 1,213V => seems correct.

vrefint_3V3_flash = 1505 => (1505/4095) * 3V3 = 1,213V => seems correct.

vrefint_3V3_measured = 1440 => (1440/4095) * 3V3 = 1,160V => seems incorrect.

As vrefint_3V3_measured is not between VREFINT min. and VREFINT max. it seems incorrect to me.

vrefext_measured whould also be way off with this result:

vrefext_measured = 3V3 * (vrefint_3V3_flash / vrefint_3V3_measured) = 3,45V.

What am I doing wrong here?

1 ACCEPTED SOLUTION

Accepted Solutions

Do you perform ADC calibration before taking measurement, as outlined in RM?

Do you observe the minimum time after enabling VREFINT as given in DS?

JW

View solution in original post

2 REPLIES 2

Do you perform ADC calibration before taking measurement, as outlined in RM?

Do you observe the minimum time after enabling VREFINT as given in DS?

JW

Oh wow, it was that simple. I didn't know about the automatic self-calibration.

Now I'm using the following function:

HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc, uint32_t SingleDiff)

I'm getting correct results for vrefint_3V3_measured now (1502 => 1,210V).

Thanks for your help!