2015-05-20 11:15 AM
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</p>
The VBATE bit in the ADC_CCR register is used to switch to the battery voltage. As theV
BAT
voltage could be higher than V
DDA
, to ensure the correct operation of the ADC, theV
BAT
pin is internally connected to a bridge divider.
When the VBATE is set, the bridge is automatically enabled to connect:
VBAT/2 to the ADC1_IN18 input channel, on STM32F40xx and STM32F41xx devices
</li>
VBAT/4 to the ADC1_IN18 input channel, on STM32F42xx and STM32F43xx devices
''</li></ul>
I use the CubeMX software to configure my projects. So my question is this: Is there a way either at compile time (via some &sharpdefine) or runtime to determine what the bridge divider is so I can do the necessary conversion without putting in my own &sharpdefine or similar?Thanks,Craig2015-05-20 11:40 AM
I don't use Cube nor CubeMX, but the 'F42x/F43x's ADC differs also in how is the temperature sensor connected: channel 18 in 'F42x/'F43x, channel 16 otherwise. Cube appears to define ADC_CHANNEL_TEMPSENSOR to reflect this.
JW2015-05-20 12:39 PM
Thanks JW. That works!