cancel
Showing results for 
Search instead for 
Did you mean: 

Configure the MAC with the Duplex Mode fixed by the autonegotiation process

hugh2
Associate II
Posted on October 13, 2009 at 17:26

Configure the MAC with the Duplex Mode fixed by the autonegotiation process

2 REPLIES 2
hugh2
Associate II
Posted on May 17, 2011 at 09:58

In the code snipit below, from 91x_enet.c the ENET_MAC is fixed up based on the reprted result of auto-negotiation.

I dont understand why the duplex mode is fixed up after comparing for speed. I've added pseudo line numbers to point to the lines I don't understand.

The correct register is read in line 0004.

Then in line 0005 I see ''if( regValue & PHY_Configured_Speed)''.

It seems to me this should read ''if( regValue & PHY_Configured_Duplex)''.

Does anyone have an explanation or is this an error?

Regards

Hugh

if(ENET_OperatingMode == AUTO_NEGOTIATION)

{

/* The Link Status bit is a Latching High bit, so we need to read twice to get the real value */

0000 ENET_MIIReadReg (PHY_ADDRESS, PHY_XSR);

/* We wait for linked satus... */

0001 while( !(ENET_MIIReadReg (PHY_ADDRESS, PHY_XSR) & PHY_Linked_Status) );

/* Enable Auto-Negotiation */

0002 ENET_MIIWriteReg (PHY_ADDRESS, PHY_XCR, PHY_AutoNegotiation);

/* Wait until the autonegotiation will be completed */

0003 while( !(ENET_MIIReadReg (PHY_ADDRESS, PHY_XSR) & PHY_AutoNego_Complete) );

/* Read the result of the autonegotiation */

0004 regValue = ENET_MIIReadReg (PHY_ADDRESS, PHY_XCIIS);

/* */

0005 if( regValue & PHY_Configured_Speed)

{

ENET_MAC->MCR |=ENET_MCR_FDM; /* Full Duplex Mode */

ENET_MAC->MCR &=~ENET_MCR_DRO; /* Enable frame reception during transmission */

}

else

{

ENET_MAC->MCR &=~ENET_MCR_FDM; /* Half Duplex Mode */

ENET_MAC->MCR |=ENET_MCR_DRO; /* Disable frame reception during transmission */

}

}

tomas23
Associate II
Posted on May 17, 2011 at 09:58

There may be errors in the library. Can you please test your suggestion and reply? ST is not saint, although... :D