cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L496GT6 battery voltage monitoring

JThas.1
Associate II

I want to monitor battery voltage (Vbat). I use the adc function to monitor voltage on the Vbat pin, and it can't read the voltage. When I use the same function on other pins, it can read correctly. For Vbat monitoring, what are the specific configurations for it?

 

MCU: stm32l496

IDLE: STM32CUBEIDE

3 REPLIES 3
TDK
Guru

Specific things are that your sampling time must be at least 12 us, and there is a 1:3 voltage divider on the circuit. These are covered in the datasheet.

TDK_0-1696340763089.png

 

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

For the sampling time topic, I configure it like this:

ts=640.5

ADC clock = 32.5 MHz

tconv = (640.5+12.5)/32.5 = 20.09 us

It is enough for the minimum requirement. Or is my calculation wrong?

 

JThas1_0-1696387120067.png

 

TDK
Guru

Yes, that's sufficient.

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