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.

RTOS/PROCESSOR-SDK-AM437X: EMAC example error

Part Number: PROCESSOR-SDK-AM437X


Tool/software: TI-RTOS

I use the pdkProjectCreate.bat to create a example project named EMAC_BasicExample_idkAM437x_armBiosExampleProject, It can not run properly(idkevm board , pdk_am437x_1_0_4,ccsv6.2).

It show this on the debug port:


EMAC loopback test application initialization
SetPhyMode:000001e1 Auto:1, FD10:64, HD10:32, FD100:256, HD100:128, FD1000:0 LPBK:0
main: emac_open sucess
the program stop at function emac_check_loopback_status(0) in codes:
    if (emac_check_loopback_status(0) !=1)
    {
        UART_printf("Link not in loopback state, return error\n");
        return -1;
    }
I debug into this function, find out that it entering an infinite loop in this code:
    while (linkStatus == 0) 
    {
        /* First read the BSR of the PHY */
        _ENETPHY_UserAccessRead((ENETPHY_Handle) &phyDev, ENETPHY_BSR, phy_addr, &val16);
        if(val16 & ENETPHY_LINK_STATUS)
        {
            linkStatus = 1;
        }
        app_delay(100);
        retries--;
    }
because val16 equal to 0 forever.
Please tell me where the problem is.
  • The RTOS team have been notified. They will respond here.
  • Hi,

    Do you use the GEL to initialize the IDKAM437x A9 core before loading the test application? Also if you can try with the latest P-SDK 4.3 release ( pdk_am437x_1_0_10)? All those examples were tested before releasing so I don't expect they failed. Let me know.

    Regards, Eric
  • OK,

    I had found what is wrong. It because that I have wrong PHY address. Now it work correctly.

  • Now I can run the EMAC_BasicExample_evmAM437x_armBiosExampleProject correctly. but it just only drive the ethernet port 1, While there are two ethernet ports.If I want to use port 2 to test, how should I change?

    the board is a little changed evmAM437x, pdk_am437x_1_0_4, CCSv6.2.

    In the function EMAC_DRV_ERR_E emac_open(uint32_t port_num, EMAC_OPEN_CONFIG_INFO_T *p_config), does the function argument port_num correspond to the MAC port?

    In program EMAC_BasicExample_evmAM437x_armBiosExampleProject, main_evmAM437x.c:

        if ((open_ret = emac_open(0, &open_cfg)) == EMAC_DRV_RESULT_OPEN_PORT_ERR)
        {
            UART_printf("main: emac_open failure: %d\n", open_ret);
        }
        else
            UART_printf("main: emac_open sucess\n");

    if I want to test MAC port 2, should I chang the emac_open(0, &open_cfg) to emac_open(1, &open_cfg)? But I find that it will return faulse if I do this.

    Therefore, I understand that this uint32_t port_num is a MAC peripheral with two PHY. am I right?

    now I try to change the code line "open_cfg.phy_addr = 0; " to "open_cfg.phy_addr = 1; " . the "1" is the PHY address of the second port' PHY chip. but in function mac_check_loopback_status(1), it show "link status: up",and  "Link not in loopback state“. This mean that the port 2 can not be init correctly with loop_back.

    So, I have to debug into the funciton emac_open(0, &open_cfg), and find out that the open_cfg.phy_addr seem to not be used, is it really?

    and meanwhile, there is a item in the structure EMAC_HwAttrs_V4 EMACInitCfg[1] :

        1,
        {
            {
                SOC_IPORT_REG,
                SOC_ISL1_REG,
                4U,
            },
            {
                SOC_IPORT_REG,
                SOC_ISL2_REG,
                1U,
            }
        }

    the 1 in the first line should change to 2.

    now, I can set the port 2 to be look_back.

    But I have another question. How do I set the two ports with different MAC addresses and send and receive data from the two different ports?

    zhuangbin

  • I had known the problem: it was a wrong phy_addr.