2022-05-24 08:39 PM
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.
2022-05-25 02:24 AM
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;
This relies on VDD never being less than Vref.
2022-05-25 02:39 AM
VREF+_Charac = 3300mV (datasheet)
VREFINT_CAL = 0x05E4 = 1508
but VREFINT_DATA is the actual value converted by ADC is 1608. Therefore VREF+ < VDD
my calculating code:
printed in Terminal:
Please review for me. Thanks
2022-05-25 02:51 AM
2022-05-25 02:52 AM
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