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.

AM3359: API to extract/receive Ethernet/ip incoming frames

Part Number: AM3359

Hello there,

Components/SDKs/Stacks:

  • pdk_am335x_1_0_17
  • processor_sdk_rtos_am335x_6_03_00_106
  • PRU-ICSS-EthernetIP_Adapter_01.00.04.11

I have a simple ethernet\ip_adapter project that I got by following this user guide (https://software-dl.ti.com/processor-industrial-sw/esd/docs/indsw/ethernetIP_adapter/01_00_04/PRU_ICSS_EthernetIP.html) I can build and run the app on board (MLO and app using mcsd boot), I have my scanner running of on soft plc (codesys) and I can see the frames going back and forth on wireshark. I have been trying to find the callback/api to see incoming frames so that I can do something with the inputs but I have not find anything.

I know there is a function called "void EIP_processProtocolFrames(uint32_t *queue_number, void *userArg)" which was registered as callback during drv initialization but it only executes few times. It finds if it is a DLR frame, PTP frame or LLDP frame. this LLDP function further checks if it is indeed LLDP frame if not then send it to the TCP/IP stack but I don't see any function that take cares of tcp/ip part, that what I am interested in, how can I extract this frame. 

Regards,

  • Hi ,

    Thanks for your query.

    I will check on this internally and get back to you.

    Best Regards

    Ashwani

  • Hi Sumit,

    When a packet is received, based on QOS, the driver decides to either forward it to NDK (NRT callback) done by icssEmacHwIntRx or give it to the RT callback function.

    The decision to send which frame to which callback is configured in the main.c file. The variable ethPrioQueue is set to the queue priority above which a frame goes to the TCP/IP stack callback. For EtherNet/IP this is set to ICSS_EMAC_QUEUE3 which means Queue 3 and above goes to NDK (TCP/IP) stack. Any other queue goes to the RT callback. In your case any packet with Queue 3 or 4 will invoke the icssEmacHwIntRx API from the ICSS_EmacPollPkt function.

    The definition of the API to register the NRT receive packet callback function can be found under ICSS_EmacRegisterHwIntRx in {PDK_INSTALL_PATH}\packages\ti\drv\icss_emac\src\icss_emacDrv.c.

    For NIMU ICSS based applications, the NRT callback function is NIMU_ICSS_interruptRx, as programmed under NIMU_ICSS_open in {PDK_INSTALL_PATH}\packages\ti\transport\ndk\nimu_icss\src\nimu_icssEthDriver.c.

    Regards
    Archit Dev

  • Hello Archit,

    Thank you for your response, was able to capture the frame in NIMU_ICSS_interruptRx and I have been looking into the sending (Tx) side and found "NIMU_ICSS_sendPacket()" is being used to send packets out. But my question is all these interrupts/APIs are at low level (switch L2) which I don't have direct access too and manipulating the data/frame there is not good, is there any kind of APIs at application level that I can receive the data from scanner, do something with it and then send back to scanner. I am talking about EIPAPP_main(). I know there is a "Rx Task" that is created in main() to handle the receive packet,

    how do use this task at application level to extract frames? also, I don't see a similar task created for Tx frames, I know there is one "void ICSS_EMacOsTxTaskFnc(uint32_t a0, uint32_t a1);defined in icss_emacDrv.h but frames are still going out (I confirmed it on wireshark).

    Please guide. 

    Regards,

  • Hi Sumit,

    is there any kind of APIs at application level that I can receive the data from scanner, do something with it and then send back to scanner.

    Do you have any plan to integrate the Ethernet/IP stack? Typically this is be done by the stack via TCP or UDP sockets.

    also, I don't see a similar task created for Tx frames, I know there is one "void ICSS_EMacOsTxTaskFnc(uint32_t a0, uint32_t a1);defined in icss_emacDrv.h but frames are still going out (I confirmed it on wireshark).

    This is because in order to send packets from the Host, the following ICSS EMAC Driver API is used: "ICSS_EmacTxPacket". This API is used to queue a frame which has to be transmitted on the specified port queue.
    You can find the function definition at : {PDK_INSTALL_PATH}\packages\ti\drv\icss_emac\src\icss_emacDrv.c .

    Regards
    Archit Dev

  • Archit,

    I am new to the ethernet/ip so I am just trying to understand the relationship between "PRU_ICSS Ethernet/IP Adapter" and "Ethernet/IP stack", so here are my questions:

    when you say "integrate the Ethernet/ip stack"... isn't this PRU_ICSS ethernet/ip adapter carries the ethernet/ip stack in it? I think it has molex ethernet/ip stack (third party) which I don't have access to the source code, I think its just a library. Correct? if it is my question is in order to run full ethernet/ip communication, PRU_ICSS Ethernet/IP Adapter is not enough? 

    Also for sending frames, "ICSS_EmacTxPacket" queue the frames that has to be send out, but shouldn't there is a task for it in EIPAPP_main(), what I mean is can I control what I want to send and what I don't? I think it comes down again to the integration of eip stack?

    Thanks, 

    Sumit

  • Hi Sumit,

    when you say "integrate the Ethernet/ip stack"... isn't this PRU_ICSS ethernet/ip adapter carries the ethernet/ip stack in it? I think it has molex ethernet/ip stack (third party) which I don't have access to the source code, I think its just a library. Correct? if it is my question is in order to run full ethernet/ip communication, PRU_ICSS Ethernet/IP Adapter is not enough? 


    The example within the PRU-ICSS-ETHERNETIP-ADAPTER package is an EtherNet/IP adapter demo application based on TMG EtherNet/IP stack on top of NDK TCP/IP stack.
    The TMG Ethernet/IP stack sources are not public and the example uses the required stack libs from the location :
    [
    INSTALL-DIR]/third_party/protocols/ethernetip_adapter/stack_lib/[DEVICE]/[CORE].
    These stack libraries have a demo limitation of 1 hour.

    So, the Ethernet/IP application It is a limited demo application that is constrained so that a user will be allowed to execute it for one hour only.
    Therefore, for any stack related support, one will have to contact TMG.

    Also for sending frames, "ICSS_EmacTxPacket" queue the frames that has to be send out, but shouldn't there is a task for it in EIPAPP_main(), what I mean is can I control what I want to send and what I don't? I think it comes down again to the integration of eip stack?

    For this, you can try referring to the ICSS EMAC documentation in the PDK docs here : https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#icss-emac 

    But typically, the Stack puts the packet data in DDR and the host copies the data from DDR to the Tx Queue memory on L3 from where the PRU firmware picks up the data and puts it into the Tx FIFO. The MII picks it up and sends it on the wire afterwards.

    As explained in a previous response, in the Transmit path, the main API call is ICSS_EmacTxPacket, which in turn calls another API ICSS_EmacTxPacketEnqueue which performs the actual task of copying data from DDR to L3 and signals the PRU to transmit the data.

    So, depending on the type of packet, the stack may call the Tx API.

    Regards
    Archit Dev