Skip to content

Commit 1654f81

Browse files
FRASTMfabiobaltieri
authored andcommitted
drivers: adc: stm32g0 fix sampling time due to errata sheet
According to the ES0418 about the ADC of the stm32G071 or other stm32g0x devices: for sampling time set to 1.5 or 3.5 cycles, the sampling in a single ADC conversion or in the first conversion of a sequence takes one extra cycle. Minimizing to 7.5 is fine. Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 7a11d88 commit 1654f81

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/adc/adc_stm32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,10 @@ static void adc_stm32_setup_speed(const struct device *dev, uint8_t id,
837837
LL_ADC_SetSamplingTimeCommonChannels(adc,
838838
table_samp_time[acq_time_index]);
839839
#elif defined(CONFIG_SOC_SERIES_STM32G0X)
840+
/* Errata ES0418 and more: ADC sampling time might be one cycle longer */
841+
if (acq_time_index < 2) {
842+
acq_time_index = 2;
843+
}
840844
LL_ADC_SetSamplingTimeCommonChannels(adc, LL_ADC_SAMPLINGTIME_COMMON_1,
841845
table_samp_time[acq_time_index]);
842846
#else

0 commit comments

Comments
 (0)