2024-12-04 12:18 AM - last edited on 2024-12-04 12:46 AM by Andrew Neil
Dear Community,
I started investigating issues on one old project that based on STML071xB and has been implemented by another engineer. I got confused with implementation of battery measurements. Here is the thing:
1. MCU is directly supplied by a battery (working voltage is expected to be in 2-3V range)
2. VREF+ is connected to a battery
3. ADC internal channel is used to measure VDD level
Datasheet says that VDD can be measured accurately using internal ADC channel when VREF+ is not connected. Meaning, an internal reference voltage which is 3.0V (bandgap) is used as a reference to measure VDD. But what if VREF+ is connected to a battery voltage, how VDD is supposed to be measured in this case?
From my understanding, VDD cannot be measured when VREF+ is used as a reference since it will be giving nearly maximal raw values on ADC output.
What is the most confusing part is when I use external supply to power the device and change output voltage I see accurate measurements of the batter. How is it possible? But on the field we have many devices that are showing suspicious battery readings.
Please advise what I'm wrong with.
Thank you!
2024-12-04 12:46 AM
Please show the schematic of this arrangement:
@ramil wrote:1. MCU is directly supplied by a battery (working voltage is expected to be in 2-3V range)
2. VREF+ is connected to a battery
Are these the same battery, or two separate batteries?
2024-12-04 02:07 AM
Hi,
just at first think a little bit: how could any ADC measure its own Vref ? It always will be 100% (adc-value).
So only way is to measure a fixed, known reference and ( by doing 3rd class mathematics ) calculate the ADC-Vref (or VDD, because same here) .
So what you found, is the standard way to get the VDD (or Vref) by measuring a known reference and then calculating the actual VDD from this, ( if there is no (working) fixed Vref+ , thats coming from a reference voltage and thus allows measuring the VDD from a voltage divider (from VDD) and using the ADC with fixed Vref ).