File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
targets/TARGET_STM/TARGET_STM32F1/TARGET_STM32F103xE Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,14 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
105
105
/* Enable HSE oscillator and activate PLL with HSE as source */
106
106
RCC_OscInitStruct .OscillatorType = RCC_OSCILLATORTYPE_HSE ;
107
107
if (bypass == 0 ) {
108
- RCC_OscInitStruct .HSEState = RCC_HSE_ON ; /* External 8 MHz xtal on OSC_IN/OSC_OUT */
108
+ RCC_OscInitStruct .HSEState = RCC_HSE_ON ; /* External xtal on OSC_IN/OSC_OUT */
109
109
} else {
110
110
RCC_OscInitStruct .HSEState = RCC_HSE_BYPASS ; /* External 8 MHz clock on OSC_IN */
111
111
}
112
- RCC_OscInitStruct .HSEPredivValue = RCC_HSE_PREDIV_DIV1 ;
112
+ RCC_OscInitStruct .HSEPredivValue = RCC_HSE_PREDIV_DIV1 ; // 8 MHz external xtal (8 MHz = 8 MHz / 1)
113
+ #if (HSE_VALUE == 16000000 )
114
+ RCC_OscInitStruct .HSEPredivValue = RCC_HSE_PREDIV_DIV2 ; // 16 MHz external xtal (8 MHz = 16 MHz / 2)
115
+ #endif
113
116
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_ON ;
114
117
RCC_OscInitStruct .PLL .PLLSource = RCC_PLLSOURCE_HSE ;
115
118
RCC_OscInitStruct .PLL .PLLMUL = RCC_PLL_MUL9 ; // 72 MHz (8 MHz * 9)
You can’t perform that action at this time.
0 commit comments