瀏覽代碼

[BSP][STM32F4xx-HAL]support HSE Bypass

zyh 6 年之前
父節點
當前提交
8c32f817a3
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 4 0
      bsp/stm32f4xx-HAL/Kconfig
  2. 4 0
      bsp/stm32f4xx-HAL/drivers/board.c

+ 4 - 0
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

+ 4 - 0
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)