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.

tm4c1294kcpdt: How can configure ethernet led on TM4c1294kcptd

Part Number: TM4C1294KCPDT

Hi all,

I have a proble on configure ethenet led, please help me solve it !
On my design, I connect pin PF0( EN0LED0 ) to pin 10/100# of RJ45 port and PF4(EN0LED1) to pin Link/Act of RJ45 port.

And configure follow code:

 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);
    // PF1/PF0/PF4 are used for Ethernet LEDs.
    //
    HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0;
    GPIOPinConfigure(GPIO_PF1_EN0LED2);
    GPIOPinConfigure(GPIO_PF0_EN0LED0);
    GPIOPinConfigure(GPIO_PF4_EN0LED1);
    //
    // Make the pin(s) be peripheral controlled.
    //
    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_HW);
    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0|GPIO_PIN_4, GPIO_DIR_MODE_HW);
    //
    // Set the pad(s) for standard push-pull operation.
    //
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0|GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

So, when ehthernety active have only LED link is flashing and LED speed is off. When I swap 2 LED by hardware these work.
But I don't want to relayout PCB.
My question : How to configure PF0 is speed led and PF1 is link led ?

I tried this code but not work:

//
    // Configure Ethernet LED function
    //
    EMACPHYExtendedWrite(EMAC0_BASE, 0 , EPHY_LEDCR,
    (EMACPHYExtendedRead(EMAC0_BASE, 0 , EPHY_LEDCR) & ~ EPHY_LEDCR_BLINKRATE_M) |
    EPHY_LEDCR_BLINKRATE_20HZ);
    EMACPHYExtendedWrite(EMAC0_BASE, 0 , EPHY_LEDCFG,
    (EMACPHYExtendedRead(EMAC0_BASE, 0 , EPHY_LEDCFG) & ~ (EPHY_LEDCFG_LED0_M | EPHY_LEDCFG_LED1_M | EPHY_LEDCFG_LED2_M)) |
    EPHY_LEDCFG_LED0_100BT |
    EPHY_LEDCFG_LED1_LINK |
    EPHY_LEDCFG_LED2_RXTX);

Thanks,

Huy Huynh

  • Huy,

    There are 3 configurable LEDs, and they can surely be configured to your needs (you were wise enough to route the leds to the correct pins, apparently).

    It just seems that your configuration call is a bit confusing. Let's go by steps:

    There are two registers involving LED control and configuration.

    - The first one you are dealing with, EPHY_LEDCR, is related ONLY to the blinking rate. If you have it blinking already, don't bother changing this register for now.

    - The second one - EPHY_LEDCFG - is where you define what you want each led to blink for. Instead of reading the register, masking and rewriting, just try to pass the configuration parameter that you want. The first three parameters are correct, so did you try to simply write the fourth as you want? PF0 is always LED0, PF1 is LED2 and PF4 is LED1, so something like this should work:

    EMACPHYExtendedWrite(EMAC0_BASE, 0 , EPHY_LEDCFG,

    (EPHY_LEDCFG_LED0_M | EPHY_LEDCFG_LED1_M | EPHY_LEDCFG_LED2_M | EPHY_LEDCFG_LED0_100BT | EPHY_LEDCFG_LED1_LINK | EPHY_LEDCFG_LED2_RXTX));

    Note that there is one configuration that can use one led for "two purposes": Link OK/Blink on Tx/Rx. If you only connected two leds, you could use one for speed and the other for this mixed function. The configuration above sets the purpose for three leds, when you say that you only connected two, so one of them will be "blinking nowhere"...

    Other thing I noted is regarding pin configuration. I don't believe you need to configure GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_HW), the fact that you are using GPIOPinConfigure() probably does that (just confirm, I did not check). The same might apply to the pad configuration...

    Let us know.

    Regards

    Bruno