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.

TM4C129 Ethernet LED Polarity

Hello,

I'm using a TM4C129ENCPDTI3 on a custom board with an RJ45 jack with 2 LEDs connected to pins PF0 and PF4.

I have everything up and working, but the ethernet LEDs seem to have reversed polarity from what is expected (i.e. both on when nothing in plugged in).

There seems to be a a register in the documentation (register 68) that should allow changing of this polarity, but I can't seem to get this to work.

I'm aware that there is an errata for silicon rev 1 relating to not being able to change this polarity, but rev 3 shouldn't be affected.

Any additional input would be appreciated.

  • Hello Mike,

    Can you please send the code that you have to configure the GPIO as Ethernet LED and the Polarity Swapping?

    Regards

    Amit

  • Hi Amit,

    Relevant code is below. I'm not sure if there's a better way to go about setting the polarity bit in reg 68, but this is what I tried.

    // *** Ethernet Status LEDs ***
    MAP_GPIOPinConfigure(GPIO_PF0_EN0LED0);   // PF0 is ethernet LED0
    MAP_GPIOPinConfigure(GPIO_PF4_EN0LED1);   // PF4 is ethernet LED1
    GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4);

    EMAC0_CC_R |= 0x20000;

    Thanks for the help

  • Hello Mike

    PF0 is a locked pin. You would need to unlock it for configuring the Pin to another function.

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/374640.aspx

    Regards

    Amit

  • Amit,

    Thanks for the advice, but the problem is still there.  I am able to get the LEDs working and functioning as intended, but with reversed polarity.

    The problem seems to be with setting the POL bit in register 68.  Is there some recommended way of accessing this?

    Thanks

  • Mike, 

    Here is how I flip it:

      // Set Ethernet LED polarity to be active low
      HWREG(EMAC0_BASE + EMAC_O_CC) |= EMAC_CC_POL;

    Jeff

  • Jeff,

    Thanks for the help.

    For me EMAC_CC_POL throws an undefined error, and hardcoding what I believe to be the corresponding hex value of 0x20000 gives the same results as before, it chokes while executing that line.

    But since EMAC_CC_POL isn't defined I'm wondering if it's some problem using a previous version of TivaWare?

    I currently have 2.0.1.11557a and defines for EMAC_O_CC register are:

    //*****************************************************************************
    //
    // The following are defines for the bit fields in the EMAC_O_CC register.
    //
    //*****************************************************************************
    #define EMAC_CC_PTPCEN          0x00040000  // PTP Clock Reference Enable
    #define EMAC_CC_ECEXT           0x00020000  // EN0RREF_CLK Signal Source
    #define EMAC_CC_CLKEN           0x00010000  // EN0RREF_CLK Signal Enable
    #define EMAC_CC_CS_M            0x0000000F  // Ethernet PHY Clock Reference
                                                // Source
    #define EMAC_CC_CS_MOSC         0x00000000  // MOSC
    #define EMAC_CC_CS_PA7          0x00000001  // GPIO (PA7)

    Which would explain why hardcoding the value doesn't work. It seems to be assigned to a completely different bit mapping.  This seems like a pretty significant change between versions.

    Is it possible to get this to work on my current version?

  • I don't know why it is so different in 2.1, but I do know it works. :~)

    2.1 has been out for quite a while - perhaps it's time to upgrade.

    Jeff

  • Hello Mike.

    TivaWare 2.1.0 is the follow up version and has these bits defined. That would sort the compilation issue. However if the part is indeed rev-3 then it should work.

    Also I checked the 2.1.0 and 2.0.1 difference and it seems that calling the EMACPhyConfigSet will actually clear this bit which I think in the code is being done after the POL reversal.

    Jeff, thanks a lot...

    Regards

    Amit

  • This seems to have done the trick.

    Flipping the bit after EMACPhyConfigSet successfully changed the polarity. I did end up having to hard code the 0x20000 value though so this may not be an ideal solution.

    Still not sure why it was crashing all together when I tried changing the bit right after configuring the GPIO though. The PC just jumped to 0xfffffffe on that line.

    This seems to work for now though so thanks for the help.