stm32/adc: Fix ADCAll.read_core_temp() on L4 MCUs.

TS_CAL1 and TS_CAL2 of STM32L4 are at VDDA=3.0V, so the reference
correction factor should be updated before reading tempsensor.
This commit is contained in:
yn386 2022-10-22 16:19:58 +09:00 committed by Damien George
parent 2154ee2163
commit f6b5d1838b

View File

@ -860,9 +860,9 @@ float adc_read_core_temp_float(ADC_HandleTypeDef *adcHandle) {
return 0; return 0;
} }
#else #else
#if defined(STM32L1) #if defined(STM32L1) || defined(STM32L4)
// Update the reference correction factor before reading tempsensor // Update the reference correction factor before reading tempsensor
// because TS_CAL1 and TS_CAL2 of STM32L1 are at VDDA=3.0V // because TS_CAL1 and TS_CAL2 of STM32L1/L4 are at VDDA=3.0V
adc_read_core_vref(adcHandle); adc_read_core_vref(adcHandle);
#endif #endif
int32_t raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR); int32_t raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR);