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.

RE: Ethernet setup for Hercules TMS570LC4357

Other Parts Discussed in Thread: TMS570LC4357, HALCOGENHi Anthony,

I am also facing issues when I try to use the EMAC on the TMS570LC4357.
For information, I am using HalCoGen v04.05.02 and Code Composer Studio v6.0.1.
I have made a configuration in HalCoGen which follows exactly the steps given by TI for EMAC and MDIO configurations.
I have found these details in the section "Configuring EMAC and MDIO using HALCoGen GUI" "For TMS570LC43x and RM57x devices" in the webpage "processors.wiki.ti.com/.../HALCoGen_Ethernet_Driver_and_lwIP_Integration_Demonstration".
You can find below these different steps:

1.Under the ‘Driver Enable’ tab, enable EMAC Driver and SCI1 Driver.
2.Under ‘VIM RAM’ add the names of the ISRs for EMAC Transmit and Receive Interrupts (Channels 77 and 79 respectively).
3.Enable these interrupts under the ‘VIM Channel 64-95’ tab.
4.Under the ‘PLL’ tab, change the multiplier for both PLLs to a value of 150, such that the output frequency in both cases is 300.00 MHz.
5.Under the ‘GCM’ tab, change the value of the VCLK1, VCLK2 and VCLK3 Dividers to 1 and VCLKA4 Divider to 2, such that the output of VCLKA4_DIV is 37.50 MHz.
6.Under the ‘PINMUX’ tab, enable RMII/MII, under Pin Muxing. Under Input Muxing, enable MDIO(G3), MII_COL(F3), MII_CRS(B4), MII_RX_DV(B11), MII_RX_ER(N19), MII_RXCLK(K19), MII_RXD[0], MII_RXD[1], MII_RXD[2], MII_RXD[3], MII_TX_CLK.
7.Under the ‘EMAC’ tab, change the EMAC address to the correct address (the default one in the example is mentioned above). The physical address is 1 by default.
8.Generate the system initialization and HAL Code.

I am trying to run a very simple test to check the behavior of the EMAC for the TMS570LC43x. For this, I have used the help section of HalCoGen and I have chosen the example test "example_EMAC_Loopback_TxRx". I have used the "HL_sys_main.c" provided in this example.

When I launch the debug mode, I remain stuck in the following loop which is in the source file "HL_mdio.c".

"while((HWREG(baseAddr + MDIO_USERACCESS0) & MDIO_USERACCESS0_GO) == MDIO_USERACCESS0_GO)
{
} /* Wait */
"

I have also tried to add a delay before calling MDIOInit() as you suggested for Basavanagouda issue, but it doesn't solve my issue.

As for the switch S2 on the TMS570LC4357, I have checked it and it's okay, the Ethernet is ON while the three other ones are OFF.
Would you have some idea about what I have done wrong in this configuration ?

Thanks in advance.
Best Regards
Adrien
  • Adrien,

    If you are stuck here:

    while((HWREG(baseAddr + MDIO_USERACCESS0) & MDIO_USERACCESS0_GO) == MDIO_USERACCESS0_GO)
    {
    } /* Wait */

    You are not getting very far at all. The MDIO bus is something similar in nature to an I2C bus for accessing the phy internal registers.

    What board are you using? The instructions you quoted are for one of our specific development kits.

    The device you are using has two locations for the ethernet related pins and you have to set them to match the board you are using.

    Even with our kits - on our HDK we used the location in pinmux for compatibility w. the LS3137 pinout.
    And for the Launchpad - we used the new dedicated pinmux option for ethernet. So blindly following the pinmux instructions above won't be safe .. you have to match the instructions to the board and to which balls the phy is connected to.

    Other than that you need to have a pullup resistor on the MDIO data line ...

    And the delay was a delay required by the PHY on power up...

    Last - if you change the phy you may need to make changes to the HalCoGen example code.
  • Hi Adrien,

    Because you mentioned the s2 ethernet switch, I assume, that you have HDK card - so the setup process should be ok.

    Could you check the value of baseAddr variable please?

    "while((HWREG(baseAddr + MDIO_USERACCESS0) & MDIO_USERACCESS0_GO) == MDIO_USERACCESS0_GO)
    {
    } /* Wait */

    Best Regards: Szilárd

  • Hi Anthony,

    Thanks for your reply.

    I am using the HDK with TMS570LC4357 and PHYdp83640. You are saying that even with HDK there is a problem of compatibility with LC4357 pinout ?

    Best Regards,

    Adrien

  • Hi Szilárd,

    Thank you very much for your answer.
    You are right, I am using the HDK card with TMS570LC4357.

    When I remain stuck in this loop in debug mode, the hexadecimal value of "baseAddr" is "0xFCF78900".
    Have you already faced this problem before ?

    Best Regards,
    Adrien
  • Adrien,

    No I'm saying that the instructions are different depending on which board you have. (HDK v.s. LaunchPad have different pin multiplexing options).

    If you are on the HDK make sure you have the ETHERNET_ON (the bottom switch on dip switch S2 in the lower left corner of the board (near blue CAN connector) flipped ON. Otherwise I think the phy isn't connected to the MCU ...
  • BTW the link you sent w. pinmux instructions is correct for the HDK. We have some alternate instructions posted for the TMS570LC4357 launchpad. I wanted to make sure you were using the correct instructions for your board. Both work for their respective board... but you have to match the pinmux to which pins the board uses to wire up to the phy.. so you cannot use HDK instructions w. LaunchPad or vice-versa.

    If it's HDK then most likely the issue is the ETHERNET_ON switch...
  • Ok I missed the S2 note at the bottom.

    I've run this example before on the HDKs without issue ...  so not sure where the issue would be.  

    Make sure you *did not* apply the RMII mode patch that is mentioned on that page.  That patch is only for CNCD boards.

    Now I'd suggest double checking the pin muxing again,  especially the 'Input Muxing' part is easy to miss.

    You also need to allow for time between power on reset and starting to talk to the PHY in MDIO mode.  The example may not have this delay built in if you just run from a power on reset.  If you are using CCS in debug mode though you wouldn't be seeing this problem.

    You can easily manually check the MDIO port by opening the Register view in CCS, see below.

    Just put your phy address, register address, read or write in the appropriate fields, then when configured set 'Go' and the transfer will happen.

    You can check on the oscilloscope what is happening on the MDIO and MDC pins to see if it looks correct..

    One other thing that could be wrong... the PHY address on the MDIO bus is set by straps (pins that are pulled up/down).  I think on this board a few of the strap pins have a pull in one direction on the MCU and opposite direction on the phy.  So maybe on your particular board the phy address is different..

    You can try the different addresses and see if the phy is responding on a different one than the example uses.

    Then there would be ways through software to make this more robust (set the straps using GIO mode, then reset the phy for example..)

    -anthony

  • Hi Adrien,

    The baseaddr is good. Meanwhile Anthony write down everything about the topic.
    When i tried lwip demo, it worked - so please double check your settings: pinmux (mainly for mdio pins), clocking, and the phy address, but as I remember
    (maybe i am wrong) the lwip demo start searching for phy circuit on mdio bus.

    If you want to check your hardware, there is a preconfigured demo project for freertos+tcp.

    Regards Szilárd