cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WLE5CBU6 - calculating VDD from VREF

ngodoanvan
Senior

Hi, I am using VREF to calculating VDD. VDD = 3.3V but VREF = 3.0V. What wrong? (I use __LL_ADC_CALC_VREFANALOG_VOLTAGE() macro helper to calculate Vref). Does anyone have any tips what the issue might be? Thank.0693W00000Nqc76QAB.png

4 REPLIES 4
Andrew Neil
Evangelist III

You haven't showed how you're actually "calculating" VDD.

The general idea is that you use an ADC with VDD as reference, and you measure Vref - then the ADC output is the ratio of Vref to VDD;

  • when Vref = VDD, the ADC reads full-scale;
  • when Vref < VDD, the ADC reads proportionally less than full scale.

This relies on VDD never being less than Vref.

ngodoanvan
Senior

VREF+_Charac = 3300mV (datasheet)

VREFINT_CAL = 0x05E4 = 1508

but VREFINT_DATA is the actual value converted by ADC is 1608. Therefore VREF+ < VDD

0693W00000NqdceQAB.pngmy calculating code:

0693W00000Nqdf9QAB.pngprinted in Terminal:

0693W00000NqdfEQAR.pngPlease review for me. Thanks

0693W000008xsqBQAQ.png

ngodoanvan
Senior
Measure.VrefAnalog = __LL_ADC_CALC_VREFANALOG_VOLTAGE(ADC_RegularConvertedValueTab[MEASURE_ADC_VREF_ADDR], LL_ADC_RESOLUTION_12B);
xSystem.Vref = Measure.VrefAnalog;
DebugPrint("\rVREF+: %d, VREFINT_DATA: %d", xSystem.Vref, ADC_RegularConvertedValueTab[MEASURE_ADC_VREF_ADDR]);
DebugPrint(", VREFINT_CAL: %d", *VREFINT_CAL_ADDR);

 Please review for me