2026-04-02 12:22 AM - last edited on 2026-04-03 4:10 AM by mƎALLEm
Split from this post.
Thank you for your help, I didn't know this mode and it works well. I did a measure every 5s.
I use Timer1 for injected mode and timer3 for DMA mode.
I've just a little difference of measure. With the ADC, I have the following value : 944, that's to say (with ratio = 4), ((944 * 3.3) / 4096) = 0.7605 * 4 = 3.04V.
My sampling is 480cycles.(if I put only 3 cyles, the measure is lower (2.88V)).
Or with my multimeter, I have 3.20V.
2026-04-02 1:11 AM
This sounds more like you have an electrical / ADC configuration mismatch, i.e. the configured sampling time and Vbat input impedance don't match.
As explained here occasionally, the input Sample&Hold stage of most ADCs can be viewed as an RC element. With a S&H capacitor (see datasheet), the RC time constant is largely defined by the components attached to the AIN pin, i.e. the input impedance.
If the source in not able to charge/discharge the S&H capacitor in the configured sample time, you get wrong results.
Either try longer sampling times, or a buffer amplifier.
2026-04-02 2:31 AM
As I measured Vbat, I cannot change anything on the HW.
Does I need to disable Vbat between two measures to avoid consumption ?
2026-04-02 4:09 AM
> As I measured Vbat, I cannot change anything on the HW.
> Does I need to disable Vbat between two measures to avoid consumption ?
For another STM32 MCU, but the concept is the same for all SAR-ADCs :
I don't do, Cube / HAL, but I'm sure you can figure this part out.