Other Parts Discussed in Thread: EK-TM4C1294XL
Hi,
I am using an EK-TM4C1294XL, tirtos_tivac_2_01_00_03, ndk_2_23_01_01 and TI v5.1.5 compiler.
In my application I need to change ethernet interface speed to 10Mbs or 100Mbs. In EMACPC there are bits ANEN and ANMODE. And EPHYBMCR register have bits SPEED and ANEN. Should I use EMACPC register or EPHYBMCR register?
I have a example code, but doesn't work. Is something missing in this code?
void configEMACSpeed(int speed)
{
uint16_t ui16Status;
uint32_t ui32Config, ui32Mode, ui32RxMaxFrameSize;
/* Get the current MAC configuration. */
EMACConfigGet(EMAC0_BASE, &ui32Config, &ui32Mode,
&ui32RxMaxFrameSize);
/* Read the current PHY status. */
ui16Status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS);
/* What speed is the interface running at now?
*/
if(ui16Status & EPHY_STS_SPEED)
//if (speed == BT10)
{
/* 10Mbps is selected */
ui32Config &= ~EMAC_CONFIG_100MBPS;
}
else if(speed == BT100)
{
/* 100Mbps is selected */
ui32Config |= EMAC_CONFIG_100MBPS;
}
/* Are we in fui32l- or half-duplex mode? */
if(ui16Status & EPHY_STS_DUPLEX)
{
/* Fui32l duplex. */
ui32Config |= EMAC_CONFIG_FULL_DUPLEX;
}
else
{
/* Half duplex. */
ui32Config &= ~EMAC_CONFIG_FULL_DUPLEX;
}
/* Reconfigure the MAC */
EMACConfigSet(EMAC0_BASE, ui32Config, ui32Mode, ui32RxMaxFrameSize);
}