Skip to content

Commit f6b5d18

Browse files
yn386dpgeorge
authored andcommitted
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.
1 parent 2154ee2 commit f6b5d18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/stm32/adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,9 @@ float adc_read_core_temp_float(ADC_HandleTypeDef *adcHandle) {
860860
return 0;
861861
}
862862
#else
863-
#if defined(STM32L1)
863+
#if defined(STM32L1) || defined(STM32L4)
864864
// Update the reference correction factor before reading tempsensor
865-
// because TS_CAL1 and TS_CAL2 of STM32L1 are at VDDA=3.0V
865+
// because TS_CAL1 and TS_CAL2 of STM32L1/L4 are at VDDA=3.0V
866866
adc_read_core_vref(adcHandle);
867867
#endif
868868
int32_t raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR);

0 commit comments

Comments
 (0)