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.

sending data from DSP to PC rate problem

Other Parts Discussed in Thread: SYSBIOS

Hi

I want to send data from DSP to my PC. So I use client project in CCS and “recv.exe” in winaaps folder but in this project the rate of transferring is very low about 40Mbit instead of 1Gbit.

Do you know how can I raise this rate in this project?

 

  • I don't remember the solution for this issue if any. However I recommend you to search in e2e first. Thank you.
  • Hi,

    I think, you may not get exact 1Gb speed.

    Try to send the data at 200,400,800Mpbs speed.

    Try to increase the NDK buffers (PKT_NUM_FRAMEBUF) to 5x or 6x times in the following line.

    D:\<NDK dir>\packages\ti\ndk\stack\pbm\pbm_data.c

    Ex:

    D:\ndk_2_22_02_16\packages\ti\ndk\stack\pbm\pbm_data.c
  • How did you connect the ethernet cable between DSP to PC ?
    Please make sure that you are using Gigabit switch.
  • Hi one and zero

    I increase the buffer (PKT_NUM_FRAMEBUF) which you said to 960 instead of 192 and nothing changed. I changed that but I don't know how can I rebuild NDK. Can you help me? I visit  but can not make it yet

  • Hi Titusrathinaraj
    I use static IP mode for connecting DSP to PC.
    How can I sure that I am using Gigabit switch?
  • If you are connecting the DSP through switch then we need to check the switch rate, but you have connected DSP to PC, so we can ignore the switch speed (as NO switch used between DSP & PC)

    Can you please connect the DSP to PC through Gigabit swicth (not 10/100Mbps switch)

    For rebuilding the NDK, you need to modify the .bld and ndk.mak file for SYSBIOS and compiler location.
    processors.wiki.ti.com/.../Rebuilding_The_NDK_Core_Using_Gmake

    Please let me know if you are not able to build NDK package.

    I have tried to run pre-built NDK example and got ~800Mbps speed.
  • Hi Titusrathinaraj

    Finally I can build NDK with ndk.mak and bld and I changed the buffer but there is not any changes and rate is about 40Mbps.

    My PC has a Gigabit ethernet but I don't know what is your mean about Gigabit switch?

    Really I want to get about 800Mbps but I can't.

  • Which NDK winapp utility are you using ?
    Can you please increase the "BUFSIZE" size in the application and rebuild the winapps app and then try.
  • Hi Titusrathinaraj
    I am using recv.exe. When I increase "BUFSIZE" size in the "recv.c" the rate will be decreased.
    I increased rc to 16384 instead of 8192 in client project and rate increased a little to 20Mbps.

    // TCP Transmit buffer size
    rc = 16384;//8192
    CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPTXBUF,
    CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, 0 );

    I think I am using 10/100Mb ethernet instead of Gigabit. How can I be sure that I am using Gigabit Ethernet?
  • Can you give me your project which it has 800Mbps rate?
  • Yes, you can also increase the "rc" in NDK example.
    Can you please attach the log when you use "recv.exe" ?

    If you are using Gigbit ethernet port in your PC and connecting Ethernet cable directly to DSP, then no worries in Gigabit switch part.
    It is applicable when you connect the DSP to PC through external switch in DHCP mode.
  • I made a ramp function in DSP client project on ddr memory(256MByte) and want to send it to PC and log. My recv.c file is:

    recv1.c
    /*
     * recv.c
     *
     * Receive test utility
     *
     * Copyright (C) 1999 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    
    #include <stdio.h>
    #include <time.h>
    #include <stdlib.h>
    
    #include "sockets.h"
    
    #define BUFSIZE    46720//46720
    #define PORT       1000
    
    /*
     *  ======== main ========
     */
    int main(int argc, char *argv[])
    {
        SOCKET s;
        struct sockaddr_in sin;
        struct in_addr dst;
        unsigned short port = PORT;
        char *buf = NULL;
        int bufsize = BUFSIZE;
        char *name = argv[0];
        int i;
        int nr;
        int trial;
        int skipoutput;
        int update = 1;
        time_t ts;
        time_t tn;
        int status;
        int testsize;
        int bytes;
    
    	FILE* pFile;
    
    	printf("\n\tWelcome to NIKSOO Ethernet TCP/IP Project\n");
    	printf("\tYou can use this file for transfering data from DSP to PC\n");
    	printf("\tPlease be patient\n");
    	
    	
        if (argc < 2) {
            //fprintf(stderr, "Usage: %s ip-addr [update]\n", name);
            exit(EXIT_FAILURE);
        }
    
        if (!inet_pton(AF_INET, argv[1], &dst)) {
            //fprintf(stderr, "%s: invalid ip-addr (%s)\n", name, argv[1]);
            exit(EXIT_FAILURE);
        }
    
        if (argc > 2) {
            update = (int)strtol(argv[2], NULL, 0);
        }
    
        if (argc > 3) {
            port = (unsigned short)strtoul(argv[3], NULL, 0);
        }
    
        socketsStartup();
    
        status = EXIT_FAILURE;
    
        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0) {
            //fprintf(stderr, "%s: failed socket (%d)\n", name, getError());
            goto leave;
        }
    
        sin.sin_family = AF_INET;
        sin.sin_addr = dst;
        sin.sin_port = htons(port);
    
        if (connect(s, (const struct sockaddr *)&sin, sizeof(sin)) < 0) {
            //fprintf(stderr, "%s: failed connect (%d)\n", name, getError());
            goto leave;
        }
        buf = malloc(bufsize);
        if (!buf) {
            //fprintf(stderr, "%s: failed buffer allocation\n", name);
            goto leave;
        }
    
        testsize = bufsize;
        trial = 0;
        bytes = 0;
        skipoutput = update;
    
        ts = time(0);
    	
    	
    	
    	pFile= fopen("c:\\test.txt", "wb");
    	
        while (!kbhit()) {
            trial++;
            skipoutput--;
    
            /* Send the buffer */
            if (!skipoutput) {
                //printf("%d Requesting %d bytes ... ", trial, testsize);
            }
    
            *(int *)buf = testsize;
            if (send(s, buf, sizeof(int), 0) < 0) {
                //fprintf(stderr, "%s: send failed (%d)\n", name, getError());
                break;
            }
    
            /* Try and receive the test pattern */
            if (!skipoutput) {
                //printf("receive... ");
            }
    		
            for (i = 0; i < testsize; i += nr) {//
    			
    			
                nr = recv(s, buf + i, bufsize - i, 0);
    			fwrite (buf+i , sizeof(buf+i), 1000, pFile);
    			//fprintf(pFile,"%h\n",buf[i]);
                if (nr < 0) {
                    //fprintf(stderr, "%s: recv failed (%d)\n", name, getError());
                    break;
                }
                if (nr == 0) {
                    //fprintf(stderr, "%s: recv failed - no data\n", name);
                    break;
                }
            }
    
            /* Verify reception size */
            if (i != testsize) {
                //fprintf(stderr, "%s: received %d (not %d) bytes\n", name, i, testsize);
                break;
            }
    
            if ((bytes + testsize) < bytes) {
                ts = time(0);
                bytes = 0;
                skipoutput = update;
            } else {
                bytes += testsize;
    
                if (!skipoutput) {
                    tn = time(0) - ts;
                    if (tn) {
                        //printf("passed - %lu bytes/s\n", bytes / tn);
                    }
                    else {
                        //printf("passed\n");
                    }
                    skipoutput = update;
    				
                }
            }
        }
        fclose (pFile);
    	status = EXIT_SUCCESS;
    	
    
    leave:
        if (buf) {
            free(buf);
        }
    
        if (s >= 0) {
            (void)closesocket(s);
        }
    
        socketsShutdown();
    	printf("\n\tThanks for your attention\n\n\t\tArmin Nemati\n");
    	
        return (status);
    }
    

    The time for Sending 256MByte data from DSP to PC through Ethernet last about 150 second. 

    So Rate is 256MByte/150Sec=1.66MB/s~14Mbitps

  • Earlier I have used the HUA demo project code to measure the speed of packets.
    C:\ti\mcsdk_2_01_02_06\demos\hua\evmc6678l

    I've changed the rc to 64000.

    Right now I don't have code for that.

    I hope the following e2e post would help you.

    You can refer to this discussion.
    e2e.ti.com/.../271367
  • I have run the HUA demo code and got the below results on TCP packet transmit.

    I've not modified anything, I just simply run the code.

    Type the IP address of DSP into browser and you would get the option to do the Network benchmarks.
    Benchmarks -> Network Benchmarks -> I choose 100Mb, Transmit and TCP -> Execute

    [C66xx_0] Titus : start_val 479044 end_val 5448854
    Titus : After negotiation start_val 5466017 end_val 5466637
    Titus : Init SGMII done!
    QMSS successfully initialized
    CPPI successfully initialized
    PA successfully initialized
    HUA version 2.00.00.04
    Setting hostname to tidemo-084808
    MAC Address: 00-17-EA-CB-52-C0
    Configuring DHCP client
    PASS successfully initialized
    Ethernet subsystem successfully initialized
    Ethernet eventId : 48 and vectId (Interrupt) : 7
    Registration of the EMAC Successful, waiting for link up ..
    Service Status: DHCPC : Enabled : : 000
    Service Status: THTTP : Enabled : : 000
    Service Status: DHCPC : Enabled : Running : 000
    Network Added: If-1:10.100.1.36
    Service Status: DHCPC : Enabled : Running : 017

    TCP Throughput test : TX for 100000 packets of 1000 bytes
    TCP Transmit Task started
    Sending 100000 frames of 1000 bytes
    ------------------------------------------------
    Total Data transmitted: 100000000 bytes
    Start Time : 49905 msec
    End Time : 52575 msec
    Total Time expired : 2670 msec
    Transmit Throughput : 299 Mb/s
    Note: These numbers are as measured on the EVM and
    reflect how fast it was able to transmit the data.
    ------------------------------------------------
  • Hi Titusrathinaraj

    Finally I succeed to test HUA/Benchmark project and get the rate via HUA project but as I said before my rate is so low and I don't know why yet.

    QMSS successfully initialized
    CPPI successfully initialized
    PA successfully initialized
    HUA version 2.00.00.04
    Setting hostname to tidemo-102716
    MAC Address: 90-D7-EB-83-E5-5D
    EVM in StaticIP mode at 192.168.2.100
    Set IP address of PC to 192.168.2.101
    PASS successfully initialized
    Ethernet subsystem successfully initialized
    Ethernet eventId : 48 and vectId (Interrupt) : 7
    Registration of the EMAC Successful, waiting for link up ..
    Network Added: If-1:192.168.2.100
    Service Status: THTTP : Enabled : : 000

    UDP Throughput test : RX for 10000 packets of 1000 bytes
    UDP Receive Task started


    .....Failed to receive...please re run the test


    TCP Throughput test : TX for 10000 packets of 1000 bytes
    TCP Transmit Task started
    Sending 10000 frames of 1000 bytes
    ------------------------------------------------
    Total Data transmitted: 10000000 bytes
    Start Time : 270346 msec
    End Time : 302631 msec
    Total Time expired : 32285 msec
    Transmit Throughput : 2 Mb/s
    Note: These numbers are as measured on the EVM and
    reflect how fast it was able to transmit the data.
    ------------------------------------------------

    TCP Throughput test : TX for 100000 packets of 1000 bytes
    TCP Transmit Task started
    Sending 100000 frames of 1000 bytes
    ------------------------------------------------
    Total Data transmitted: 100000000 bytes
    Start Time : 394632 msec
    End Time : 428450 msec
    Total Time expired : 33818 msec
    Transmit Throughput : 23 Mb/s
    Note: These numbers are as measured on the EVM and
    reflect how fast it was able to transmit the data.
    ------------------------------------------------

  • Do you have any keystone EVM with you ?
    If yes, you can run the code on it to confirm whether this problem is due to HW setup or custom board.

    Have you referred this discussion and tried to change the code and any improvements ?
    e2e.ti.com/.../271367
  • Hi Titu

    My test was on EVM not custom board and rate was so low. In discussion which you said, rate from DSP to PC with Tx buffer size=64000 was ~100Mb/s

    while my rate is ~23Mb/s. Do you know what is difference? I got from that discussion that NIMU driver has som problem on 6678 but I can not undrestand what change I must do. I know I should replace CSL_cache functions with the analogous sysbios functions but I don't know what change exactly I should do on the codes. For example I don't know what code must be changed and what function must be changed and replace with what? I am almost beginner and want to reach rate up to 500Mb/s please help me.

  • Hi again
    With your help finally I can reach ~500Mb/s in HUA project.
    My another problem is data accuracy. I want to send a ramp data from DSP to PC and save it on PC. For this project I used client project in DSP and recv.exe in PC but when I run command "recv.exe 192.168.2.100" in windows command (cmd.exe), I reach very low rate(~20Mb/s) while with nimu driver changes I can reach ~500Mb/s in HUA project.
    Now my question is : Does client project use nimu driver or another driver? Why the change which I do has not effect on client project's rate?
  • I hope there is difference in testing setup but not NIMU driver.
    NIMU driver is the same for HUA and NDK examples.

    Try to change the recv.c file to improve the speed.

    This is the benchmark C code used in HUA demo.
    C:\ti\mcsdk_2_01_02_06\demos\hua\src\benchmark\ndkbenchmark.c
  • Unfortunately I have no idea about changing recv.c for increasing speed. However thank you for your information and good helps.