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.

Problem of DeamonNew Function in NDK 2.0.0

Other Parts Discussed in Thread: CCSTUDIO

Running demo program:

C:\CCStudio_v3.3\ndk_2_0_0\packages\ti\ndk\example\network\helloWorld

provided by NDK2.0.0, I found the function dtask_udp_hello() registered by the following code:

hHello = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_hello, OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 )

could never be called. Is there anybody who meets the same problem?

 

I have replaced nettool.lib with NDK source code to debug into source code of DaemonNew() function to trace this problem, and I found the following line in DaemonNew.c:

// Update the fdPoll array

pollitem[i].fd = drec[i].s;

if( drec[i].Type && drec[i].TasksSpawned < drec[i].MaxSpawn )

   pollitem[i].eventsRequested = POLLIN;                //…….. Label 1

else

   pollitem[i].eventsRequested = 0;                          //…….. Label 2

// Leave our lock

SemPost( hDSem );

// Poll with a timeout of 10 second - to try and catch

// synchronization error

if( fdPoll( pollitem, DAEMON_MAXRECORD, 10000 ) == SOCKET_ERROR )

            break;

// Enter our lock

SemPend( hDSem, SEM_FOREVER );


// Spawn tasks for any active sockets

for( i=0; i<DAEMON_MAXRECORD; i++ )

{

    // If no poll results or the drec has been freed, skip it

    if( !pollitem[i].eventsDetected || !drec[i].Type )

          continue;                                                   //…….. Label 3

     // If the socket is invalid, close it

     if( pollitem[i].eventsDetected & POLLNVAL )  //…….. Label 4

     {

          fdClose( drec[i].s);

          drec[i].s = INVALID_SOCKET;

          continue;

      }

 

Label 1 and Label 2 will be executed alternatively, while Label 3 could be executed DAEMON_MAXRECORD (which is 12) times, but Label 4 could never be executed. This is the cause of the failure mentioned above, but why?

  • I changed back to NDK1.94.1 and the problem disappears.

    I think there is something wrong with NDK 2.0.0  :(

  • I too am facing the same issues with NDK 2.0.0 regarding DaemonNew() wherein it doesnt fork the function dtask_udp_hello.

    Kindly suggest an workaround for NDK 2.0.0, so that we can succesfully test the UDP Hello WOrld program provided by NDK.

    Please reply.

  • Vcar, Santosh,

    We are currently investigating this issue for the DM648.  In the meantime, there is a patch which I suspect will fix the issue that you are seeing.  The patch is for the DM648 ethernet driver - were you aware of this patch?

    Please find it here and give it a try.  There is a readme file with instructions for how to apply the patch, but in short you'll just need to copy the files from the patch and replace the files in your NDK install with them.

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ndk/2_00_00/index_FDS.html

     

    There are both Windows and Linux installers:

    setupwin32_ndk-2_0_0_source_patch_1_0_0_1.exe

    or

    setuplinux_ndk-2_0_0_source_patch_1_0_0_1.bin

     

    Steve

  • Hi Steven,

    Im currently using the CommAgility AMC-3C87F3 hardware consisting of the TI based TCI 6487 DSPs.

    I had already downloaded the NDK 2.0.1 for evm6474 and it works fine as in the IP address gets printed and the "Ping" works fine.

    When i place a breakpoint in function "dtask_udp_hello", it doesnt reach there.

    I tried to download the Patch given above, but i believe its for DM648. Even then i tried to patch it to my evm6474 NDK, but it fails to compile, since its not compatible with the same chip.

    How can i proceed now on this. Has TI come up with a patch for evm6474 chip for proper functionality of the NDK. KIndly guide.

    Regards

    Santosh

  • Don't you(TI) test the software before releasing it

    --Rajesh

  • The patch doesnt work. you people at TI please do something about this issue. the code halts after few hrs of communication using PHY's.

  • We would like to know if IP Segmentation and Re-assembly is supported at the NDK.

    It was also seen that sendto() FAILS when we send data from a different TASK thread, other than the STACKTEST task which is created by Default.

    Kindly guide us.

     

    Thanks

    Santosh

  • Hello,

    I am facing the issue of sending the data thro sendto() from anywhere in the program. Its observed that the data can be sent only from the Task thread created for the default STACKTEST Task .

    TI guys, kindly help us resolve this issue . I see that this issue has been pending from a long time.

    Regards

    Santosh

  • Each task that uses the NDK functions needs to call fdOpenSession() before calling any NDK functions. Do you have a call like:

        fdOpenSession((HANDLE)Task_self());

    in your task using sendto()? See Section 3.2.2.3 of  the NDK User's Guide (spru523).

    Mark

     

  • Hi Mark,

    ive tried this too by placing the fdOpenSession(TaskSelf()) at the beginning of the function doing the sendto() and fdCloseSession(TaskSelf()) at the end of the function.

    Still no progress, im using the sendto() at every 1ms tick which comes from the hardware interrupt. So i want the sendto() to send packets to the remote entity at every 1ms tick which comes in the form of the hardware interrupt.

    Can you pls help me out with this ?

  • Santosh,

    what is the return value you are getting from the sendto() call?

    Also, what is the priority of this task, as well as the priority configured for the StackThread() task?  (are you calling sendto() from within a Task context or an ISR context?)

    Steve

  • Hi Steven,

    The return value is correct indicating the number of bytes sent. This value is right.

    What i have observed is that the packet is not sent from the Ethernet Interface, and its not visible even on the wireshark traces. Even the remote end doesnt receive the packet.

    The Priority of the StackThread Task is set to 5 (OS_TASKPRINORM). Im not calling the sendto() function with respect to the StackThread Task, but its called from a ISR context. Its the Hardware Interrupt context.

    Ive even tried calling the sendto() from a Task Context too. With this the sendto() fails giving rise to "-1" bytes and informing me that there are no EMAC buffers available.

  • Santosh,

    NDK functions can only be called from task/thread context. You cannot call NDK functions from HW or SW interrupts.

    I am not sure why your sendto() fails in Task context. How are you seeing "no EMAC buffers available"? This could be as simple as not configuring a large enough heap, which is causing alloc()'s to fail in the NDK stack. Check your configuration (are you using DSP/BIOS 5.x or SYS/BIOS 6.x?)

    Mark

  • Hello,

    The sendto() api of NDK can send maximum of 1500 bytes being the MTU size. I wanted to know as to how many bytes can be received thro the recvfrom() api of the TI NDK.

    I dont know as to what is the maximum bytes received by the recvfrom() api. Kindly help me out.

    Santosh