[求助] gd32的初始化问题

[复制链接]
查看1455 | 回复3 | 2021-9-10 17:07:24 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区

您需要 登录 才可以下载或查看,没有账号?立即注册

×
ErrStatus enet_software_reset(void)
{
    uint32_t timeout = 0U;
    ErrStatus enet_state = ERROR;
    uint32_t dma_flag;
   
                uint32_t test_reg1, test_reg2;
   
    /* reset all core internal registers located in CLK_TX and CLK_RX */
        test_reg1 = ENET_DMA_BCTL_SWR;
        test_reg2 = ENET_DMA_BCTL;
    ENET_DMA_BCTL |= ENET_DMA_BCTL_SWR;
    test_reg2= ENET_DMA_BCTL;
    /* wait for reset operation complete */
    do{
        dma_flag = (ENET_DMA_BCTL & ENET_DMA_BCTL_SWR);
        timeout++;
    }while((RESET != dma_flag) && (ENET_DELAY_TO != timeout));

    /* reset operation complete */   
    if(RESET == (ENET_DMA_BCTL & ENET_DMA_BCTL_SWR)){
        enet_state = SUCCESS;
    }
        
    return enet_state;
}
ENET_DMA_BCTL_SWR寄存器总是为不能清0,导致初始化不成功。
回复

使用道具 举报

魏伟 | 2021-9-11 00:20:06 | 显示全部楼层
回复

使用道具 举报

wangy2000 | 2021-9-11 07:57:47 | 显示全部楼层
回复

使用道具 举报

mj8abcd | 2021-9-11 16:45:15 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则