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.

Compiler/66AK2G12: NDK Recceive Problem in TCP socket programming program

Part Number: 66AK2G12
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: TI C/C++ Compiler

Hi,

EVM: K2GEVM.

Tool: CCS v9.2.

SDK: - ti-processor-sdk-rtos-k2g-evm-06.00.00.07-Windows-x86-Install

I am using TCP/IP socket programming server/client for transferring data from a EVMK2G board to EVMK2G board. I can able to send/recv 1024 bytes of data at a time when two boards are connected. when I tried to send more than 1024 packets it is not working may I know what will be the reason and what procedure is needed to send 6500 and above bytes of data.

Tcp.transmitBufSize = 16384;
Tcp.receiveBufSize = 65536;
Tcp.receiveBufLimit = 65536;
Global.pktNumFrameBufs=384;

Tcp.maxNumReasmPkts = 2;

the above size of configured in the .cfg file.

thanks & Regards,

Selvamuthukumaran. G

  • Hi,

    Can you explain what the example you used for this test? Is it a TI NIMU example or one you wrote? I don't see particular reason the program stopped at 1024 bytes, but it is possible that it break at 1500 bytes due to the MTU size.

    I would suggest you try a K2G EVM with a PC to determine at what packet size it break? Tx/Rx of 6500 bytes needs jumbo packet supports. Before enabling that, I want to make sure regular 1500 bytes TCP/IP working as expected.

    Regards, Eric  

  • Hi Eric,

    Im replyig on behalf of selva.

    Actually we coudn't find TI NIMU example code for TCP, but there was a FTP example NIMU_FtpExample_evmK2G_armExampleproject. By refereing this project we wrote TCP server and client.

    When we send 1350 bytes of a packet from the client, it received properly as a single packet in server and we could able to send more packets continuosly from client and the same is received in server without any issue.

    But when we send 1355 bytes of data from client, it gets splitted and received as two packets in server and further no packets are received in server when we try to send more packets from client.

    We even tried K2G EVM with a linux machine and K2G EVM as server and linux machine as client. Here also we observed same behaviour i.e there is no issue with packet size less than 1350 but we are facing issue when we send packet size of 1355.

    Please help us to solve this issue ASAP.

    Thanks 

  • Hi,

    Thanks! So you wrote your own TCP/IP socket program based on the NIMU FTP example for K2G. I recall that FTP example used 1500 bytes packet size for transfer so I don't see any restriction on 1350 bytes.

    Please see http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_Foundational_Components.html#ndk 4.10.2.5.1.2. NDK Example Description

    There are TCP/IP server example on other processors (called client program on C665x, C667x and AM57x), the source code is available under the K2G installation \pdk_k2g_1_0_ xx\packages\ti\transport\ndk\nimu\example\client\src as well. Are you able to port this code to K2G and see the same issue?

    Regards, Eric 

     

  • Thanks Eric.

    I looked the code in the path you have mentioned. In the client code of function NIMU_testNetworkOpen, they are calling variuos daemon services for tcp and udp. But i couldn't find the function definition for dtask_tcp_echo.

    Is there any working example CCS project for TCP ? can you please share it with us.

    The FTP example project should work for packet size greater than 1500 also , right?

  • Hi,

    1) "Is there any working example CCS project for TCP ? can you please share it with us."=====>Have you looked through the http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index.html then http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_overview.html#building-the-sdk then section 

    1.4.5.1.4. PDK Example and Test Project Creation

     The CCS project is created with batch command.

    2)"But i couldn't find the function definition for dtask_tcp_echo."========> This is implemented inside NDK: packages\ti\ndk\tools\servers\newservers.c

    3) "The FTP example project should work for packet size greater than 1500 also , right?"==========>No, I don't think so. Please make sure the program worked for the regular 1500 bytes packets first. Then you need to enable the jumbo packet support, one example on C6678 is discussed here: https://processors.wiki.ti.com/index.php/Enabling_Jumbo_Packet_Support_for_C6678

    Regards, Eric

  • Hi Eric,

    Thanks for your response but it didn't resolve our issue.

    We are facing multiple compilation issue while porting especially from nimu_cppi_qmss_iface.c file. As we are already running out of time, can you please help us with TCP example specific to K2G device?

    Do we have to raise any special service request ticket for this?

    Even though we faced multiple errors while porting client.c completely , we tried creating TCP socket using DaemonNew as in client.c (as FTP example didn't use DaemonNew for socket creation). But this time also no luck, the same 1350 bytes of packets only we are receiving using recvnc function and if we send 1400 bytes of packet from client, we are not able to receive that packet using  recvnc function, it always returns with -1 as no. of bytes received.

  • Hi,

    I don't understand why you need to add nimu_cppi_qmss_iface.c into the project, this is for another SOC architecture. What you need to do:

    c:\ti\pdk_k2g_1_0_15\packages>pdkProjectCreate.bat K2G all little nimu all arm
    =========================================================================
    Configuration:
    SOC : K2G
    BOARD : all
    ENDIAN : little
    MODULE : nimu
    PROJECT_TYPE : all
    PROCESSOR : arm
    PDK_SHORT_NAME : c:\ti\PDK_K2~3\packages\
    =========================================================================
    Checking Configuration...

    You will see a lots of CCS project created, including the NIMU_BasicExample_evmK2G_armExampleproject. Importing into CCS and build it,

    **** Build of configuration Debug for project NIMU_BasicExample_evmK2G_armExampleproject ****

    "C:\\ti\\ccs_9_0_1\\ccs\\utils\\bin\\gmake" -k -j 8 all -O

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/k2g/armv7/bios/helloWorld.cfg"
    Invoking: XDCtools
    "C:/ti/xdctools_3_55_02_22_core/xs" --xdcpath="C:/ti/bios_6_76_02_02/packages;C:/ti/pdk_k2g_1_0_15/packages;C:/ti/edma3_lld_2_12_05_30D/packages;C:/ti/ipc_3_50_04_07/packages;C:/ti/ndk_3_61_01_01/packages;C:/ti/uia_2_30_01_02/packages;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A15F -p ti.platforms.evmTCI66AK2G02 -r debug -c "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32" "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/k2g/armv7/bios/helloWorld.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring helloWorld.xa15fg from package/cfg/helloWorld_pa15fg.cfg ...
    SoC Type is k2g
    SoC Type is k2g
    generating custom ti.sysbios library makefile ...
    Linking with library ti.transport.ndk.nimu:./lib/k2g/a15/release/ti.transport.ndk.nimu.aa15fg
    Linking with library ti.drv.emac:./lib/k2g/a15/release/ti.drv.emac.aa15fg
    Linking with library ti.board:./lib/evmK2G/a15/release/ti.board.aa15fg
    Linking with library ti.drv.uart:./lib/k2g/a15/release/ti.drv.uart.aa15fg
    Linking with library ti.drv.i2c:./lib/k2g/a15/release/ti.drv.i2c.aa15fg
    Linking with library ti.osal:./lib/tirtos/k2g/a15/release/ti.osal.aa15fg
    Linking with library ti.drv.rm:./lib/armv7/ti.drv.rm.aa15fg
    Linking with library ti.drv.qmss:./lib/armv7/ti.drv.qmss.aa15fg
    Linking with library ti.drv.cppi:./lib/armv7/ti.drv.cppi.aa15fg
    Linking with library ti.utils.profiling:./lib/a15/release/ti.utils.profiling.aa15fg
    Linking with library ti.csl:./lib/k2g/a15/release/ti.csl.aa15fg
    Starting build of library sources ...
    making C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/k2g/armv7/bios/src/sysbios/sysbios.aa15fg ...
    Build of libraries done.
    cla15fg package/cfg/helloWorld_pa15fg.c ...
    In file included from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/netmain.h:39,
    from package/cfg/helloWorld_pa15fg.c:3966:
    C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\time.h:28,
    from package/cfg/helloWorld_pa15fg.c:3926:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    package/cfg/helloWorld_pa15fg.c: In function 'ti_ndk_config_Global_stackThread':
    package/cfg/helloWorld_pa15fg.c:3983:9: warning: unused variable 'rc' [-Wunused-variable]
    int rc;
    ^~
    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/k2g/armv7/bios/helloWorld.cfg"

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi/device/k2g/src/cppi_device.c"
    Invoking: GNU Compiler
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -I"C:/ti/pdk_k2g_1_0_15/packages/MyExampleProjects/NIMU_BasicExample_evmK2G_armExampleproject" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include/newlib-nano" -I"C:/ti/pdk_k2g_1_0_15/packages" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"cppi_device.d" -MT"cppi_device.o" @"configPkg/compiler.opt" -o"cppi_device.o" "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi/device/k2g/src/cppi_device.c"
    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi/device/k2g/src/cppi_device.c"

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss/device/k2g/src/qmss_device.c"
    Invoking: GNU Compiler
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -I"C:/ti/pdk_k2g_1_0_15/packages/MyExampleProjects/NIMU_BasicExample_evmK2G_armExampleproject" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include/newlib-nano" -I"C:/ti/pdk_k2g_1_0_15/packages" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"qmss_device.d" -MT"qmss_device.o" @"configPkg/compiler.opt" -o"qmss_device.o" "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss/device/k2g/src/qmss_device.c"
    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss/device/k2g/src/qmss_device.c"

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c"
    Invoking: GNU Compiler
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -I"C:/ti/pdk_k2g_1_0_15/packages/MyExampleProjects/NIMU_BasicExample_evmK2G_armExampleproject" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include/newlib-nano" -I"C:/ti/pdk_k2g_1_0_15/packages" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"udpHello.d" -MT"udpHello.o" @"configPkg/compiler.opt" -o"udpHello.o" "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c"
    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\endian.h:6:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:67,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\time.h:43,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socketndk.h:48,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socket.h:43,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/netmain.h:39,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c:40:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\_endian.h:31:0: warning: "_LITTLE_ENDIAN" redefined
    #define _LITTLE_ENDIAN 1234

    <command-line>:0:0: note: this is the location of the previous definition
    In file included from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/netmain.h:39,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c:40:
    C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\time.h:43,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socketndk.h:48,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socket.h:43,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/netmain.h:39,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c:40:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/udpHello.c"

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/nimu_osal.c"
    Invoking: GNU Compiler
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -I"C:/ti/pdk_k2g_1_0_15/packages/MyExampleProjects/NIMU_BasicExample_evmK2G_armExampleproject" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include/newlib-nano" -I"C:/ti/pdk_k2g_1_0_15/packages" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"nimu_osal.d" -MT"nimu_osal.o" @"configPkg/compiler.opt" -o"nimu_osal.o" "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/nimu_osal.c"
    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\endian.h:6:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:67,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\stdio.h:61,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/nimu_osal.c:42:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\_endian.h:31:0: warning: "_LITTLE_ENDIAN" redefined
    #define _LITTLE_ENDIAN 1234

    <command-line>:0:0: note: this is the location of the previous definition
    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/nimu_osal.c"

    Building file: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c"
    Invoking: GNU Compiler
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -I"C:/ti/pdk_k2g_1_0_15/packages/MyExampleProjects/NIMU_BasicExample_evmK2G_armExampleproject" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include/newlib-nano" -I"C:/ti/pdk_k2g_1_0_15/packages" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/cppi" -I"C:/ti/pdk_k2g_1_0_15/packages/ti/drv/qmss" -I"C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -c -MMD -MP -MMD -MP -MF"helloWorld_k2g.d" -MT"helloWorld_k2g.o" @"configPkg/compiler.opt" -o"helloWorld_k2g.o" "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c"
    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\endian.h:6:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:67,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\stdio.h:61,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:49:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\machine\_endian.h:31:0: warning: "_LITTLE_ENDIAN" redefined
    #define _LITTLE_ENDIAN 1234

    <command-line>:0:0: note: this is the location of the previous definition
    In file included from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/netmain.h:39,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:89:
    C:/ti/ndk_3_61_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\stdio.h:61,
    from C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:49:
    c:\ti\bios_6_76_02_02\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c: In function 'NetworkIPAddr':
    C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:466:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
    printf("If-%d:%d.%d.%d.%d\n", IfIdx,
    ~^
    %ld
    C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c: In function 'ServiceReport':
    C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:485:51: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
    printf( "Service Status: %-9s: %-9s: %-9s: %03d\n",
    ~~~^
    %03ld
    C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c:487:36:
    ReportStr[Report/256], Report&0xFF );
    ~~~~~~~~~~~
    Finished building: "C:/ti/pdk_k2g_1_0_15/packages/ti/transport/ndk/nimu/example/helloWorld/src/helloWorld_k2g.c"

    Building target: "NIMU_BasicExample_evmK2G_armExampleproject.out"
    Invoking: GNU Linker
    "C:/ti/ccs_9_0_1/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a15 -marm -Dk2g02 -Darm0 -DUSE_BIOS -DSOC_K2G -DDEVICE_K2G -DNSS_LITE -DevmK2G -D_LITTLE_ENDIAN=1 -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -mfloat-abi=hard -Wl,-Map,"NIMU_BasicExample_evmK2G_armExampleproject.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_76_02_02/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -L"C:/ti/ndk_3_61_01_01/packages/ti/ndk/os/lib" -Wl,--defsym,ARM_CORE=1 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"NIMU_BasicExample_evmK2G_armExampleproject.out" "./cppi_device.o" "./helloWorld_k2g.o" "./nimu_osal.o" "./qmss_device.o" "./udpHello.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lrdimon -lgcc -lm -lnosys -l:os.aa15fg -lc -Wl,--end-group
    Finished building target: "NIMU_BasicExample_evmK2G_armExampleproject.out"

    Using this, you can test a simple ping with different packet size, I saw that 1404 bytes worked and 1405 bytes failed. Similarly, I created CCS project for C66x, I find 1500 bytes worked. So, what is the different between ARM core and DSP core, I looked at the packages\ti\transport\ndk\nimu\src\v5\nimu_eth.c,

    I found following: 

    open_cfg.hwAttrs = (void*)&emac_cfg;
    open_cfg.phy_addr = emac_cfg.phyAddr;
    open_cfg.alloc_pkt_cb = nimu_alloc_pkt;
    open_cfg.free_pkt_cb = nimu_free_pkt;
    open_cfg.rx_pkt_cb = nimu_rx_pkt_cb;
    open_cfg.loop_back = 0;
    open_cfg.master_core_flag = 1;
    #ifdef _TMS320C6X
    open_cfg.max_pkt_size = 1514;
    #else
    open_cfg.max_pkt_size = 1408; /* current limitation due to NDK PBM buffer size for A15*/
    #endif
    open_cfg.mdio_flag = 1;
    open_cfg.num_of_chans = 1;
    open_cfg.num_of_rx_pkt_desc = 64;
    open_cfg.num_of_tx_pkt_desc = 64;

    So, for you:

    1) change this size from 1408 to 1514 for A15 core, and rebuilt the NIMU library, then rebuild you application, to see if ping of 1500 bytes worked.

    2) If 1) didn't work, then figure out how to change NDK PBM buffer, e.g. https://e2e.ti.com/support/processors/f/791/t/275946?NDK-Global-Buffer-Configuration

    3) porting the TCP/IP stack to make sure 1500 bytes work

    4) enable jumbo packet support for 6500 bytes.

    Regards, Eric 

  • Hi Eric,

    Thanks for your reply.

    We tried changing NDK PBM buffer size but after changing the size ping is not working for less packet size also.

    Were you able to change at your side and is it working for you? 

  • And one more thing what we are trying modify either buffer size or enabling JUMBO packet will affect L2 layer.

    But we are facing issue at application level itself i.e send() and recv() functions.

    Even if we send greater than jumbo packet size i.e 6500, we should not face issue at application level, right?  The packet should have assembled/fragmented in the middle layers according to MTU size, right?

    When we communicate with two linux machines, we are not facing any issue even when we send and recv packets which of size 64K at application layer. 

  • Hi,

    I tried to change the A15: open_cfg.max_pkt_size = 1514 and got exception, this needs further debug. Please use C66x core for the network interface if possible.   

    Regards, Eric

  • HI Eric,

    Have you tried in C66x,? is it working for you?

    We have tried NIMU_BasicExample_evmK2G_c66xExampleProject and NIMU_BasicExample_iceK2G_c66xExampleProject. In both the cases till NetworkOpen is called but dtask_udp_hello is not called.

  • Hi,

    I am travelling and will be back Thursday. I tried ping test using NIMU_BasicExample_evmK2G_c66xExampleProject on K2G EVM, it worked for packet size 1514 bytes on C66x. Ping is an ICMP test will not call dtask_udp_hello().

    And you are developing TCP/IP, what you need is  

    hEcho = DaemonNew( SOCK_STREAMNC, 0, 7, dtask_tcp_echo,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );

    Such call is inside client example, http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_Foundational_Components.html#ndk, you need to port client example to K2G EVM. Test TCP/IP you can use tools: Some Windows host test applications are available under ndk_3_xx_xx_xx\packages\ti\ndk\winapps. I expect TCP/IP work on C66x with 1514 bytes.

    Regards, Eric

  • Hi Eric,

    I tried TCP in C66, at the maximum, i could able to receive 1454 bytes of packet using recvncfrom() function. When i send a packet more than that size, im not able to receive it and apllication blocked in recvncfrom() function.

    It seems like there is issue in C66 also.

    Why such hang is there in both arm and c66?

    While communicating with two linux machines we could able to receive 64KB of data using send() and recv() functions without any issue. We want such feature in 66AK2G12 arm core also. Have you checked it?. This become blocker for us proceeding further.

  • Hi,

    Yes, with the pdk_k2g_1_0_15\packages\MyExampleProjects\NIMU_BasicExample_evmK2G_c66xExampleProject as it is, I was able to ping with: ping <IP address> -l 1468, From Wireshark the packet size is 1510 bytes. This is the maximum we can support, there is 4 bytes extra for the FCS, totaling 1514 bytes. I don't know how you have 1454 bytes, you need to do a Wireshark capture to understand the header size. So for DSP I have no issue.

    For the A15, please make three below changes: 

    1) In the V5\nimu_eth.c, change that 1408 to 1514 as well for A15. 

    open_cfg.max_pkt_size = 1514;
    #else
    open_cfg.max_pkt_size = 1408; /* current limitation due to NDK PBM buffer size for A15*/

    2) In the .cfg file, add a line Global.pktNumFrameBufs = 1024; This will overwrite the default number (192 or 384) built into the NDK.

    3) Add ndk_3_xx_xx_xx\packages\ti\ndk\stack\pbm\pbm_data.c source code into your application project, change the PKT_SIZE_FRAMEBUF for non-DSP from 1536 to 1664 as well.

    I was able to run the updated NIMU_BasicExample_evmK2G_armExampleproject and ping with -l 1468.

    So, you should be able to exchange data using 1510 bytes packet size. If you want to big than that, you need to enable jumbo packet support.

    Regards, Eric


  • Thanks Eric.

    Now we are able to recive 1510 bytes of L2 frames in A15.

    We tried enabling Jumbo packet supprt by following this link processors.wiki.ti.com/.../Enabling_Jumbo_Packet_Support_for_C6678

    But we are facing compilation error. I have attached the log for the same.
    Steps given in that link is for DSP core, so i have made change corresponding to arm core compiler in ndk.mak file as below

    gnu.targets.arm.A15F ?=C:\ti\ccs920\ccs\tools\compiler\gcc-arm-none-eabi-7-2017-q4-major-win32
    2577.logs.zip
    and I have also attached the mak files. Please correct me if i missed anything.
  • Hi Eric,

    A gentle remainder. Is there any update on this?

  • Hi,

    I rebuilt the NDK with jumbo support enabled, I didn't see any issue to build it. My ndk.mak and build log are attached.

    I firstly built the NDK without .bld changes, to make sure the build process worked. Then I merged your two .bld files, the build is still worked. 
    ndk_build.log

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/81/ndk.mak

    Regards, Eric

  • Hi Eric,

    We are able to compile ndk now.

    Next step for nimu modification,  I check v5/nimu_eth.c file.  In nimu_alloc_pkt(), I have modified PBM_alloc(10236).  For compiling nimu, in terminal we using command gmake nimu. I don't where should I add macro _INCLUDE_JUMBOFRAME_SUPPORT. Because in that link for compiling jumbo packet , they compiled nimu as ccs project but we are compiling it through gmake command.

    Have you enabled jumbo packets? After that can you able to send jumbo packets? Can you please share the steps

  • Hi,

    Per today's meeting, you don't need to have jumbo packet support enabled. I looked at several other TI devices and tested with a PC to see how big the packet can be passing through. I found another issue, inside pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\src\v5\nimu_eth.c

    open_cfg.max_pkt_size = 1514; =======> This should be 1518. After this change, I can ping with 1400, 1510, 1514, 1528 (will be segmented into two packets), working cases as below capture. This is the same behavior of a Linux PC to PC, you will see the 1514 bytes packet on Wireshark. Bigger than 1514 will be segmented. A working case capture like below (K2G and PC test)

       

    However, the K2G crashed after a while, still in debug.

    Regards, Eric

  • Thanks Eric.

    We too observed the same here. Please update us when there is any improvement

  • Hi Eric,

    From the above experiement, hope you able to clearly reproduce the issue from your end and progressing on debug. Please let us know if you want us to try/test any experiement/workaround from our end aswell. 

    Regards,

    Balaji A R 

  • Balaji,

    I tested the K2G running Linux, then I tried to ping it with 1514 bytes packets for several minutes, it worked. So this is a pure RTOS/NDK software issue on K2G, and can be fixed. This is not hardware issue on the K2G and shouldn't block your board design.

    Attached is the wireshark capture.

    • 158.218.117.176 is K2G running Linux

    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Linux version 4.14.79-gbde58ab01e (oe-user@oe-host) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP PREEMPT Thu Dec 20 03:57:44 UTC 2018

    • 158.218.112.223 is a PC.

    Regards, Eric  https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/81/ping_5F00_1514.pcapng

  • Hi,

    I hope I have good news for you. We debugged the issue in the past several days and root caused it.

    At this moment, you should be able to run your TCP server application on A15 core with a PC to support 1514 bytes at layer 2 for dozens of packets then the application crashed. You should also be seen the same issue using simple ICMP ping with syntax: ping <IP> -l 1472 -n 1000.

    If you run the same application on C66x, you should see the TCP server didn't work at all.  ping <IP> -l 1470 -n 1000 should work, this is 1512 bytes packets, 2 bytes short of 1514.

    Regards, Eric

  • Hi,

    I am attaching an engineering build, can you verify at your end? The test is done with K2G 6.1 release (pdk_k2g_1_0_15) and NDK ndk_3_61_01_01, on TI K2G general purpose EVM.

    Instructions:

    0. Use the original NDK package, no change

    1. Use the attached NIMU lib to replace pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\lib, this is for A15 and C66x

    2. Use the attached pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\example\helloWorld, see there are 3 files changed. 

    • pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\example\helloWorld\k2g\armv7\bios\helloWorld.cfg
    • pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\example\helloWorld\k2g\c66\bios\helloWorld.cfg
    • pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\example\helloWorld\src\helloWorld_k2g.c

    Highlight the change in .cfg file:

    Tcp.transmitBufSize = 16384;
    Tcp.receiveBufSize = 65536;
    Tcp.receiveBufLimit = 65536;
    Global.pktNumFrameBufs=384;
    Global.pktSizeFrameBuf=1664;

    Global.stackInitHook = "&stackInitHook";
    Global.networkOpenHook = "&my_network_OPEN";
    Global.networkCloseHook = "&my_network_CLOSE";
    Global.networkIPAddrHook = "&my_network_ip_addr";

    //Global.enableCodeGeneration = false;

    //var tskNdkStackTest = Task.create("&StackTest");
    //tskNdkStackTest.stackSize = 0x1400;
    //tskNdkStackTest.stackSize = 0x5000;
    //tskNdkStackTest.priority = 0x5;

    You should be able to build the test application NIMU_BasicExample_evmK2G_armExampleproject and NIMU_BasicExample_evmK2G_c66xExampleProject (Note, don't add nimu_eth.c and pbm_data.c to the project).

    3. Please verify that you can ping the K2G with ping <IP> -l 1472 -n 1000 without any failure.

    4. Finally merge your TCP server with the pdk_k2g_1_0_15\packages\ti\transport\ndk\nimu\example\helloWorld\src\helloWorld_k2g.c. The ping with -l 1472 should work, and Linux application sending 64KB should work.

    Note, this is TI engineering build for debug purpose only, the official code will be delivered in the next Processor SDK RTOS package.

    lib.zip

    3173.helloWorld.zip

    Regards, Eric

  • Hi,

    Did you get a chance to try? Let me know the plan.

    Regards, Eric

  • Thanks Eric for your Engineering build.

    TCP is working for us in K2G with your new Engineering build changes.

    I need one clarification. I observed following things in wireshark, while testing K2G(192.168.1.4) with linux PC(192.168.1.10) by sending and receiving 64K words,

    Linux PC always splits packets into 1514 bytes while sending packets to K2G

    Linux PC receives packets which is greater than 1514 bytes (please refer attached image).

    So whether Jumbo packets enabled in K2G in this Engineering build, inorder to fix our issue?

  • Hi,

    Thanks for the testing! Jumbo packets supporting need both NIMU and NDK change. We used the original NDK package for the testing, and it doesn't support jumbo. When we tried to ping with big packets, we saw the packet was split at 1514 byte boundary. 

    I recall we worked before to enable jumbo packet supports in NDK by re-built it. Is it possible you used that NDK and saw the jumbo issue? Please use the original NDK. 

    Also, is that correct you will use C66x for the TCP server? Please make sure your tested on the target core, although we verified on both A15 and C66x.

    Regards, Eric  

  • Hi Eric,

    We are using original NDK. We are using new development PC for this Engineering build.  Freshly we have installed CCS and pdk in this development PC. Other than Engineering build,  no changes done in this development PC.

    I still don't understand how linux PC is receiving such large packets.  Can you please confirm that K2G is splitting the packets at 1514 byte boundary, while we use send() function in application layer?

    We are going to use a15, anyhow I will test in c66x and will update you.

  • What is the NDK version you used? The NDK doesn't support jumbo by default. I will check send() function on the K2G side.

    Regards, Eric 

  • Hi,

    We don't have socket API example. But I have a NIMU_BasicExample_evmK2G_ARM/c66xExampleProject, it starts a UDP dtask_udp_hello(). There is a 

    if( i >= 0 )
    {
    sendto( s, pBuf, i, 0, (struct sockaddr *)&sin1, sizeof(sin1) );
    recvncfree( hBuffer );
    }

    Where i is packet size, I was able to change that i to different values and see what I captured on Wireshark. For example, i = 1000, 1400 , 1472, I have packets 1042, 1442 and 1514 bytes. When i > 1472, I don't have anything on the wire. So, I don't think NDK supports beyond 1514 bytes.

    Regards, Eric

  • Hi Eric,

    We are using ndk_3_61_01_01. 

    Can you please verify TCP by sending packets greater than 1500 at your end by referring example present in C:\ti\ndk_3_61_01_01\packages\ti\ndk\tools\servers\newservers.c?

    Since we are going to TCP in our target board.

  • Hi,

    Can you send us the *.map file to double check?

    Regards, Eric

  • Hi Eric,

    Is there any update? 

  • Hi,

    We looked at the map file and didn't see anything wrong. So it is not clear why the jumbo packet was sent out by K2G. Is this an issue breaking the transfer with the PC so needs to be resolved or just an observation you want to understand?

    Regards, Eric

  • Hi Eric,

    If K2G is sending Jumbo packets it need to be resolved. Were you able to reproduce this issue at your end?

  • Hi,

    No, I don't get chance to modify an example for socket application yet so I was not able to test. Is that possible you share a CCS project showing the problem, so I can reproduce? 

    Regards, Eric

  • Hi Eric,

    Attached the source code we have used in TI project NIMU_BasicExample_evmK2G_armExampleproject. You can copy the content of this file 3480.to_eric.zipin your project. and also attached the linux source code for TCP client

  • Hi,

    Can you ping the K2G with packet size greater than 1514 bytes? Will you see K2G respond with jumbo packet or fragmented 1514 byte packets?

    Regards, Eric

  • Hi,

    When we try to send packets size greater than 1514 , there is no response from K2G.

    Did you get a chance to try our TCP code?

  • Hi,

    "When we try to send packets size greater than 1514 , there is no response from K2G." =========>This doesn't make sense to me. Ping with various packet size always worked for me with the fix. If basic ping test failed, there is no point to move to TCP test. Did the test fail on both DSP and ARM?  

    Did you get a chance to try our TCP code? ========>Sorry, we were suggested to work for home and I don't have remote access to K2G EVM setup.

    Regards, Eric 

  • Hi Eric,

    Ping works fine for packet size greater than 1514 , when the mtu in linux configured as 1500.

    But it fails, when the mtu size configured as greater than 1500 bytes.

     

  • Hi,

    Thanks for the testing of ping.

    >>> Ping works fine for packet size greater than 1514 , when the mtu in linux configured as 1500. But it fails, when the mtu size configured as greater than 1500 bytes.>>>>

    This is expected. The K2G doesn't supports jumbo packets, it needs to be explicitly enabled in NDK driver and NIMU driver. By default, this is disabled. If Linux changes the MTU size greater than 1500, K2G has no way to receive jumbo packet from Linux machine and no way to reply back.   

    The mystery is why K2G can send out jumbo packet when you do a TCP server test. I am checking with development team. 

    Regards, Eric

  • Hi,

    We don't think that can happen on K2G side. It could be WireShark presenting the packets as a single one? You may try this: https://osqa-ask.wireshark.org/questions/29028/question-about-fragmentation-packets

    I expect we could look at the counters in the NDK to prove that the NDK is not sending the larger packets also. If you still can access the setup, please do a test (don't test too long, it is hard to count how many packets exchanged):

    1. Collect a Wireshark capture with TCP packets between K2G and Linux PC, and have a rough number how many in each direction, assuming K2G sending out much less packets, but are jumbo packet! 

    2. In the CCS expression window, halt the core and record NDK_tcps, NDK_ips. Please try to see those how many packets received and sent. Like below. Does counter supporting that NDK sending out jumbo packets?

    Regards, Eric

  • Hi Eric,

    We sent 4196 bytes of single frame from linux(192.168.1.10) to K2G(192.168.1.4) and then K2G(192.168.1.4) to linux(192.168.1.10).

    Analysis for K2G to linux side:
    In wireshark total packets captures are 7(2 DHCP, 5 TCP) , in which one packet captured with size greater than 1514 bytes.

    But when i saw in NDK_tcps the SndTotal value is 6 and in NDK_ips both of the Total and Delivered value is 7.

    So the NDK_ips values matches with wireshark captured values. With this can we confirm K2G is sending jumbo packets?

    Attached captured screenshots for reference.

  • Hi,

    Thanks for collecting this! I think it means the NDK sent out 7 packets on IP layer and Wireshark also recorded 7 packets, and one of them is a jumbo packet of 2974 bytes. I will check with NDK team and update here.

    Regards, Eric

  • Hi,

    From NDK:

    NDK_ips.Total was 7, but that is the receive count (horrible name!!). NDK_ips.Delivered were number of packets delivered to the stack. So 7 makes sense. NDK_ips.Localout was 10. This is the number of IP packets sent. So it looks like the hardware or WireShark is combining. 

    From NIMU and EMAC:

    NIMU and EMAC driver does not combine multilple smaller packets into larger one.

    So, the K2G sent out 10, the Wireshark showed 7. It is possible Wireshark is combining?

    Also, you can look at K2G TRM (SPRUHY8I–January 2016–Revised March 2019) CPSW2G switch statistics to rule out any K2G issue. See 11.13.4.4.6.11 CPSW_2U Network Statistics

    NOTE: Statistics start at physical address 0423 A000h for CPPI port 0.
    Statistics start at physical address 0423 A200h for Ethernet port 1.

    Regards, Eric

  • Hi Eric,

    When I test between two linux PC, i didn't see such jumbo packets in wireshark.  I'm seeing jumbo packets only when i test between k2g and linux PC.

    I will look at switch statistics and will update you.

  • Hi Eric,

    Again i transmitted 4096 bytes of frame , in wireshark i observed 6 packets but the total tx packet count shows as 8 in K2G. I have also printed count for packet size greater than 1024 which is 6(Tx +Rx) but the total RX and Tx packets greater than 1024, captured in wireshark is 5.

    Attached the captured screnshots

  • Hi,

    Does this mean Wireshark combined the packets into jumbo, as the K2G CPSW stat showed more packets than the Wireshark saw? If you send a little bit more data, say 16K or 32K bytes, the difference will be much more? Also, there are total bytes sent counter in CPSW stat to understand the bytes sent out, it should be correct. And with total bytes and number of packets transmitted, you can confirm the average packet size, there are no jumbo from K2G? 

    Regards, Eric