程序死在了自带库的微秒延时
void BSP_SYSTEM_Delay_us(uint32_t usCnt)
{
/* SysTick default clock source: HCLK/8 = 32MHz/8 = 4MHz */
SysTick->LOAD = 4 * usCnt;
/* Clear SysTick current counter value */
SysTick->VAL = 0;
/* Enable SysTick counter */
SysTick->CTRL = SysTick_CTRL_ENABLE_Msk;
/* Wait for SysTick counter to 0 */ while (!(SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk))//死在这一部
{
}
/* Disable SysTick counter */
SysTick->CTRL = ~SysTick_CTRL_ENABLE_Msk;
/* Clear SysTick current counter value */
SysTick->VAL = 0;
}
|