Measure battery voltage
- This topic has 3 replies, 2 voices, and was last updated 8 years, 1 month ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Tagged: xdot vdda
I would like to know the voltage of the battery which powers the xDot. According to the STM32L152xx reference manual, you can calculate V_DDA like this (12.12; Temperature sensor and internal reference voltage):
VDDA = 3 V x VREFINT_CAL / VREFINT_DATA
How is the V_DDA wired on the xDot? Is is tied to VDD3.3? Or is it stabilised somehow?
Thanks,
Mark
There is no regulator on the xDot itself so you can measure the battery voltage that way. You can also of wire V_BAT directly to an analog pin such as GPIO0-2. Theres a discussion with code examples of using the voltage references with mbed on the mbed message board here: https://developer.mbed.org/questions/75906/External-Internal-ADC-voltage-reference/
Okay, I see, nice!
Then I need the ADC_VREF PinName, which entered mbed-os only at version 5.2 (. Now for libxDot-mbed5, we need 5.1.5, according to its commit log.
So how do I solve that?
– Ignore the warning and use 5.2.0
– Use libxDot-dev-mbed5 (but we’re developing a product, so is that wise)
– Patch 5.1.5 which ADC internal commits from 5.2.0
What do you advise?
libxDot-dev-mbed5 should be safe to use, its main difference is the version of mbed its compiled against. There are no major API changes.
If you want to back port you should only need PeripheralPins.c and PinNames.h from mbed-os\targets\TARGET_STM\TARGET_STM32L1\TARGET_XDOT_L151CC however I would consider using libxdot-dev-mbed5 to be lower risk as that backport is completely untested.