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.

RTOS/TMS320C6678: Regarding NDK + UDP Client

Part Number: TMS320C6678
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi,

I'm trying to create an UDP client socket for port 2 in an existing project which is already running for raw socket. The project is using TIRTOS.  I've included  NDK in my project and enabled IP block in network layer. I've used "Ip.ifIdx = 2;" to configure it for port 2 in .cfg file. Below is my tool configuration.

xcdtool version : 3.25.5.94

IPC : 3.21.0.07

NDK : 2.24.3.35

SYS/Bios : 6.37.2.27

I've provided hook function for network open hook and that hook function is getting called. Inside the hook function I've created a task and from the task  i'm trying to send some data.  I'm not receiving the data in opposite side (opposite side PC is used to capture the data using wireshark). The code snippet is given below. Kindly point me what other things need to be consider.

SOCKET udpsockfd;
void nw_open_hook()
{

 Task_Start(&oUDPTsk);


}

void nw_close_hook()
{

}

//UDP Client

void Ethernet_UDP_Task(void)
{


  struct sockaddr_in     servaddr;
  char *hello = "Hello from client";
  uart_write("UDP task created\n");

  if ((udpsockfd = socket (AF_INET, SOCK_DGRAM, 0)) == 0){
   uart_write("UDP socket failed\n");
   return;
  }
  memset(&servaddr, 0, sizeof(servaddr));
  // Filling server information
      servaddr.sin_family = AF_INET;
      servaddr.sin_port = htons(PORT);
      servaddr.sin_addr.s_addr = INADDR_ANY;
      while (1){
      sendto(udpsockfd, (char *)hello, strlen(hello),
              0/*MSG_CONFIRM*/, (struct sockaddr *) &servaddr,
                  sizeof(servaddr));
      Task_sleep(1000);
      }

}

Along with that how to read back the information about the IP and MAC address configured. 

thanks

Thirumoorthy S

  • Hi,

    I've notified the RTOS team. They will post their feedback directly here.

    Which NDK & Processor SDK RTOS version is this?

    Best Regards,
    Yordan
  • I'm not using SDK. I'm using SYS/BIOS : 6.37.2.27, and NDK : 2.24.3.35.

    Thanks
    Thirumoorthy S
  • Hi,

    Please clarify:
    1. If you used TI 6678 EVM or this testing or your customized board?
    2. EVM has two EMAC ports, the first is connected to AMC connector, the second is connect to RJ-45. Which port you used for testing?
    3. I didn't see you mentioned any Processor SDK RTOS and NIMU driver. What code you used to initialize the CPSW? Note the NDK must run on top of NIMU driver.
    4. Please check software-dl.ti.com/.../Foundational_Components.html. There are several basic examples to test the NDK/NIMU you can use as a starting point.

    Regards, Eric
  • Hi,

    Also, if you issue is how to write a NDK client example, you can refer to some E2E discussion e2e.ti.com/.../683667. On 05-03-2018 2:56 PM, there is an attachment with both client and server test application. It is for K2H device, but you can refer to the NDK level source code, this should be the same for C6678.

    Regards, Eric
  • Hi,

    I'm using customized board.  I'm using sys/bios and for NIMU driver i'm using "pdk_C6678_1_1_2_6".

    Thanks

    Thirumoorthy S

  • I'm sorry I think i'm missing something. I'm not able to find the attachment in the link provided for server and client example. please share UDP client example project for TMS320C6678.

    Thanks
    Thirumoorthy S
  • Hi,

    lding said:
    If you used TI 6678 EVM or this testing or your customized board?

    I'm using Customized board.

    lding said:
    I didn't see you mentioned any Processor SDK RTOS and NIMU driver. What code you used to initialize the CPSW? Note the NDK must run on top of NIMU driver.

    Using PDK "pdk_C6678_1_1_2_6" for NIMU.

    Referred client.c example project and initialized QMSS, CPPI and PASS. NIMU related calls are getting triggered from "nimu_eth.c -> NIMUDeviceTable".  Rest of other things like nc_systemopen, cfgnew are all done in the auto generated file "xxxx_sysbios_p66.c" and it is also getting triggered. Finally the stack is up and network_open function is getting called. As mentioned in previous thread, once the network_open function gets triggered a new task is created. The new task will open the socket as SOCK_DGRAM, perform sendto operation. 

    Added Global, IP and ICMP in the NDK module. These are the setting in  .cfg file

    BIOS.clockEnabled = true;
    Global.autoOpenCloseFD = true;
    Global.networkOpenHook = "&nw_open_hook";
    Global.networkCloseHook = "&nw_close_hook";
    Ip.autoIp = false;
    Ip.address = "192.168.1.2";
    Ip.mask = "255.255.255.0";

    Log I got it from the Customized board :

    QMSS successfully initialized

    CPPI successfully initialized

    PA successfully initialized

    PASS successfully initialized

    Ethernet subsystem successfully initialized

    Ethernet eventId : 48 and vectId (Interrupt) : 7

    Verify_Init: Expected 0 entry count for Queue number = 901, found 7 entries

    Registration of the EMAC Successful, waiting for link up ..

    UDP task created

    UDP send :-1

    Source code snippet is listed in the above thread. Still i'm not getting UDP packet coming out from DSP (using Wireshark to capture the packet).  Kindly suggest what am I missing. 

    To Perform ping, just enabling ICMP in the NDK module is enough or is there additional code I need to add?

    Thanks

    Thirumoorthy S

  • Hi,

    Can you please provide a pointer to proceed further.

    Thanks

    Thirumoorthy S

  • Hi,

    Able to generate ARP packet from DSP to PC and PC is also responding, but not sure DSP is receiving it or not. ARP not resolved and error says "Host not found".

    What would be problem in Receive side since ARP from DSP is happening and DSP is not accepting response from HOST PC. 

  • Hi,

    Good to know you have NIMU driver in the test application. The MCSDK 2.1.2.6 (pdk 1.1.2.6) for c6678 is obsolete. Please use the latest Processor SDK RTOS Rel 5.0 for C6678

    http://software-dl.ti.com/processor-sdk-rtos/esd/C667x/latest/index_FDS.html

    Then look at user guide for NDK part:

    http://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/Foundational_Components.html#ndk

    There are several basic NDK test examples, make sure they worked. Then change the network stack portion of the code to a client. The customer test code I mentioned attached.

    8473.server_client_test.zip

    Regards, Eric

  • Hi Eric,

    I'm in progress of porting my project which was using sys/bios(MCSDK 2.1.2.6+PDK1.1.2.6) to SDK as suggested by you. 

    In between I'm trying with MCSDK 2.1.2.6 (pdk 1.1.2.6) for c6678 which is required for first release.

    I'm trying to send UDP packet from DSP to PC. As a first thing is ARP resolution, DSP is send ARP request to PC and PC also responding back, but ARP is not getting resolved in DSP.  I can see the STATA and STATB counters in the DSP is getting updated but ISR is not getting triggered.  The event ID 48 and interrupt 7 is used as is in the NIMU driver. 

    I tried to change the interrupt to 10 and got stuck in the asm loop 

    ti_sysbios_family_c64p_Hwi_int10:

    00817140:   003C54F6            STW.D2T2      B0,*B15--[2]

    00817144:   0028A35A            MVK.L2        10,B0

    00817148:   003C22F6            STW.D2T2      B0,*+B15[1]

    0081714c:   0038A02A            MVK.S2        0x7140,B0

    00817150:   000040EA            MVKH.S2       0x810000,B0

    00817154:   00000362            B.S2          B0

    00817158:   003C52E6            LDW.D2T2      *++B15[2],B0

    0081715c:   00006000            NOP           4

    Any pointers will be helpful

    Thanks

    Thiru

  • Hi,

    I thought your work flow should be: try the several NDK examples under MCSDK or Processor SDK RTOS first, e.g, those hello world to make sure it is working (e.g. you can Tx and Rx packets). Then you change the NDK example for UDP client. Why you need to change interrupt number?

    You mentioned earlier that test is on a customized board. Did you explain which EMAC port used, I can't find. If you also use EMAC1, if PHY is working (as you saw STATA and STATB), the hello world should work as it is.

    Regards, Eric