AnsweredAssumed Answered

Determining bridge divider for VBAT on STM32F40xx vs. STM32F42xx

Question asked by cBroadbo on May 20, 2015
Latest reply on May 20, 2015 by cBroadbo

We have two different projects that I work on, both custom boards, one with an STM32F405xx and one with an STM32F427xx.  I have a common code base that I'm using for both.  However when I monitor VBAT via ADC the value I get back on the STM32F427xx board is half what I get on the STM32F405xx for the same input voltage due to the difference in the bridge divider.  From the Ref manual:

"13.11 Battery charge monitoring


The VBATE bit in the ADC_CCR register is used to switch to the battery voltage. As theVBAT voltage could be higher than VDDA, to ensure the correct operation of the ADC, theVBAT pin is internally connected to a bridge divider.


When the VBATE is set, the bridge is automatically enabled to connect:

  •     </p>   

    VBAT/2 to the ADC1_IN18 input channel, on STM32F40xx and STM32F41xx devices   



  •     </p>   

    VBAT/4 to the ADC1_IN18 input channel, on STM32F42xx and STM32F43xx devices"



    I use the CubeMX software to configure my projects.  So my question is this: Is there a way either at compile time (via some #define) or runtime to determine what the bridge divider is so I can do the necessary conversion without putting in my own #define or similar?