Browse Source

Merge pull request #2705 from MoonwalkerLee/master

修改systick初始化,由于STM32H7系列与STM32F系列时钟架构不同导致
Bernard Xiong 6 years ago
parent
commit
9ac9b94351
1 changed files with 4 additions and 0 deletions
  1. 4 0
      bsp/stm32/libraries/HAL_Drivers/drv_common.c

+ 4 - 0
bsp/stm32/libraries/HAL_Drivers/drv_common.c

@@ -26,7 +26,11 @@ FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System);
 /* SysTick configuration */
 /* SysTick configuration */
 void rt_hw_systick_init(void)
 void rt_hw_systick_init(void)
 {
 {
+#if defined (SOC_SERIES_STM32H7)
+    HAL_SYSTICK_Config((HAL_RCCEx_GetD1SysClockFreq()) / RT_TICK_PER_SECOND);
+#else
     HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / RT_TICK_PER_SECOND);
     HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / RT_TICK_PER_SECOND);
+#endif
     HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
     HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
     HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
     HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
 }
 }