然后调试到HAL_Delay()方法的内部发现 HAL_GetTick( )函数一直返回 __weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a freq to guarantee minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); } ...
SysTick->LOAD = nus*fac_ms; //设置要数到值 SysTick->VAL = 0x00; //清空计数器的值 SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; //SysTick定时器使能 do { temp = SysTick->CTRL; }while((temp&0x01)&&!(temp&(1<<16))); //判断是否计数到达 SysTick->CTRL &=~SysTick_CTRL_ENABLE_...
stm32程序卡死在if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE),该怎么解决啊 ...
1 自带的hal_delay 函数 毫秒级延迟 1voidHAL_Delay(__IO uint32_t Delay)2{3uint32_t tickstart = HAL_GetTick();//获取tick值(毫秒)4uint32_t wait =Delay;56/*Add a period to guarantee minimum wait*/7if(wait <HAL_MAX_DELAY)8{9wait++;//传参,延时的时间10}1112while((HAL_GetTick() ...
uint32_twait=Delay; /* Add a freq to guarantee minimum wait */ if(wait<HAL_MAX_DELAY) { wait+=(uint32_t)(uwTickFreq); } while((HAL_GetTick()-tickstart)<wait) { } } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. ...
后面发现,HAL库有两个隐患:对描述符的处理有问题 因为单片机是Cortex-M7,有Cache和单片机会乱序执行和...
__weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a freq to guarantee minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); } while ((HAL_GetTick() - tickstart) < wait) ...
stm32h7xx_hal_eth.c a timeout is triggered: /* Wait for software reset */ while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 0U) { if (((HAL_GetTick() - tickstart) > ETH_SWRESET_TIMEOUT)) { /* Set Error Code */ heth->ErrorCode = HAL_E...
hspi->RxXferCount--;//}}if((Timeout != HAL_MAX_DELAY) && ((HAL_GetTick()-tickstart) >=Timeout)) { errorcode=HAL_TIMEOUT;gotoerror; } }while((hspi->TxXferCount >0) || (hspi->RxXferCount >0)) {/*check TXE flag*/if((hspi->TxXferCount >0) && ((hspi->Instance->SR...
tickstart = HAL_GetTick(); //这里每次在发送前拿到systick中断中的计数值,作为计数的初值。huart-...