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.

Am335x Ethernet application question

Hi ,

I want to use the two enet port at the same time without OS, and one's protocol  is for Modbus/TCP  master and slave,and the other is EthCAT master.

My question is  can the A8 support  the  two enet port rece/trans data meanwhile, now i'm  studying  the StartWare demo enetEcho  and found the two port use the same DMA interrupt  handler in SK.

if i miss something please point out kindly? and i will appreciate if you can give some advice on the issue, thanks for ahead.

  • Hi,

    Yes SK enetEcho example uses two enet ports.

    What is the issue faced in this case?

    Regards,

    Ramesh D

  • Hi,

    I'm new to enet and learning the enetEcho demo,and generated the IP normally. But i don't know how to process  the dataTrans/Rec clearly ?Yes,it use DMA ISR,i want to learn the trigger point. 

    Looking into the Lwip code and set breakpoint ,I found after run API:CPSWCPDMATxHdrDescPtrWrite() ,the code jump into the TxISR,then call the API: cpswif_tx_inthandler(0); [Question1: it should send the data here ,so I wonder how to monitor the data value  in CCS ? and the num why is zero ]and then CPSWCPDMAEndOfIntVectorWrite()[Question2:does this end of Tx interrupt? ] and cpswif_rxbd_alloc(cpswinst)[Question3: turn to handler the Rx ?? ]

    And about my appliacation, I'm puzzled at how the A8 handler the data when the two port receive data in the same time? Does it will overwrite occured? Maybe the root cause is i don't understand about the data Trans/Rec ,so now i learn the demo and have the question listed above.

    Any advice will be welcome,thanks!

     

    Regards,

    Stone

  • stone,

    Question1: it should send the data here ,so I wonder how to monitor the data value  in CCS ? and the num why is zero 

    Data is copied into the buffer provided to the buffer decriptors.

    Question2:does this end of Tx interrupt?

    Yes

    CPSW port0 is the host port. Ony port0 is interfaced with CPU. The data recieved by Port1 and Port2 is forwaded to Port0.

    Regards,

    Ramesh D

  • Hi Ramesh,

    Thanks for your reply.

    Run the StareWare Demo ,i capture four dhcp frames(discovery,offer,request and ack). and i wonder where the data value in frame were assigned befor send ? in other words, how to control the data value you wanted to send.

    In API: cpswif_transmit() found the send buffer pointer q->payload ,but i don't know where it was written by the data to this bufffer?

    Looking forward to hearing from you .

    Regards,

    Stone

  • Stone,

    Please refer src/core/dhcp.c in LWIP to help understand the dhcp processing.

    Regards,

    Ramesh D

  • Thanks a lot, I'll check it.

    And i wonder could you give me a simple example ,which is divorced  from the Lwip stack demonstrate the data trans/receive?Maybe it will be easy to learn the  send/rece mechanism.

     

    Regards,

    Stone

  • Stone,

    Such an use case is not demonstarted in StarterWare.

    Regards,

    Ramesh D

  • Hi Ramesh,

      In API cpswif_output(), there are some functions I don't understand , they are SYS_ARCH_DECL_PROTECT(lev), SYS_ARCH_PROTECT(lev) and   SYS_ARCH_UNPROTECT(lev). Could i comment them out directly?

    Regards,

    Stone

  • Stone,

    Current code base is not tested disabling this. Refer src/include/lwip/sys.h in LWIP stack for details on the same.

    To disable this modify in examples/(evmAM335x-evmskAM335x-beablebobe)/enet_lwip/lwipopts.h

    #define SYS_LIGHTWEIGHT_PROT            0

    Regards,

    Ramesh D

  • Hi Ramesh,

    I look into the Rx ISR and know that the received frame was processed directly  in the ISR calling API ethernet_input().

    yet i want to process the received frame int main program ,so  in the Rx ISR , i put the received frame to an global array such as array A.  and during the main program process , the Rx ISR will  happen again randomly caused  overwrite the array A ,so how to avoid the overwrite properly?

    In the Rx ISR ,received frame may be the port1 or port2 frame, i need to store the frame and supply them  to according process  function to analyze  them ,so if store one frame and then disable the Rx interrupt maybe not properly.   i dont know how to do it?

    Could you give me some advice, thanks.

    Regards,

    Stone

  • Stone,

    I assume you will need to setup a packet buffer inside your application. The ISR then writes there and signals an event to your app that a new packet has arrived. Size of the buffer and traffic speed decides how long you can wait with removing and processing the buffered packets. Just a simple approach.

    Welcome to driver development...

    regards,

  • Hi Frank,

    Thanks for your reply.

    Q1:

    In the Rx ISR ,the while((curr_bd->flags_pktlen & CPDMA_BUF_DESC_OWNER) != CPDMA_BUF_DESC_OWNER)instruction will execute untill the curr_bd is empty,so it will dispose several buffer frames in deno's mechanism.

    Due to my app process ability,I want to receive and move one buffer frame to my pachket buffer and then jump out from the ISR to my app,  so change the While to If , yet i don't know is there any harm?

    Q2:

    If started the enetecho demo without the cable ,i see cpswif_phylink_config() cannot work , look into reg: MDIOlink/active, found active bit is set but link is off,and then plug into the cable ,the port will not receive any data,yet the active and link bit are set together . l  wonder when and  how the link bit is set? Is it controlled by hardware only?

     

    Regards