From d88afc3985bbe4feb088d4fe124bff3bb659c37c Mon Sep 17 00:00:00 2001 From: lizhen9880 Date: Tue, 21 May 2019 17:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9systick=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E7=94=B1=E4=BA=8ESTM32H7=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E4=B8=8ESTM32F=E7=B3=BB=E5=88=97=E6=97=B6=E9=92=9F=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E4=B8=8D=E5=90=8C=E5=AF=BC=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit STM32H7系列与STM32F系列时钟架构不同 STM32F系列systick时钟源来自HCLK STM32H7系列systick时钟源来自SystemCoreClock 因此增加SOC_SERIES_STM32H7作为编译条件 --- bsp/stm32/libraries/HAL_Drivers/drv_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_common.c b/bsp/stm32/libraries/HAL_Drivers/drv_common.c index 9bffc026e4..4102815bb2 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_common.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_common.c @@ -26,7 +26,11 @@ FINSH_FUNCTION_EXPORT_ALIAS(reboot, __cmd_reboot, Reboot System); /* SysTick configuration */ 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); +#endif HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); } -- GitLab