Skip to main content
ASSAAD.ASSAAD
Associate III
August 7, 2017
Question

Measure VDD stm32f4

  • August 7, 2017
  • 1 reply
  • 2538 views
Posted on August 07, 2017 at 21:57

Hello 

Its not clear for me if is it possible to measure Vdd in stm32f407.

I read the manual but still not clear how to perform that.

I would be thankful if you show me an example if that possible.

Thanks

    This topic has been closed for replies.

    1 reply

    Vangelis Fortounas
    Associate II
    August 7, 2017
    Posted on August 07, 2017 at 22:10

    Hello! Are you use STM32CubeMX  to produce initialization code?

    What IDE you use? (or need makefile?)

    You can read VDDA, taking ADC measure from VREFINT  and convert it to VDDA. VDD usually has same voltage with VDDA .

    Vangelis Fortounas
    Associate II
    August 7, 2017
    Posted on August 07, 2017 at 23:19

    Hi again.

    Take this IOC file and main.c also

    it works with crystal 8 MHZ

    In general , define at global scope

    uint32_t VDDAmillivolts;

    and after ADC initialisation call

    HAL_ADC_Start(&hadc1);

    // 0x1FFF7A2A is the address of VREFIN_CAL (look at Device datasheet DocID022152 Rev 7 Page 138)

    VDDAmillivolts=3300*(*((unsigned short*)0x1FFF7A2A));//VDDA = 3.3 V x VREFIN_CAL / VREFINT_DATA

    HAL_ADC_PollForConversion(&hadc1, 1000);

    VDDAmillivolts /=HAL_ADC_GetValue(&hadc1);

    now the VDDAmillivolts contains the VDDA in millivolts.

    ________________

    Attachments :

    vrefint407.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyNu&d=%2Fa%2F0X0000000b97%2FzuXaXEJOYg2XqnuoRDyV78MlMg_rJu2ObFKdB8ZqlBc&asPdf=false

    main.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyWv&d=%2Fa%2F0X0000000b98%2Fy28LZjdzajRchq_9QME5XWpPXSkNIUaC.GSEABQz4.0&asPdf=false
    goutham gumm_2
    Associate II
    May 8, 2018
    Posted on May 08, 2018 at 13:23

    hey

    FORTOUNAS.EVANGELOS

    , I am getting a value of about 3 volts but what I expect to get is 3.3 volts. Is that normal?