中级会员
 
- 积分
- 388
- 金钱
- 388
- 注册时间
- 2017-3-2
- 在线时间
- 156 小时
|
1金钱
没插网线时,初始化 LwIP总失败,分析后发现是网口初始化总是失败,就是这个函数:HAL_ETH_Init,单步调试了一下,发现没插网线时,DMABMR寄存器的SR位始终为 1,程序卡在等待SR为0后超时退出。这个怎么解决啊?
[mw_shl_code=c,true]/* Ethernet Software reset */
/* Set the SWR bit: resets all MAC subsystem internal registers and logic */
/* After reset all the registers holds their respective reset values */
(heth->Instance)->DMABMR |= ETH_DMABMR_SR;
/* Get tick */
tickstart = HAL_GetTick();
/* Wait for software reset */
while (((heth->Instance)->DMABMR & ETH_DMABMR_SR) != (uint32_t)RESET)
{
/* Check for the Timeout */
if((HAL_GetTick() - tickstart ) > ETH_TIMEOUT_SWRESET)
{
heth->State= HAL_ETH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(heth);
/* Note: The SWR is not performed if the ETH_RX_CLK or the ETH_TX_CLK are
not available, please check your external PHY or the IO configuration */
return HAL_TIMEOUT;
}
}[/mw_shl_code]
|
|