修改systick初始化,由于STM32H7系列与STM32F系列时钟架构不同导致

STM32H7系列与STM32F系列时钟架构不同
STM32F系列systick时钟源来自HCLK
STM32H7系列systick时钟源来自SystemCoreClock
因此增加SOC_SERIES_STM32H7作为编译条件
This commit is contained in:
lizhen9880 2019-05-21 17:26:34 +08:00 committed by GitHub
parent a1898156bf
commit d88afc3985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}