Measure VCC/Battery Voltage Without Using I/O Pin in stm32l010f4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-13 4:22 AM
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.
Solved! Go to Solution.
- Labels:
-
GPIO-EXTI
-
STM32CubeIDE
-
STM32L0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 6:27 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-13 4:55 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-13 5:27 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 6:20 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 6:27 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 7:00 AM
thank you very much it will be very useful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-01-16 7:14 AM
i test and this is perfect
