|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
小弟正在做三速以太网的工程,使用NIOS搭建Qsys工程,使用Eclipse编译软件和在线Debug。
我的工程是FPGA内部集成MAC,通过SGMII接口与外部PHY芯片88E1111相连。
现在到了下板子调试的阶段,先是想实现MDIO口的配置功能,但是外部PHY在Auto Negotiation这一步卡住了。
C程序如下:
int main (void)
{
int phyadd;
int phyid1 = 0;
int phyid2 = 0;
np_tse_mac* pmac;
pmac = (np_tse_mac*) TSE_MAC_BASE;
// Find phyid...assuming it's National's PHY....for now.
for( phyadd = 0x00; phyadd < 0xff; phyadd++ )
{
IOWR(&pmac->MDIO_ADDR0, 0, phyadd);
phyid1 = IORD(&pmac->mdio0.PHY_ID1, 0);
phyid2 = IORD(&pmac->mdio0.PHY_ID2, 0);
if( phyid1 != phyid2 )
{
printf("\n\n\nPHY INFO: [phyid] 0x%x %x %x\n", phyadd, phyid1, phyid2);
phyadd = 0xff;
}
}
// Issue a PHY reset.
IOWR(&pmac->mdio0.CONTROL, 0, PCS_CTL_an_enable | PCS_CTL_sw_reset);
if( ( ( IORD(&pmac->mdio0.CONTROL,0) & PCS_CTL_rx_slpbk) != 0 ) || ( ( IORD(&pmac->mdio0.STATUS,0) & PCS_ST_an_done) == 0) )
{
IOWR(&pmac->mdio0.CONTROL, 0, PCS_CTL_an_enable | PCS_CTL_sw_reset);
printf( "PHY INFO: Issuing PHY Reset\n" );
}
//Holding pattern until autonegotiation completes.
if(( IORD( &pmac->mdio0.STATUS, 0 ) & PCS_ST_an_done ) == 0 )
{
printf( "PHY INFO: waiting on PHY link...\n" );
while(( IORD( &pmac->mdio0.STATUS, 0 ) & PCS_ST_an_done ) == 0 )
{
usleep(10);
printf( "while!\n" );
}
printf( "PHY INFO: PHY link detected, allowing network to start.\n\n\n\n" );
}
while(1);
return( 0 );
}
下板子Debug运行时,一直卡在“PHY INFO: waiting on PHY link...”这一步,说明autonegotiation没有完成。
请问搞过以太网的各位大神,这是什么情况?是不是软件部分缺少什么东西? |
|