Forum Discussion
Altera_Forum
Honored Contributor
21 years agolan91c111 quiestion
I use standalone single threaded lwIP realization. And I have found that initialization procedure for lan91c111 doesn't pass if I didn't insert active network cable to it. So all program ex...
Altera_Forum
Honored Contributor
21 years agoIf ethernet cable not pluged than function "int alt_avalon_lan91c111_init(alt_avalon_lan91c111_if *dev)", from lan91C111 HAL library, return NON ZERO code.
Call graph: 1. netif_add() 2. lan91c111if_init() 3. low_level_init() 4. atl_avalon_lan91c111_init() 5. configure_phy() Initialisayion of LAN91C111 device failed by time-out in configure_phy(dev) function at this code: /* Start the Auto Negotiation process */
/* Try to negotiate, we have a go at this five times if it fails */
i = 5;
do
{
write_phy_register( dev,
ALTERA_AVALON_LAN91C111_PHY_CONTROL_REG,
ALTERA_AVALON_LAN91C111_PHY_CONTROL_ANEG_EN_MSK |
ALTERA_AVALON_LAN91C111_PHY_CONTROL_ANEG_RST_MSK);
/* This may take a few seconds */
timeout = 20;
do
{
value = read_phy_register(dev, ALTERA_AVALON_LAN91C111_PHY_STATUS_REG);
timeout --;
usleep(500000);
}while (!(value & ALTERA_AVALON_LAN91C111_PHY_STATUS_ANEG_ACK_MSK)
&& (timeout > 0));
i --;
}
while( (i != 0) && (timeout == 0));
if (timeout == 0)
{
ret_code = -EIO;
goto exit;
} 5. configure_phy(): ret_code = -EIO; 4. alt_avalon_lan91c111_init(): ret_code = -EIO; 3. low_level_init(): return (err_t)ERR_IF; 2. lan91c111if_init(): return (err_t)ERR_IF; 1. netif_add(): return NULL For avoid program HALT you may check netif_add return code and if it is NULL try recall netif_add function.