cancel
Showing results for
Did you mean:

# Measure VCC/Battery Voltage Without Using I/O Pin in stm32l010f4

Associate II

I have a circuit with stm32l010f4 that has no ADC pin available because I am using them as digital GPIO, but I need to measure the battery voltage in my application, my question is if Vrefint can be used to make the measurement. I have already made the configuration of Vrefint in stm32cubeide but it only gives me a value of 1.

1 ACCEPTED SOLUTION

Accepted Solutions
ST Employee

Hello @jdo (Community Member)

Of course, here the project attached.

Best regards,

Romain

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

6 REPLIES 6
ST Employee

Hello @jdo (Community Member)

The internal VREFINT provides an internal stable voltage around 1.22V (see DS12323 Rev 3 table 18)

In your application, if VDDA is same as Battery voltage, you can refer to section "Calculating the actual VDDA voltage using the internal reference voltage" in RM0377 Rev 10 page 311.

You can compute the VDDA voltage using ADC1_IN17 VREFINT Channel.

You will find VREFINT_CAL value address location in DS12323 table 17.

Concerning the VREFINT value = 1 you obtain, I'll check on my side if I can reproduce it.

Best regards,

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

ST Employee

Here my results. Computation of VDDA using ADC_IN17 VREFINT conversion and internal factory calibration.

Live Expression windows:

adcin17Raw = 1509 VREFINT decimal value converted by ADC.

VDDAmV = 3307 The actual VDDA computed in mV

VREFINTmV = 1220 The actual VREFIN in mV

I can share the CubeIDE project, Let me know.

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Associate II

hello! i also got adcin17Raw = 1509 VREFINT, i wanted to know what is the formula you use to calculate VDDAmV? i know that in the reference manual there are two formulas. Can you share your code please? i'm also using cubeIde

ST Employee

Hello @jdo (Community Member)

Of course, here the project attached.

Best regards,

Romain

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Associate II

thank you very much it will be very useful

Associate II

i test and this is perfect