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.

AM5748: sysbios EMAC driver issue:

Part Number: AM5748
Other Parts Discussed in Thread: SYSBIOS,

AM578 sysbios EMAC driver issue:

I am Venkateswara Reddy Embedded Developer in Lekhawireless Solution, Bangalore.

We are using SITARA(AM5748) for one of our new project. Using sysbios(not linux).
Need use RGMII.

Tried to use EMAC loopback example which was given int SDK((processor_sdk_rtos_am57xx_08_01_00_09)
While sending the sample packet, it crashing(emac_send api is crashing).

Please help me to resolve these issue.
Also please give me emac APIs details with code(emac_open, emac_send, emac_poll_pkt etc).

Thanks and regards,
S. Venkateswara Reddy

  • Hello Venkateswara,

    Nice to e-meet you. While I re-route your query to the correct domain expert, Could you help us by letting us know a few more details?

    • Does this happen on a custom board or a TI EVM?
    • Could you share error/crash logs?

    The API details are included within the SDK. Once the SDK is downloaded, navigate to the following directory and open the html file: API_Documentation.html

     /<SDK_INSTALL_DIRECTORY>/processor_sdk_rtos_am57xx_08_01_00_09/pdk_am57xx_1_0_19/packages$

    Use your preferred application: (I use Firefox)


    /<SDK_INSTALL_DIRECTORY>/processor_sdk_rtos_am57xx_08_01_00_09/pdk_am57xx_1_0_19/packages$ firefox file:API_Documentation.html

    You will find what you need under EMAC LLD-->EMAC LLD Functions.

    Best ,

    Josue

  • Hi Josue,

    I am using custom board. 

    Following are the console prints.

    [CortexA15_0] Board_init success
    EMAC loopback test application initialization
    main: emac_open sucess
    Link status: Up
    Link is in loopback state
    app_test_task_poll_pkt - entered
    app_test_task_send_pkts - entered
    calling - emac_send
    ti.sysbios.rts.gnu.ReentSupport: line 157: assertion failure: A_badThreadType: Cannot call a C runtime library API from a Hwi or Swi thread.
    xdc.runtime.Error.raise: terminating execution.

    Thanks and regards,

    S. Venkateswara Reddy

  • Hi Venkateshwara,

    Have you made any changes to the application for the custom board? Can you provide me with those changes.

    Regards,
    Tanmay

  • Hi Tanmay Patil,

    I have not modified any of the code. I have doubts in the following code

    The following two lines(app_test_task_send_pkts - function) are not correct I think. Can you please comment

    memcpy (p_pkt_desc->pDataBuffer, &test_pkt[0], TEST_PKT_SIZE); //Venkat - pDataBuffer is a pointer, how it is copy full packet??
    p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc; //AppPrivate - //Venkat - not clear explanation about this parameter

    For your information:

    rc = emac_send(port_num, p_pkt_desc); This API returns success(ie rc = 0) but after that if we call any function(Task_sleep or prinnt) it terminating the execution.

    void app_test_task_send_pkts(UArg arg0, UArg arg1)
    {
    uint32_t i;
    uint32_t port_num = 0;
    static uint32_t pkt_send_count =0;
    uint32_t fail_count = 0;
    EMAC_PKT_DESC_T *p_pkt_desc;
    EMAC_DRV_ERR_E rc;
    printf("app_test_task_send_pkts\r\n");
    while(linkStatus == 0)
    {
    Task_sleep(1000);
    }
    Task_sleep(1000);
    for (i = 0; i < PKT_SEND_COUNT; i++)
    {
    p_pkt_desc = app_alloc_pkt(0, TEST_PKT_SIZE);
    /* app_alloc_pkt can return NULL because of logic added test allocation failure when app_alloc_pkt is called from the driver to replenish
    packet descriptor during packet receive, just alloc again and it will pass */
    if (p_pkt_desc == NULL)
    {
    p_pkt_desc = app_alloc_pkt(0, TEST_PKT_SIZE);
    }
    memcpy (p_pkt_desc->pDataBuffer, &test_pkt[0], TEST_PKT_SIZE);
    p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc;
    p_pkt_desc->Flags = EMAC_PKT_FLAG_SOP | EMAC_PKT_FLAG_EOP;
    p_pkt_desc->ValidLen = TEST_PKT_SIZE;
    p_pkt_desc->DataOffset = 0;

    p_pkt_desc->PktLength = TEST_PKT_SIZE;
    p_pkt_desc->PktFrags = 1;
    p_pkt_desc->pNext = NULL;
    p_pkt_desc->pPrev = NULL;
    p_pkt_desc->PktChannel = 0;
    p_pkt_desc->PktLength = TEST_PKT_SIZE;

    printf("calling - emac_send\r\n");
    rc = emac_send(port_num, p_pkt_desc);
    abcd = 1;
    //Task_sleep(10);
    //printf("emac_send RC=%d\r\n",rc);

    fail_count = 0;
    while(pkt_received == 0)
    {
    Task_sleep(1000);
    fail_count++;
    if(fail_count == 5)
    {
    fail_count = 0;
    break;
    }
    }
    pkt_received = 0;
    pkt_send_count++;
    }

    }

  • Hi Venkateshwara,

    memcpy (p_pkt_desc->pDataBuffer, &test_pkt[0], TEST_PKT_SIZE); //Venkat - pDataBuffer is a pointer, how it is copy full packet?

    the defination of memcpy is : 

    &test_pkt[0] points to the start of the test_pkt array. the same array is copied to the pDataBuffer. memcpy does word-by-word copy and does not simply assign the address of test_pkt[0] to pDataBuffer.

    A buffer is allocated to pDataBuffer while initializing the free packet queue. The packet data from test_pkt is then copied word-by-word to this buffer.

    p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc; //AppPrivate - //Venkat - not clear explanation about this parameter

    The "AppPrivate" is a way to manage the packet in queue.

    These examples have been tested on AM57 IDK and no issues were found during validation.

    Can you confirm that you are on SDK 8.1.0.9. I am seeing some differences in code on my end than what you have pasted.

    Regards,
    Tanmay

  • Hi Tanmay,

    Thanks for your prompt reply.

    Yes I am using same SDK(processor_sdk_rtos_am57xx_08_01_00_09-windows-x64-installer.tar).

    I ran the following batch file to create the project

    command: pdkProjectCreate.bat AM574x all little emac all arm

    It was created the following projects:

    EMAC_BasicExample_idkAM574x_armBiosExampleProject
    ICSS_EMAC_BasicExamplePoll_idkAM574x_wSoCLib_armTestproject
    ICSS_EMAC_BasicExample_idkAM574x_wSoCFile_armTestproject
    ICSS_EMAC_BasicExample_idkAM574x_wSoCLib_armTestproject
    ICSS_EMAC_StpSwitchExample_idkAM574x_wSoCFile_armTestproject
    ICSS_EMAC_StpSwitchExample_idkAM574x_wSoCLib_armTestproject
    ICSS_EMAC_SwitchExample_idkAM574x_wSoCFile_armTestproject
    ICSS_EMAC_SwitchExample_idkAM574x_wSoCLib_armTestproject

    I am using EMAC_BasicExample_idkAM574x_armBiosExampleProject. Is it right??

    Thanks and regards,
    S. Venkateswara Reddy

  • Hi Venkateshwara,

    This seems to be correct.

    I do not have a setup to try this out on my end. I will try to validate this.

    But can my concern was that the SDK I have on my end and the code you pasted seem to be different. Can you comment on this.

    Regards,
    Tanmay

  • Hi Tanmay,

    Generated example code - EMAC_BasicExample_idkAM574x_armBiosExampleProject as it is I have used.

    Not modified any code, some places prints only I have added.  

    Is it possible to send your working code to me. I can check and verify it.

    Thanks and regards,

    S. Venkateswara Reddy

  • Hi Tanmay,

    Can you please share your working code. I can test in my setup.

    Thanks and regards,

    S. Venkateswara Reddy

  • Hi Venkateshwara,

    Sorry for the delay.

    I currently do not have access to a AM57 hardware as I am working from home. I will try to get the EMAC_BasicExample_idkAM574x_armBiosExampleProject working on my colleague's board and share the steps I took as well as the binary I generated with you by end of this week.

    Regards,
    Tanmay

  • Hi Tanmay,

    Good morning. 

    Any update?. Please share me if you have any working code.

    Thanks and regards,

    S. Venkateswara Reddy

  • Hi Tanmay,

    EMAC loop back test is working in EMV572x (EMAC_BasicExample_evmAM572x_armBiosExampleProject) working fine.

    It is not working(ie. crashing) in custom board AM5748 (EMAC_BasicExample_idkAM574x_armBiosExampleProject).

    It seems to be the following xbar configuration is not working in idkAM574x.
    CSL_xbarMpuIrqConfigure(CSL_XBAR_INST_MPU_IRQ_92, CSL_XBAR_GMAC_SW_IRQ_RX_PULSE);
    CSL_xbarMpuIrqConfigure(CSL_XBAR_INST_MPU_IRQ_93, CSL_XBAR_GMAC_SW_IRQ_TX_PULSE);
    If I commented these lines, it is sending sample ethernet packets, but not receiving packets, to receive the packets above two interrupts must be work.

    Finally my doubt is CSL_xbarMpuIrqConfigure is not working in idkAM574x.

    Any suggestions??

    Thanks and regards,

    S. Venkateswara Reddy

  • Unlocking the thread for further communication on the thread.

    Regards

    Karan

  • Hi,

    Sorry for the delay here.

    Is this issue still observed?

    Regards,
    Tanmay