drivers: adc: driver setting the resolution for stm32wl

RM 0453: the sw is allowed to write the Data Resolution bits
of the ADC Config.Reg.1 only when ADEN = 0 (ADC disable).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2021-12-21 16:04:27 +01:00 committed by Christopher Friedt
commit c918c4f1d9

View file

@ -496,9 +496,10 @@ static int start_read(const struct device *dev,
return err;
}
#if defined(CONFIG_SOC_SERIES_STM32G0X)
#if defined(CONFIG_SOC_SERIES_STM32G0X) || \
defined(CONFIG_SOC_SERIES_STM32WLX)
/*
* Errata: Writing ADC_CFGR1 register while ADEN bit is set
* Writing ADC_CFGR1 register while ADEN bit is set
* resets RES[1:0] bitfield. We need to disable and enable adc.
*/
if (LL_ADC_IsEnabled(adc) == 1UL) {