cancel
Showing results for 
Search instead for 
Did you mean: 

Using ADC1 VBAT pin on STM32U535 to measure the battery supply voltage of my system

L4sj4s
Associate

Hi,

My battery (++ LTO/Bucks) that runs everything on my PCBA is connected to VBAT (pin 1). Before the connection I have a voltage divider factor of roughly 1.374, but what I read on the pin via ADC1 channel 18 (what VBAT is routed to internally) seems to be non-sensical. With a battery voltage of 3.6V I measure roughly ~1160 mV (after multiplying by 4 and 1.374). When I tried replacing the resistors in my voltage divider by smaller ones I got higher measurement values.

VBATEN is enabled in ADC12_COMMON_CCR. Also tried to enable MONEN in PWR_BDCR1, but that didn't make any difference.

What's could be the issue here?

1 REPLY 1
TDK
Super User

Sounds like the cap isn't being charged up fully. Set sampling time to max.

If that's not it please show the code used.

What voltage divider are you talking about here? There's an internal one but you certainly can't change the resistors on it.

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