Skip to main content
Explorer
July 31, 2025
Question

measure VrefINT and VBAT onStm32f407vgtx

  • July 31, 2025
  • 2 replies
  • 307 views

Hi all

I am facing some issue related to measurement of VREFINT and VBAT which is IN17 and IN18 respectively,

My ADC1 configuration is 12 bit resolution, 3cycles sample, one shot and software conversion.

I ran few tests as follows

1.vref which is 2.95 (VDD) and vin is selected as channel IN17 and I am getting 414 in my DR register.  (vrefint bit is clear in CCR)

2.vref which is 1.21 (VrefINT) and vin is selected as channel IN17 and I am getting 1702 in my DR register.   (vrefint bit is Set in CCR)

3.vref which is 2.95 (VDD) and vin is selected as channel IN18(VBAT) and I am getting 420 in my DR register.  (vrefint bit is clear in CCR).

4.vref which is 1.21 (VrefINT) and vin is selected as channel IN18 and I am getting 1679 in my DR register.   (vrefint bit is Set in CCR).

help me where I am wrong.

B.R

    This topic has been closed for replies.

    2 replies

    Super User
    July 31, 2025

    Which STM32 exactly?

    For VBAT measurement, you probably need to set ADC_CCR.VBATE . Note, that if your battery is a coin cell, this will drain it, so you don't want to leave it switched on for too long.

    > 3 cycles sample

    That's probably not enough. Read the datasheet to find out the required timing - after enable, and also for sampling.

    JW

     

    Super User
    July 31, 2025

    In addition to @waclawek.jan 's comments, vref+ of 1.21 is likely not okay. I don't see how you can use VREFINT as VREF+ anyway.

    4. If VREF+ pin is present, it must respect the following condition: VDDA-VREF+ < 1.2 V.

    Probably sampling time is insufficient. Include the schematic if you can.

    Ash1Author
    Explorer
    August 1, 2025

    Hi  TDK

    I have uploaded circuit diagram how I am using VREF external selection which giving me 2.95v on multimeter.

    Ash1_0-1754053401423.png

    so my above issue are same.

    Note: One more issue I am facing I am not able to read value correctly when I am using 5v input via potentiometer but till 2.97v adc reading correct value..