Skip to main content
Visitor II
September 30, 2025
Question

STM32C0 VREF+ Calculation

  • September 30, 2025
  • 1 reply
  • 309 views

With a stm32c0116-dk, I am attempting to read vrefint, and calculate vref+. From my understanding of the data sheet, and schematic. VDDA is tied to VREF+ . On the development kit, these voltages are 3.3V.

VREF+ = ((VREF _Charac+) * (VREFINT_CAL)) / VREFINT_DATA

From the Datasheet - 
VREF _Charac+  = 3.0V

When I calculated VREF+, after reading VREFINT_DATA from the ADC, and VREFINT_CAL from the memory address. I am expecting a result close to 3.3 volts, but instead I am getting 3.04V

I have attempted to increase the sample time to ADC_SAMPLETIME_160CYCLES_5, but it makes no difference.

What am I doing incorrect?




    This topic has been closed for replies.

    1 reply

    ST Employee
    October 1, 2025

    Hello @pjhap ,

     

    Your calculation approach is correct in principle, but the discrepancy you observe (3.04 V instead of ~3.3 V) comes from the fact that the VREF_Charac+ value used in the formula is specified as 3.0 V in the datasheet, not 3.3 V. This value is a reference characterization voltage, not the actual VDDA or VREF+ voltage on your board.

     

    Formula Recap

    You use:

    ​​

    • VREF_Charac+ is the characterization voltage used during factory calibration of VREFINT (typically 3.0 V).
    • VREFINT_CAL is the factory calibrated ADC reading of the internal reference voltage at VREF_Charac+ (stored in system memory).
    • VREFINT_DATA is the ADC reading of VREFINT during your measurement.
       

    The internal reference calibration is done at a nominal 3.0 V reference voltage, not at your board's actual VDDA (3.3 V).

    When you run your measurement at 3.3 V VDDA, the formula scales the measured ADC value back to the 3.0 V calibration reference, so your calculated VREF+ will be close to 3.0 V. This is expected behavior and indicates the internal reference and ADC are working correctly.

     

    To help you can:

    • Use VDDA as reference voltage: The ADC reference voltage is VDDA (3.3 V), but the internal calibration is referenced to 3.0 V.
    • Accept the 3.0 V calibration baseline: The internal reference calibration is factory-set at 3.0 V, so your calculation reflects that baseline.
    • Measure VDDA directly: If you want to measure the actual VDDA, use the internal reference voltage reading and scale accordingly, but keep in mind the calibration is at 3.0 V.

     

    Best regards,
    Aime