Skip to content

Commit dca9c2b

Browse files
FRASTMfabiobaltieri
authored andcommitted
drivers: adc: stm32f3 adc driver set common clock to HCLK
Set the synchronous clock mode to HCLK/1 (DIV1) or HCLK/2 (DIV2) Both are valid common clock setting values. The HCLK/1 (DIV1) is possible only if the ahb-prescaler = <1> in the RCC_CFGR (see DTS). Signed-off-by: Francois Ramu <[email protected]>
1 parent a0a124c commit dca9c2b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/adc/adc_stm32.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,15 +1158,23 @@ static int adc_stm32_init(const struct device *dev)
11581158
defined(CONFIG_SOC_SERIES_STM32L0X) || \
11591159
defined(CONFIG_SOC_SERIES_STM32WLX)
11601160
LL_ADC_SetClock(adc, LL_ADC_CLOCK_SYNC_PCLK_DIV4);
1161-
#elif defined(STM32F3X_ADC_V1_1) || \
1162-
defined(CONFIG_SOC_SERIES_STM32L4X) || \
1161+
#elif defined(CONFIG_SOC_SERIES_STM32L4X) || \
11631162
defined(CONFIG_SOC_SERIES_STM32L5X) || \
11641163
defined(CONFIG_SOC_SERIES_STM32WBX) || \
11651164
defined(CONFIG_SOC_SERIES_STM32G0X) || \
11661165
defined(CONFIG_SOC_SERIES_STM32G4X) || \
11671166
defined(CONFIG_SOC_SERIES_STM32H7X)
11681167
LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc),
11691168
LL_ADC_CLOCK_SYNC_PCLK_DIV4);
1169+
#elif defined(STM32F3X_ADC_V1_1)
1170+
/*
1171+
* Set the synchronous clock mode to HCLK/1 (DIV1) or HCLK/2 (DIV2)
1172+
* Both are valid common clock setting values.
1173+
* The HCLK/1(DIV1) is possible only if
1174+
* the ahb-prescaler = <1> in the RCC_CFGR.
1175+
*/
1176+
LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc),
1177+
LL_ADC_CLOCK_SYNC_PCLK_DIV2);
11701178
#elif defined(CONFIG_SOC_SERIES_STM32L1X) || \
11711179
defined(CONFIG_SOC_SERIES_STM32U5X)
11721180
LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc),

0 commit comments

Comments
 (0)