cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 - Determining Vref

JuM
Senior

Hi, using STM32G071 Nucleo Board.

Set Vref to internal 2.500 Volt.

Set jumpers accordingly (SB28 ope´n, SB21 close) and measure 2.5001 at pin AVDD (CN5.8) on Nucleo Board. So far, so good.

Now try to determine AdcVref in software by reading ADC_CH_VREF (ADC_IN13) and VREF_INT_CAL (0x1FFF75AA)​ like this (VDD_CALIB = 3000 mV):

       VrefData1V22 = 0;

       for (i = 0; i < 32; i++)

           VrefData1V22 += ADCRead (ADC_CH_VREF);

       VrefData1V22 /= 32;

       AdcVref = (uint32_t) (((VDD_CALIB * VrefCal1V22) / VrefData1V22));

Result is 2.532V (expected is 2.50xV) ?

What is wrong here ?

Juergen

3 REPLIES 3
JuM
Senior

​Today measured/calculated 2.584V...

JuM
Senior

Trying to measure VrefInt.

Factory stored VrefInt cal value (0x1FFF 75AA) is 1672d. That gives (@3000mV): 1225 mV

Have set ADC reference voltage to VREFBUF:=2.500V, ADC to 12bit, 160 µsec sampling time.

Reading (once a second) ADC_CH_VREF (ADC_IN13) I get binary values in range 1991d..2000d which represents 1215mV..1221mV.

Why these values are such jittering and why

ad(Vref): 1995d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 2000d => 1221 mV    max...
ad(Vref): 1996d => 1218 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1991d => 1215 mV    min...
ad(Vref): 1994d => 1217 mV
ad(Vref): 1997d => 1219 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1993d => 1216 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 1998d => 1219 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1997d => 1219 mV
ad(Vref): 1996d => 1218 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1993d => 1216 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1994d => 1217 mV
ad(Vref): 2000d => 1221 mV    max...
ad(Vref): 1996d => 1218 mV
ad(Vref): 1995d => 1217 mV
ad(Vref): 1991d => 1215 mV    min...
ad(Vref): 1994d => 1217 mV
ad(Vref): 1997d => 1219 mV

such low ?

JuM
Senior

Sorry, 160.5 cycles @ 32 MHz ADC clock => 5 usec sampling time (> 4 usec according to datasheet).​

Tried HSI16 clock also, not better...