cancel
Showing results for 
Search instead for 
Did you mean: 

Vbat measurement is inversely proportional to actual voltage

EC.3
Associate III

Hello,

I'm following this example: How to use the STM32 ADC's internal reference volt... - STMicroelectronics Community I'm using ADC4 rather than ADC1. I checked off Vrefint Channel and Vbat/4 Channel, and I let the IOC take care of the sequencing (it happens to convert Vrefint first). The device is powered by battery only. Hardware-wise, the VBAT pin is connected to Vdd and Vdda. For testing this I'm substituting a power supply to control the input voltage. Just focusing on the raw values obtained with HAL_ADC_PollForConversion() / HAL_ADC_GetValue() (like the example uses), when the supply voltage goes up the Vbat raw value goes down (and vice versa), while Vrefint stays roughly constant (as it should).

The converted voltage measurement is not important, but knowing when the voltage is low is. Is there some software configuration thing missing to cause the inverse relationship? If whatever is going on is consistent then that's good enough to detect low voltage, but I'm trying to understand what's going on before I start relying on it.

Thanks

2 REPLIES 2
MasterT
Lead

Probably, adc V-reference is connected to Vdd, verify or post a circuits if board custom

TDK
Guru

VBAT has a minimum measurement time. Are you meeting that? Increase sampling time to max.

Showing actual values you are getting would be insightful, and/or actual code being used.

 

If you feel a post has answered your question, please click "Accept as Solution".