cancel
Showing results for 
Search instead for 
Did you mean: 

Measure VDD stm32f4

ASSAAD.ASSAAD
Associate II
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

4 REPLIES 4
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 .

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
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?

Posted on May 08, 2018 at 13:51

This thread is almost one year old, pretty sure he won't answer.

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

You need to properly describe your measurement conditions.

But many ST evaluation boards (Discovery, Nucleo) have a shottky diode in the Vdd branch, reducing the 3.3V to about 3.0V.