File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
targets/TARGET_STM/TARGET_STM32H7 Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,25 @@ void analogin_pll_configuration(void)
36
36
37
37
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
38
38
PeriphClkInitStruct .PeriphClockSelection = RCC_PERIPHCLK_ADC ;
39
- PeriphClkInitStruct .PLL2 .PLL2M = 4 ;
40
- PeriphClkInitStruct .PLL2 .PLL2N = 240 ;
41
- PeriphClkInitStruct .PLL2 .PLL2P = 2 ;
42
- PeriphClkInitStruct .PLL2 .PLL2Q = 2 ;
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 ;
43
58
PeriphClkInitStruct .PLL2 .PLL2R = 2 ;
44
59
PeriphClkInitStruct .PLL2 .PLL2RGE = RCC_PLL2VCIRANGE_1 ;
45
60
PeriphClkInitStruct .PLL2 .PLL2VCOSEL = RCC_PLL2VCOWIDE ;
You can’t perform that action at this time.
0 commit comments