Skip to content

Commit 10ac121

Browse files
committed
stm32h7: adc: use CLKP as clock source
Fixes analogRead() interferring with DSI/SDRAM
1 parent 918979b commit 10ac121

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

Diff for: targets/TARGET_STM/TARGET_STM32H7/analogin_device.c

+1-24
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,7 @@ void analogin_pll_configuration(void)
3636

3737
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
3838
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
39-
if(__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI) {
40-
PeriphClkInitStruct.PLL2.PLL2M = 16;
41-
PeriphClkInitStruct.PLL2.PLL2N = 120;
42-
} else {
43-
#if HSE_VALUE==8000000
44-
PeriphClkInitStruct.PLL2.PLL2M = 2;
45-
PeriphClkInitStruct.PLL2.PLL2N = 120;
46-
#elif HSE_VALUE==16000000
47-
PeriphClkInitStruct.PLL2.PLL2M = 2;
48-
PeriphClkInitStruct.PLL2.PLL2N = 60;
49-
#elif HSE_VALUE==25000000
50-
PeriphClkInitStruct.PLL2.PLL2M = 5;
51-
PeriphClkInitStruct.PLL2.PLL2N = 96;
52-
#else
53-
error("HSE not configured properly");
54-
#endif
55-
}
56-
PeriphClkInitStruct.PLL2.PLL2P = 3;
57-
PeriphClkInitStruct.PLL2.PLL2Q = 4;
58-
PeriphClkInitStruct.PLL2.PLL2R = 2;
59-
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_1;
60-
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
61-
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
62-
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
39+
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_CLKP;
6340
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
6441
error("analogin_init HAL_RCCEx_PeriphCLKConfig");
6542
}

0 commit comments

Comments
 (0)