We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ae7489 commit a3baf2dCopy full SHA for a3baf2d
targets/TARGET_STM/TARGET_STM32F4/analogin_api.c
@@ -183,7 +183,12 @@ static inline uint16_t adc_read(analogin_t *obj)
183
return 0;
184
}
185
186
- ADC->CCR &= ~(ADC_CCR_VBATE | ADC_CCR_TSVREFE); // Workaround
+ // Measuring VBAT sets the ADC_CCR_VBATE bit in ADC->CCR, and there is not
187
+ // possibility with the ST HAL driver to clear it. If it isn't cleared,
188
+ // VBAT remains connected to the ADC channel in preference to temperature,
189
+ // so VBAT readings are returned in place of temperature.
190
+ ADC->CCR &= ~(ADC_CCR_VBATE | ADC_CCR_TSVREFE);
191
+
192
HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
193
194
HAL_ADC_Start(&AdcHandle); // Start conversion
0 commit comments