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.

TM4C129ENCPDT: How do I configure the Ethernet LEDs using the Tivaware API?

Part Number: TM4C129ENCPDT

I want to write LED configuration registers EPHYLEDCFG, EPHYLEDCR, etc. however the TivaWare API guide is unclear - should I use EMACConfigSet, EMACPHYConfigSet, or other functions to do this? What should I pass to one of these functions? 

Additionally, is it possible to invert the LED polarity, so that it is normally off and blinks only when packets are received, without hardware changes?

Many thanks

  • Hi Tom,

     The LED registers is part of the extended registers. You need to use EMACPHYExtendedWrite() and EMACPHYExtendedRead() to access these registers.

    The normal address range from the MDIO is from MR0 to MR31. Any register beyond MR31 is covered by extended mode. This can be seen in the datasheet Register table for Ethernet PHY.

     You can configure the EPHYLEDCFG register to blink during one of below events. Please refer to the datasheet. In your case, you can configure for RX activity if that is what you want only.

      

  • This resolved the issue.

    For future reference this is the code I used to set the LED state.

    	// TX/RX/PPS LEDs are driven by Ethernet controller
    	// ACT/LNK driven by Ethernet task
    	GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_4);
    	GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_5);
    	GPIOPinConfigure(GPIO_PK4_EN0LED0);
    	GPIOPinConfigure(GPIO_PK5_EN0LED2);
    	// Configure LED mode
    	EMACPHYExtendedWrite(EMAC0_BASE, 0, 0x025, 0x0302);
    	EMACPHYWrite(EMAC0_BASE, 0, 0x018, 0x0000); 

    The only issue I seem to be having is that writing 0x0000 to the register in the lower bank at 0x018 does not set the blink rate as I would expect it. The blink rate remains unchanged. I would like to set it to a 20Hz blink rate, which should mean 0x0000 is written to the register.

  • Hi Tom,
    For address 0x018 can you also try EMACPHYExtendedWrite() to write the register? Will it make a difference?
  • Hi Charles,
    I have tried that and it appears to lock up the processor once that line is hit.
    Thanks
  • Hi Tom,
    Which board do you have? the LaunchPad or your custom board? You are trying to use PK5 for Ethernet RX but PK5 is not connected to the LaunchPad on-board LED (D1, D2, D3, D4).

    However, I did try to change the blink rate with the TivaWare Ethernet sample code. I used the extended write API to write the blink rate register. It didn't lock up on me. My eyes couldn't tell if there was a change in the blink rate though.
  • Charles Tsai said:
    My eyes couldn't tell if there was a change in the blink rate though.

    Would not a scope tied to the Led better tell you?