2023-10-03 5:57 AM
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
2023-10-03 6:46 AM
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.
2023-10-03 7:46 PM
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?
2023-10-03 9:02 PM
Yes, that's sufficient.