Hi,
How can I detect link-layer events, specifically link-up/down events? We are using the simplelink_msp432e4_sdk_4_20_00_12.
Regards,
-Mike
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
How can I detect link-layer events, specifically link-up/down events? We are using the simplelink_msp432e4_sdk_4_20_00_12.
Regards,
-Mike
Hi Mike,
Please refer to the EMACMSP432E4_processPhyInterrupt function. You can use this function to detect the link status. This function is in C:\ti\simplelink_msp432e4_sdk_4_20_00_12\source\ti\drivers\emac\EMACMSP432E4.c.
/* * ======== EMACMSP432E4_processPhyInterrupt ======== */ static void EMACMSP432E4_processPhyInterrupt() { uint16_t value; uint16_t status; uint32_t config; uint32_t mode; uint32_t rxMaxFrameSize; /* * Read the PHY interrupt status. This clears all interrupt sources. * Note that we are only enabling sources in EPHY_MISR1 so we don't * read EPHY_MISR2. */ value = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1); /* Read the current PHY status. */ status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS); /* Has the link status changed? */ if (value & EPHY_MISR1_LINKSTAT) { /* Is link up or down now? */ if (status & EPHY_STS_LINK) { EMACMSP432E4_private.linkUp = true; } else { EMACMSP432E4_private.linkUp = false; } /* Signal the stack for this link status change (from ISR) */ signalLinkChange(EMACMSP432E4_private.hEvent, EMACMSP432E4_private.linkUp, 1); } /* Has the speed or duplex status changed? */ if (value & (EPHY_MISR1_SPEED | EPHY_MISR1_DUPLEXM | EPHY_MISR1_ANC)) { /* Get the current MAC configuration. */ EMACConfigGet(EMAC0_BASE, (uint32_t *)&config, (uint32_t *)&mode, (uint32_t *)&rxMaxFrameSize); /* What speed is the interface running at now? */ if (status & EPHY_STS_SPEED) { /* 10Mbps is selected */ config &= ~EMAC_CONFIG_100MBPS; } else { /* 100Mbps is selected */ config |= EMAC_CONFIG_100MBPS; } /* Are we in full- or half-duplex mode? */ if (status & EPHY_STS_DUPLEX) { /* Full duplex. */ config |= EMAC_CONFIG_FULL_DUPLEX; } else { /* Half duplex. */ config &= ~EMAC_CONFIG_FULL_DUPLEX; } /* Reconfigure the MAC */ EMACConfigSet(EMAC0_BASE, config, mode, rxMaxFrameSize); } }
Hi Charles,
Thanks for pointing me to the section of code. Is there a way to get notified or collect errors with the Ethernet connection?
Regards,
-Mike
Hi Mike,
Looking through the PHY registers, I don't really any registers collecting errors at the Ethernet connection level other than the EPHYSTAT register which is being read by EMACMSP432E4_processPhyInterrupt. What specific errors are you looking for?
/* Read the current PHY status. */
status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS);
Hi Charles,
I was hoping I could collect any errors from the PHY when we get the link down notification. I don't have any specific errors in mind.
Regards,
-Mike