Skip to main content
ngodoanvan
Associate III
May 25, 2022
Question

STM32WLE5CBU6 - calculating VDD from VREF

  • May 25, 2022
  • 3 replies
  • 2137 views

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

This topic has been closed for replies.

3 replies

Andrew Neil
Super User
May 25, 2022

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.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ngodoanvan
Associate III
May 25, 2022

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

Andrew Neil
Super User
May 25, 2022

0693W000008xsqBQAQ.png

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ngodoanvan
Associate III
May 25, 2022
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