cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F427 - Calculating VDD from VREFINT - questions

Joe.H
Associate III

The documentation states that when measuring the CPU's temp, that VREFINT should be used to acquire better accuracy if powered by a battery.

So I intent to use VREFINT to determine what the CPU's VDD is without outside components.

That's the plan - but things don't add up and would like comments on where my thoughts may be goofy.

The documentation states that the factory measures an internal Vref (1.21 v) when VDD is 3.3v and temp is 30C. That ADC count is stored in memory at 0x1FFF7A2A.

This is my assumption thought process ...

3.3v / 4096 counts = 1.21v / CalValue --- where I am supposing CalValue == the calibration value at 0x1FFF7A2A.

If you do the math - the theoretical CalValue should be 1501.

When I read location 0x1FFF7A2A - I get 1496 which is pretty close - so I think my thoughts so far are correct.

I set up ADC1 to read channel_17 which is attached the to 1.21v reference (VREFINT)

I have the ADC clock divided by 4 so ADC clock = 180/4 = 45 mhz.

I have the channel sample at 7 which should be 480 cycles or 10.7 usec. The documentation states minimum sample on VREFINT should be 10 usec.

ADC Value acquired channel_17 is VREFINT_Value

if I take the previous equation used by the factory to get the CalValue:

3.3 * CalValue = VREFINT * 4096

and the equation for acquiring actual VREFINT_Value based on current VDD I get

VDD *VREFINT_Value = VREFINT * 4096

I combine to get

3.3 * CalValue = VDD * VREFINT_Value;

Therefore ... VDD = (3.3 * CalValue) / VREFINT_Value which I believe is the same equation given in AP3964 - page 6 of 14.

Here is where actual number don't seem to make sense and I hoping someone can explain why.

I read VDD at the CPU's pin with a good Fluke meter and show VDD == 3.298v

I read ADC channel_17 and get a count of 1550.

To me .. the higher count of 1550 compared to the factory CalValue of 1496 suggest that VDD is greater than 3.3v but when you do the equation above

VDD = (3.3 * CalValue) / VREFINT_Value = (3.3 * 1496) / 1550 = 3.185v which is lower and far from my expected value of 3.298 acquired from the Fluke.

Room temp is 66F which is less than the Factory Calibration tempt of 30C = 86F.

Any comments?

Thanks.

Joe

3 REPLIES 3

What board is this, yours or a "known good" like Disco or Nucleo?

Try increasing the sampling time. Take multiple measures, note the noise.

You should measure VDDA against VSSA for the value of ADC reference voltage, unless your chip has separate VREF pins.

JW

Joe.H
Associate III

This is custom board - I've had it production for 9 months now. Thought I would add CPU temperature monitoring. In the process I had the idea to monitor VDD since I use it in the CPU Temp calculation.

I use no ADC on the board and VDDA is connected to VDD and VSSA is connected ground.

I can monitor the calculated VDD and there is little change between readings (each second).

The samples per conversion was already at max as stated in my post so I increased the ADC Clock prescaler to max to get the slowest ADC clock. It brought the count values down slightly (less than 2%)

JH

Well, dunno.

Digital VDD is often noisy, at frequencies up to and over the mcu's clock. A DMM, however precise, may indicate whatever from either peak to RMS value. Whether that is the cause of the symptoms described, I don't know; you'd need to measure VDD precisely with an oscilloscope. Or use a board with known good ADC, or try to run the AD conversion without digital running.

Also, temperature of chip if it runs at full speed is likely to be some 20-30C above ambient, but as VREFINT won't depart more than some 3-5mV from the "room temperature" across the whole temperature range, it's unlikely this would have the impact you describe; the maximum impact this should have is around 15mV.

JW