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.

TM4C129DNCPDT with external phy through MII?

Intellectual 680 points

Replies: 47

Views: 4888

Hi all,

   I'm using the tm4c129dncpdt in my project.It is connected to KSZ8765CLX trough MII interface.I once use the TM4C1294NCPDT in my project.The 1294 chip has internal phy in it and have ti-rtos example software support.But how can I get the ethernet example for the 129D chip?How can I developement the chip that has no phy in it?Can I use the NDK products in the tirtos_tivac_2_16_01_14 software and how?I don't have any idea of it.

more you learn, more you understand

47 Replies

  • In reply to Amit Ashara:

    Hi Amit,

    Looks like I misread it.  It stated that there's available I/O expansion interface headers for external PHY.

    Thanks.

  • In reply to SL:

    Hello SL,

    Exactly. The expansion header is where the SDRAM board from TIDM-TM4C129XSDRAM is connected and similar can be done for ULPI (USBHS) and external PHY.

    Regards,

    Amit Ashara

  • In reply to Amit Ashara:

    Hello,

    I guess I am working on the same type of issue. I am trying to interface an external PHY to the TM4C129X dev board. I can connect using MII, but when I configure RMII, I crash whenever I hit this line in lwiplib.c:

    //
    // Initialize the MAC and set the DMA mode.
    //
    MAP_EMACInit(EMAC0_BASE, ui32SysClkHz, EMAC_BCONFIG_MIXED_BURST | EMAC_BCONFIG_PRIORITY_FIXED, 4, 4, 0);

    I am using a DP83822 for 100FX support, but a lot of my registers were messed up on reset because the Tiva was holding the bootstrap lines on the PHY in an unknown state. I manually write all the regs to the DP83822 and everything appears to be setup correctly on my PHY. The issue is that the lwip examples and RMII examples dont seem to run.

    Are there any Tiva and RMII examples that are verified and tested with real hardware?

    -Joe
  • In reply to Joseph Orender:

    Hello Joe,

    I have used DP83822 with MII interface and the Boot Strap pins were not an issue. Did you make the changes that have been mentioned in the post earlier for lwiplib.c, port file and lwipopts.h which ought to be similar for RMII?

    Regards,

    Amit Ashara

  • In reply to Amit Ashara:

    I have made the changes mentioned in the earlier post. Like you, I have the DP83822 working with the Tiva with MII, but RMII seems to be what I and the original thread owner are seeking. Should we configure our PHYs in master or slave mode? Does the Tiva example software expect the 50MHz ref clk on the refclk pin? I am using RXD3 from the DP83822 to send that 50MHz signal.

    -Joe
  • In reply to Joseph Orender:

    Hello Joe,

    The MAC expects the 50MHz clock on the REFCLK pin and not the Software. I am not sure about the Master/Slave mode as I did never do any configuration and relied on the boot strap method to load the registers for most of the operation.

    I will need to rebuild the setup I had to test the RMII mode.

    Regards,

    Amit Ashara

  • In reply to Amit Ashara:

    Ok. Great. We have 30+ Tivas in our system with 30+ DP83822s and RMII is something that I think many are interested. A working RMII example would be great.

    -Joe
  • In reply to Joseph Orender:

    Hi Amit,

    Just to provide some additional information here, I was able to establish a link between the PHY and a switch.  I had to make one more change in the tiva-tm4c129.c file.  When i added the #if defined (EMAC_PHY_IS_EXT) on line 321 after the InitDMADescriptiors.  I also had to make sure that I don't execute the code for the PHY interrupts, so that portion of the code became:

    #if defined(EMAC_PHY_IS_EXT_MII) || defined(EMAC_PHY_IS_EXT_RMII)
      /* If PHY is external then reset the PHY before configuring it */
      EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_BMCR, EPHY_BMCR_MIIRESET);
    
      while((EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_BMCR) & EPHY_BMCR_MIIRESET) == EPHY_BMCR_MIIRESET);
    #else
      /* Clear any stray PHY interrupts that may be set. */
      ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1);
      ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR2);
    
      /* Configure and enable the link status change interrupt in the PHY. */
      ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_SCR);
      ui16Val |= (EPHY_SCR_INTEN_EXT | EPHY_SCR_INTOE_EXT);
      EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_SCR, ui16Val);
      EMACPHYWrite(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1, (EPHY_MISR1_LINKSTATEN |
                   EPHY_MISR1_SPEEDEN | EPHY_MISR1_DUPLEXMEN | EPHY_MISR1_ANCEN));
    
      /* Read the PHY interrupt status to clear any stray events. */
      ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1);
    #endif

    This is so because the Micrel PHY that we're using doesn't have register 0x12 as defined by EPHY_MISR1.  It's a reserved register in the Micrel PHY.  Once I did this, then I was able to establish a link.  However, I'm still not able to ping the device and I wonder if it has something to do with this or something along the line of interrupts.  Can you provide any guidance on this or should it just work if I'm able to establish a link?  If it should just work, then I'll look into the signals to see if we happen to cross the lines.

    Thanks!

  • In reply to SL:

    Hello SL

    Well that was not the case with DP83822 which we have been using. So yes, any custom changes needs to be done by the application developer.

    How is the interrupt connected from the PHY to the TM4C device, its polarity?

    Regards,

    Amit Ashara

  • In reply to Amit Ashara:

    Hi Amit,

    Yes, I figured there was something else with configuration that I was missing so that's why I started to dig a little deeper into the whole initialization process and found that, so no problem there. I understand that custom changes will have to be done.

    As for the interrupt, we actually don't connect the interrupt from the PHY to the TM4C device. We figure that the interrupt was mainly only used for waking up the uC if we used that option. But is this something that's required? We saw on the datasheet that the interrupt is optional. If we need this, then we can connect it.

    Thanks!

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.