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.
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 .
Take this IOC file and main.c also
it works with crystal 8 MHZ
In general , define at global scope
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.
hey Vangelis Fortounas, I am getting a value of about 3 volts but what I expect to get is 3.3 volts. Is that normal?
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.
Retrieving data ...