Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 4 months ago.
Can I get board VDD from st_micro f401re?
When I measure voltage with an analog channel, I need to multiply the 0 to 1 by the board voltage to get the actual voltage reading. If I default to using 3.3volts, the results are wrong. If I use my board voltage which is 3.315 volts, the readings are correct. Is there any way to get the board voltage via software so I don't have to manually measure the voltage on each board I use?
My voltage in = 1.649. If I take 100 readings and remove all readings above or below the standard deviation and take the reading times the 3.3volts, I get the following.
Average: 1.6422395992 Standard Dev: 0.0010298408 Output: 1.6421652767
When I use my board voltage measured to be 3.315, I get much better results.
Average: 1.6496315467 Standard Dev: 0.0008762093 Output: 1.6494109239
1 Answer
6 years, 4 months ago.
There are some techniques for doing this... You will need to read the VREFINT voltage to set a voltage ref baseline. *some* parts have a calibration value burned into them which can then be used to correlate the VREF ADC value to an actual voltage. (Check the ST site for an app note on this subject). For reading the internal reference this code I posted can show you how https://os.mbed.com/users/sixBase3/code/Nucleo_read_analog_value_intADCch/
I'll look into my app note collection and see if I can find the one regarding the VREF cal.
Bill
Thank you for the input.
I actually was reading that value but didn't see the correlation. The corresponding values for the readings listed in my questions are as follows.
For the reading when I used 3.3V Vref(f): 0.364591, Vref : 23893, Temperature : 14947 For the reading when I used 3.315V Vref(f): 0.364591, Vref : 23909, Temperature : 14963
I was hoping that VREF ADC was a fixed 1.21V which would allow me to calculate 1.21/0.364591 = 3.3188V. I was hoping that would equal the 3.315V that I measured manually. I am currently searching for an app note on a calibration value. I am also testing multiple boards to see if I can use the VREF ADC without the calibration.
posted by 13 Jul 2018