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.

Is possible to change Ethernet LED configuration inside TI-RTOS APIs ?

Other Parts Discussed in Thread: TM4C1294KCPDT

Hello, my name is Leonardo and I have some questions about if is possible to change or implement a Ethernet PHY LED configurations inside the EMAC_Init() fuction.

More backgroud details, I develop a board using the TM4C1294KCPDT microcontroller to use in some project in the company where I work. Today I am trying to use / understand the TI-RTOS with network applications. I spend some time reading and analysing the documents about NDK, TI-RTOS and use some TM4C1294XL board examples to get more information.

Fortunaly, I was able to modify the UDP_ECHO and TCP_ECHO examples to run with my configuration (just modify some lines of code to math with TM4C1294KCPDT Microcontroller and my hardware configuration) and using the udpSendReceive.exe  and tcpSendReceive.exe files I could see that at list that the Hardware and the Firmware are working.

The point is, when I was changing the example code I need to change the Ethernet PHY LEDs configuration, because my hardware is not the same as TM4C1294XL board. More exactly this piece of the code:

GPIOPinConfigure(GPIO_PK6_EN0LED1);
GPIOPinConfigure(GPIO_PK5_EN0LED2);
GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_5 | GPIO_PIN_6);

Just change the PF0 and PF4 to PK5 and PK6

Running the program I see that the LEDs are configured with the wrong event. Is possible to notice that PK5_LED2 is indicating that Connection OK and PK6_LED1 is indicating RX/TX activity, but I need PK5_LED2 indicate RX/TX activity and PK6_LED1 indicate Connection OK.

I know that is simple to change this configuration in the EPHYLEDCR register, but all MAC/PHY configuration is made inside EMACSnow.c file, I dont find any line that is configuring it and I am afraid to made some change in the PHY register after his inicialization.

So... If is a line of code that made this configurations and I dont find it, where is it ? and what change I need to do ? .... or, if isnt..... is possible to implement a code to made this configuration ? Where ? How ?

Sorry for any miss understanding in my english.

Best regrads,

  • Hi,

    It might take a bit of time to get back with more help, in the meanwhile can you take a look at the following tiva-c github project and check out their GPIO PIN configuration and see if anything rings the bell:
    github.com/.../pinout.c

    Murat
  • Hi,
    Do you have any more progress on the issue or same question still open?
    Murat
  • Hi Murat,

    Sorry for the delay. I was a little busy in the last days and I assume that I will receive a email when someone answer, what did not happen...

    So, I take a look in the tiva-c github project that you indicated, but unfortunally I think that isn't what I am looking. In this .c file has only examples of using the GPIOPinConfigure() and GPIOPinTypeEthernetLED(), what I already have done.

    I am looking for some EMAC/PHY configure fuction that make me able to configure what fuction the Ethernet LED1 and LED2 will assume. I try to search deep inside the EMAC_Init() fuction and I end inside the EMACsnow.c file, where all the EMAC and PHY peripheral are configure, but dont find any fuction or line that make that kind of configuration.

    I am staring to supose that the libraries dont config the ethernet LEDs so they are configured with the default configuration). So... IF there isn't line of code that do this kind of configuration inside the librearis, I need to put a code that make that  changes. But I dont know where to start... I hope you can help me.

    Again... sorry for the delay and thank you Murat, I will be wainting for your reply.

    Best regrads,

    Leonardo Verona da Silva

  • Hi Leonardo,

    You are right in that there is no config related changes for you to make, and you would need to do your own configuration by editing the EMACsnow.c and configuring the Ethernet PHY LED (EPHYLEDCFG at addr: 0x025) directly.

    Looking at the device TRM at: http://www.ti.com/lit/ds/symlink/tm4c1294kcpdt.pdf  (Page: 1640)

    and in Tivaware: 

    inc/hw_emac.h - This is where the register address is defined (EPHY_LEDCFG)
    driverlib/emac.h - This is where the driverlib APIs are.

    you can issue the following reg write inside the EMACSnow_emacStart() function:

    EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_LEDCFG, 0x08 << 8);

     to configure LED2 to indicate "Link OK/blink on  TX/RX Activity".

    Hope this helps,
    Murat

  • Hi Murat,

    I believe that what you said is the answer, but I need one more help (maybe I am forgotting somethink). I did the changes in the EMACsnow.c file, put this line of code inside EMACsnow_emacStar() fuction:

    EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_LEDCFG, 0x0100);

    ... and Build the project, but looks like nothing has change, or rather, looks like CCS Compiler is not building EMACsnow.c . So, I believe that exist somethink else to do and I dont know what, could you please help me ?

    Thank you for the reply !

    Best Regrads,

    Leonardo Verona
  • Hi Leonardo,

    Well, I would first do a project clean and then a fresh build. Poke around and make sure that the timestamps on the object files correlate with your build time.
    Another thought could be that your project is finding another EMACsnow.c, other than the one you are modifying, can you make sure your project is in tact?

    Murat
  • Hi Murat,

    Thank you for the reply.

    I did "Project clean" and Delete Debug/Release folder then "Rebuild Project" and still nothing has change. I am sure that I am modifying the EMACsnow.c correct, because I could see, through debug, that is this file that the project get in when try to initialize the EMAC/PHY peripheral.

    And I am sure that this file isn't be build, because I put a while(1) loop and a "wrong line of code" too, inside the fuction and nothing had change.

    I am not sure, but I remeber to read something about Rebuilding the XDCTool or TI-RTOS libraries. Maybe I need to do something like that ?

    Best Regrads,

    Leonardo Verona
  • Hi Leonardo,


    It must be frustrating, but I don't have more information to help here. Can you look at the build log on your console and check the paths of the libraries getting linked in. Perhaps a pre-built library where EMACsnow.c exists is on your path and getting linked in ahead of the object file you are using.

    Also try explicitly removing and adding back EMACsnow.c into your project, have some invalid code so you get compile error, etc., and see what happens.

    Murat

  • Hi Murat,

    I will try to rebuild the NDK libraries and I will return with what I get.

    Best Regrads,

    Leonardo Verona