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.

Question about C6455 UDP

Dear Engineers:

       We have a question about C6455 UDP Communication,The  Phenomenon is:

       we use two pices of C6455 to communicate with each with UDP protocol,when one(DSPA) Calling "sendto" ,then the other(DSPB) Calling "recvfrom" ,DSPB cannot recevive data,and Hangup utill timeout.

      but the same code,if we use Network debugging assistant to  "sendto" DSPB,DSPB can communicate successefully , as the same way ,we use Network debugging assistant to   "recvfrom" DSPA,the communication is also OK.

    now,we want to know why ? do we have some place need to change?

   thanks very much!!!

  • Hi,

    Thanks for your post.

    Is it your TI provided code or your own custom code?

    I think, there is an app. report on the EMAC controller  software operation on c645x DSP as below:

    http://www.ti.com/lit/an/spraa90/spraa90.pdf

    Please refer section 7.4 in which you have C6455_emac_recv and C6455_emac_send examples  and would show how to communicate between two DSPs using the EMAC peripheral.

    Also, i would attach you the EMAC example code as zip file in which, you could find c6455_emac_send & c6455_emac_recv project files from the below directory:

    ~\c6455_emac-0.4-latest\c6455_emac_recv

    ~\c6455_emac-0.4-latest\c6455_emac_send

    Please find the attached project zip file for EMAC send and receive examples.

    The above test code would transfer data between two DSPs and you could find both sender part and receiver part sample code from the  above paths respectively.

    Also, there is C6455 CSL package available for download as below:

    http://www.ti.com/tool/sprc234

    http://www.ti.com/product/TMS320C6455/toolssoftware

    In addition to this, you could also refer c645x EMAC user guide as below, in which please refer sections 2.10 & 2.11 for packet receive & packet transmit operations:

    http://www.ti.com/lit/ug/spru975e/spru975e.pdf

    /cfs-file/__key/communityserver-discussions-components-files/791/2553.spraa90.zip

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • dear  Sivaraj Kuppuraj:

           Thanks for your reply and valuable informations very much!

           Is our own custom codes,as follows:

           the "recv "is the code  of recv side,the "send"is the code  of send side,now they connot communicate with each other,we hope you can help us to check,Is there ang prombles? ,Thanks very much!!!

           As You introduced "C6455_emac_recv "and "C6455_emac_send "examples  which show how to communicate between two DSPs using the EMAC peripheral.They Seemingly communicate based MAC level ,But we want to  communicate based IP level,So we really need you help,thanks very much!!!

    //EMAC初始化

    void myEmacInit(void)
    {
     Bool  emacEn;

        /* Unlock the control register */
        CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL,
                  UNLOCK);

        /* Enable the EMAC */
        CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_EMACCTL,
                  ENABLE);

        do {
            emacEn = (Bool) CSL_FEXT(((CSL_DevRegs*)CSL_DEV_REGS)->PERSTAT0,
                                       DEV_PERSTAT0_EMACSTAT);
        } while (emacEn != TRUE);

    }

    //网络接收程序
    void UDP_Recv()
    {
        struct sockaddr_in localAddr;
     struct sockaddr_in clientAddr;
     int sockAddrSize;

     int nNetRecvLen;

        // Allocate the file environment for this task
        fdOpenSession(TaskSelf());
       
        // Create the main TCP listen socket
        if(INVALID_SOCKET == (Sudp_srv = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)))
        {
         goto leave;
        }

        // Set Port = 10010, leaving IP address = Any
        sockAddrSize=sizeof(struct sockaddr_in);
        bzero((char *)&SClient, sockAddrSize);
        SClient.sin_len = (unsigned char)sockAddrSize;
        SClient.sin_addr.s_addr = inet_addr( "192.168.2.69" );
        SClient.sin_family = AF_INET;
        SClient.sin_port   = htons(10010);

        bzero((char *)&localAddr, sockAddrSize);
        localAddr.sin_len = (unsigned char)sockAddrSize;
        localAddr.sin_addr.s_addr = inet_addr( "192.168.2.68" );//htonl(INADDR_ANY);
        localAddr.sin_family = AF_INET;
        localAddr.sin_port   = htons(10011);

        // Bind socket
        if(bind(Sudp_srv, (PSA)&localAddr, sockAddrSize) < 0 )
        {
         goto leave;
        }

        nNetRecvLen = 0;
        while(1)
        {
            //接收UDP数据
         nNetRecvLen = recvfrom(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, (int *)(&sockAddrSize));

    //     nNetRecvLen = sendto(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, sockAddrSize);
         nNetRecvLen = 0;
        }
    leave:
        // We only get here on an error - close the sockets
        if( Sudp_srv != INVALID_SOCKET )
        {
           fdClose( Sudp_srv );
        }
        // This task is killed by the system - here, we block
        TaskBlock( TaskSelf() );
    }

    //网络接收程序
    void UDP_Recv()
    {
        struct sockaddr_in localAddr;
     struct sockaddr_in clientAddr;
     int sockAddrSize;

     int nNetRecvLen;

        // Allocate the file environment for this task
        fdOpenSession(TaskSelf());
       
        // Create the main TCP listen socket
        if(INVALID_SOCKET == (Sudp_srv = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)))
        {
         goto leave;
        }

        // Set Port = 10010, leaving IP address = Any
        sockAddrSize=sizeof(struct sockaddr_in);
        bzero((char *)&SClient, sockAddrSize);
        SClient.sin_len = (unsigned char)sockAddrSize;
        SClient.sin_addr.s_addr = inet_addr( "192.168.2.68" );
        SClient.sin_family = AF_INET;
        SClient.sin_port   = htons(10010);

        bzero((char *)&localAddr, sockAddrSize);
        localAddr.sin_len = (unsigned char)sockAddrSize;
        localAddr.sin_addr.s_addr = inet_addr( "192.168.2.69" );//htonl(INADDR_ANY);
        localAddr.sin_family = AF_INET;
        localAddr.sin_port   = htons(10011);

        // Bind socket
        if(bind(Sudp_srv, (PSA)&localAddr, sockAddrSize) < 0 )
        {
         goto leave;
        }

        nNetRecvLen = 0;
        while(1)
        {
            //接收UDP数据
    //     nNetRecvLen = recvfrom(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, (int *)(&sockAddrSize));

         nNetRecvLen = sendto(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, sockAddrSize);
         nNetRecvLen = 0;
        }
    leave:
        // We only get here on an error - close the sockets
        if( Sudp_srv != INVALID_SOCKET )
        {
           fdClose( Sudp_srv );
        }
        // This task is killed by the system - here, we block
        TaskBlock( TaskSelf() );
    }

         

    Thanks & regards,

    linglingzhan

        

  • Hi,

    Thanks for your update.

    Please modify the same "C6455_emac_recv "and "C6455_emac_send "example code shared for MAC level in my above post and change it accordingly to IP level by yourself.

    Thanks & regards,
    Sivaraj K
  • dear Sivaraj K:
    thanks for your Proposal ,but we really donnot know how to change it accordingly to IP level ,do you have some examples like this?
    Thanks very much!!Thanks & regards,lingling zhan
  • dear Sivaraj K:
    Thanks for your reply,but we have two questions:
    one:Can two C6455s transfer data use UDP with each other?,if can,which release of NDK should we use,now we use CCS5.2 as soft tool.
    two: As your suggestion ,but we really donnot know how to change it accordingly to IP level ,do you have some examples like this?
    Thanks very much!!

    Thanks & regards,
    lingling zhan
  • Hi,

    Thanks for your update.

    If you check the NDK download page, it is clearly mentioned in the note that, c6455 is a legacy older device and you will not find the ethernet driver package in the NDK, so it is recommended to check the device web page for NSP to get the ethernet driver package or you can download the ethernet driver from the NDK 2.00 full package. Please download NDK 2.00 from the below page:

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ndk/index.html

    and please check the c6455 device web page for NSP (Ethernet driver package) updates.

    Note: If you wish to obtain the driver for older devices (DM6437, C6747, OMAPL137, DM648, C6455, etc.) please check the device web page for NSP (Ethernet driver package) updates or download the driver from the NDK 2.00 full package.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • jie wang75279 said:

    ...

    void UDP_Recv()
    {
    ...
        localAddr.sin_addr.s_addr = inet_addr( "192.168.2.68" );//htonl(INADDR_ANY);
        localAddr.sin_family = AF_INET;
        localAddr.sin_port   = htons(10011);

    ...

        while(1)
        {
    ...
         nNetRecvLen = recvfrom(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, (int *)(&sockAddrSize));

    ...
        }
    ...
    }

    //网络接收程序
    void UDP_Recv()
    {
    ,,,
        SClient.sin_addr.s_addr = inet_addr( "192.168.2.68" );
        SClient.sin_family = AF_INET;
        SClient.sin_port   = htons(10010);

    ,,,

        while(1)
        {
    ,,,

         nNetRecvLen = sendto(Sudp_srv, (char *)uBuff, 512, 0, (PSA)&SClient, sockAddrSize);
    ,,,
        }
    ,,,
    }

    One thing to note is that you have two functions void UDP_Recv().  Assuming that is not your issue, the next thing you might want to look at is the ports you bind to.

    Your "sender" is sending to 10010.  Your "receiver" is bound to 10011.