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.

TMS570LC4357: Ethernet connection dont work because MDIOPhyAliveStatusGet() troubles

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN, LAUNCHXL2-570LC43

Hello guys, 

i would like tu use the EMAC of my board (TMS570LC4357). For this i am using the Lwip. The error occurs at this point.

if(!((MDIOPhyAliveStatusGet(hdkif->mdio_base) 
        >> hdkif->phy_addr) & 0x01 )) {
    return ERR_CONN;
  }

ERR_CONN means "not connected". I'm trying to send data to my RaspberryPi and have already connected them together.

What is the problem?

Thank you in advance

  • if you use the code generated from HALCoGen, please make sure the MDIO and MDCLK are selected in pinmux configuration. Checking MII or RMII won't select MDIO and MDCLK.

  • Thank you for reply. I am using the genereted code by Halcogen.and have already checked all these boxes. The problem seems to be somewhere else.

    Any other Ideas ? 

  • I'd be grateful for any help.

  • Hi Sory,

    Do you use TI LC43x EVM or your own board?

  • i'm using the TI LC43x EVM. See link below:

    www.ti.com/tool/LAUNCHXL2-570LC43

  • Thanks. One more question, do you use LWIP demo or Active Webserver demo? Did you modify the code generated by HAlCoGen or the code in demo (lwip or webserver)? I noticed the code you posted is not same as the code from HALCoGen:

    Your code:

    if(!((MDIOPhyAliveStatusGet(hdkif->mdio_base)
    >> hdkif->phy_addr) & 0x01 )) {
    return ERR_CONN;
    }

    HAL code:

    if((uint32)0U == ((MDIOPhyAliveStatusGet(hdkif->mdio_base)
    >> hdkif->phy_addr) & (uint32)0x01U )) {
    retVal = EMAC_ERR_CONNECT;
    } else {

    }

  • To use Launchpad for Ethernet communication, the following HALCoGen configuration should be addressed:

    a. Driver Enable Tab. Enable the GIO Driver:

        i. Check "Enable GIO Driver".

        ii. Confirm GIO, SCI1, and EMAC drivers are enabled.

    b. ECLK Tab. Provide a 25 MHz Clock to the PHY:

       i. In the ECLK Pin Mode Group, change the ECLK pin Mode to ECLK.

       ii. In the ECLK pin Group, make sure DIR is checked.

       iii. In the ECLK Functional Configuration group, change Divider to 3 so that ECPCLK is 25 MHz.

       iv. Also check the "Continue on suspend" button.

    c. PINMUX/Pin Muxing Tab. Change the MII and MDIO interface pins to their default locations:

       i. Make sure MII is checked in the Enable/Disable Peripherals Group at the top of the PINMUX. This is necessary to put the MAC in MII mode, even though it will also move the MII pins to their alternate location, which have to be undone manually.

       ii. Uncheck the MII and MDIO signals on Balls A14, B4, B11, D19, E18, F3, G3, G19, H18, H19, J18, J19, K19, N19, P1, R2 and V5. These rows should now be blank, although you can select non-Ethernet functions, if desired.

       iii. Change the selection on balls T4, U7 to the default functions (from MII_RX_AVCLK4 to MII_RXCLK, and from MII_TX_AVCLK4 to MII_TX_CLK). The PHY will provide these clocks to the MAC on the launchpad. NOTE: List Conflicts show total conflicts 2 for Ball T4 and U7 - just ignore this.

    d. PINMUX/Input Pin Muxing Tab. Change all of the input MII and MDIO signals to the Default (left Column) states:

    i. MDIO=F4, MII_COL=W4, MII_CRS=V4, MII_RX_DV=U6, MII_RX_ER=U5, MII_RXCLK=T4, MII_RXD[0]=U4, MII_RXD[1]=T3, MII_RXD[2]=U3, MII_RXD[3]=V3, MII_TX_CLK=U7

    e. GIO/Port A Tab. GIOA[3] and GIOA[4] need to be driven high, to release the PHY from reset and power down.

       i. Check the "DIR" box for Bit 3 and Bit 4.

       ii. Change DOUT to '1' for Bit 3 and Bit 4.

  • I am not using the LWIP demo-example. I am only using the Lwip libraries. to implement a costomed ethernet-kommunikation. I think it is structurally a bit  modified by  the devolpper, who maintained the code bevor, but not  with regard to contents . I tsuppose that my hardware may be defect, because i can debug the code until this posistion, where a register value is queried (I think).

    if(!((MDIOPhyAliveStatusGet(hdkif->mdio_base)
    >> hdkif->phy_addr) & 0x01 )) {
    return ERR_CONN;
    }

    and it always returns ERR_CONN,

    Where can i download the original Lwip-libraries, so i can test it again.

  • Hi Sory,

    Here is the link to download the lwip demo and active webserver demo:

    http://software-dl.ti.com/hercules/hercules_docs/latest/hercules/Examples/index.html

    Ethernet loopback example can also be used to check if your board works or not:

    TMS570LC4357HDK_EMAC_Loopback.zip

  • Thank you. For the Loopback_Example. Am i supposed to make change on the code. Because it happens nothing (Not even a print of the received data). 
    In terms of the LWIP-Demo, it is not ready for use?

  • The loopback example, and lwip demo should work without any code modification.

  • I have done these modifications and i seems like the problem below has disappeared:

    if(!((MDIOPhyAliveStatusGet(hdkif->mdio_base)
    >> hdkif->phy_addr) & 0x01 )) {
    return ERR_CONN;
    }

    I am facing know this problem:

    if(!Dp83640LinkStatusGet(hdkif->mdio_base, hdkif->phy_addr, 0xFFFF)) {
    return ERR_CONN;

    what does concretly effect and how can i resolve this problem?

  • Do you connect your board to ethernet switch when you run the lwip demo? Otherwise you will get linker failed issue. 

  • It works now. I followed these Instructions. Minimal lwIP Project for Hercules LaunchPad - Hackster.io

    i also make sure that the board was connected to the ethernet.

    Thank you

  • Hi Sory,

    Would you please share what causes the linker failure issue?