summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZYH <[email protected]>2018-07-06 10:50:24 +0800
committerGitHub <[email protected]>2018-07-06 10:50:24 +0800
commita0cb70575ab9c85fcf76fc1737f26f4b496a07dc (patch)
tree5abd730015d9e6ed033eb931c4014a8084e6a07a
parente6a34ead5d6f3bc3aa97f96f38983c557afa0288 (diff)
parent8c32f817a33df053083d08ab6c8eb5993273c9b7 (diff)
Merge pull request #1608 from uestczyh222/bypass
[BSP][STM32F4xx-HAL]support HSE Bypass
-rw-r--r--bsp/stm32f4xx-HAL/Kconfig4
-rw-r--r--bsp/stm32f4xx-HAL/drivers/board.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/bsp/stm32f4xx-HAL/Kconfig b/bsp/stm32f4xx-HAL/Kconfig
index 94242ca0f0..f953d8f8ce 100644
--- a/bsp/stm32f4xx-HAL/Kconfig
+++ b/bsp/stm32f4xx-HAL/Kconfig
@@ -286,6 +286,10 @@ endchoice
config RT_USING_HSI
bool "Using HSI as clock source"
default n
+config BSP_HSE_BY_PASS
+ bool "HES Bypass"
+ depends on !RT_USING_HSI
+ default n
config RT_HSE_VALUE
int "HSE Value"
default 8000000
diff --git a/bsp/stm32f4xx-HAL/drivers/board.c b/bsp/stm32f4xx-HAL/drivers/board.c
index b45218d942..3253fdda54 100644
--- a/bsp/stm32f4xx-HAL/drivers/board.c
+++ b/bsp/stm32f4xx-HAL/drivers/board.c
@@ -50,7 +50,11 @@ static void SystemClock_Config(void)
RCC_OscInitStruct.OscillatorType |= RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
#endif
+#ifdef BSP_HSE_BY_PASS
+ RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
+#elif !defined(RT_USING_HSI)
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+#endif
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
if (hse_clk % 2 == 0)