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.

Socket response isn't happening. TMDSEVM6670L

Good day to you again.

Still working on TMDSEVM6670L, using mcsdk_2_01_02_06 and ndk_2_24_01_18.

The problem occurs, when i'm trying to make an difficult and huge task to response.

The "global" part in main.c:

static HANDLE hTask=0;

static void NetworkOpen()
{

    // Create our local servers
	
	hTask = DaemonNew(SOCK_DGRAM, 0, 5000, dtask_check_task,
		            OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
}

The "working part" in check_task.c:

#include "ti/platform/platform.h"
#include "ti/platform/resource_mgr.h"

#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "C:\ti\pdk_C6670_1_1_2_6\packages\ti\platform\platform.h"
#include "C:\ti\pdk_C6670_1_1_2_6\packages\ti\platform\resource_mgr.h"
#include <ti/ndk/inc/netmain.h>

#define start_address 0x80000000
#define length    0x10000000
#define end_address start_address+length

int dtask_check_task( SOCKET s, UINT32 unused ) //5000 порт
{
	/* some variables for working, etc.*/
        to.tv_sec  = 3;
	to.tv_usec = 0;
	setsockopt( s, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof( to ) );
	setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof( to ) );

        for(;;)
	    {
		tmp = sizeof( sin1 );
		i = (int)recvncfrom( s, (void **)&pBuf, 0, (PSA)&sin1, &tmp, &hBuffer );
                if ( i >= 0 ) // if there's no recieve error - do
			{
                            /* huge task over here, i can send the whole project if you prefer*/
                                sendto(s, "DDR3 test PASSED!", 16, 0,(PSA)&sin1, sizeof(sin1) );
				sendto(s, 0, 0, 0,(PSA)&sin1, sizeof(sin1) );
				platform_write("DDR3 test passed!\n");
				recvncfree( hBuffer );
			}
		else
		 	 {break;}
                return(1);
	    }
}


The problem occurs, when i'm reaching the "sendto" directives.  They are "skipping" but not executing, i'm not sending back the data. When i'm deleting the huge and difficult task, only the last "sendto" directive is executing. I'm confused about the process, because in the previous projects it was working correctly. Maybe the problem is in the memory configuration? (In this project it is working in the internal memory, while not using the DDR). Or, if it is not the memory issue, what is the problem? I'll be waiting for your response, thank you.

  • Hi Taras,
    What do you meant by "huge and difficult task" ?
    Did you put break point in "sendto" line and ever hit ?
  • Hello Titus.

    Under "huge and difficult task" i mean task with 100+ more strings of code, witch a huge amount of calculation steps.
    Yes, i set a breakpoint and execute the program step by step. The instructions were executing, i've not seen errors. But they had no result and effect.
  • Could you please try to change it to DDR memory configuration in .cfg file and check the same behavior.
    Also attach the project.
  • In the DDR configuration it's not working, because the target of my project is DDR check, so it must be free.  Here's my project:https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/DDR_5F00_init_5F00_check.7z

  • Strange things occurs while i was launching the project today. Sometimes both commands are executing, sometimes only the one with an empty packet, sometimes none of them. I don't understand, why this is happening.
  • The problem with an configuration is solved, but i still have another one.
    I want my program to send packets with a single number in cycle, like here:

    for (j = 0; j < 500; j++)
    	        	{
    	        		outval = j;
    	        		ltoa(outval, poutbuf);
    	        		if (j < 10)
    	        		{
    	        			sendto(s, poutbuf, 1, 0,(PSA)&sin1, sizeof(sin1) );
    	        			printf(poutbuf, "\n");
    	        		}
    	        		if (j >= 10 && j <100)
    	        		{
    	        			sendto(s, poutbuf, 2, 0,(PSA)&sin1, sizeof(sin1) );
    	        			printf(poutbuf, "\n");
    	        		}
    	        		if (j >= 100 && j < 1000)
    	        		{
    	        			sendto(s, poutbuf, 3, 0,(PSA)&sin1, sizeof(sin1) );
    	        			printf(poutbuf, "\n");
    	        		}
    
    	        	//	platform_delay(10000);
    	        	}
    	            sendto(s, 0, 0, 0,(PSA)&sin1, sizeof(sin1) );
    	            recvncfree( hBuffer );

    But when i'm trying to do that, the inner sendto functions are not responding, and when i reach the last sendto fucntion, it sends the "01234567891011213..." so far till "J" is 500. All values are stuck together in an large buffer. That's not what i need, and i can't make this functions work correctly. Is that an sendto function issue or what?

  • Hi Taras,
    Initially, just try to send some 50 packets continuously with the same value. Then try with some different combinations to check what causing the problem.
  • I've tried to follow your advice. This command "slips", executes, but does not responding, i.e. packets are not sending, WHILE task is called for the first time. When i call the task again, by sending initiator packet, it executes correctly and exactly like i need. How this bug can be explained, or am I doing something wrong? I really need the task to execute correctly from the beginning.

    Also, when the values are different, packets  with them can be mixed up, lost, doubled or susceptible to other troubles, but this is the UDP issue i suppouse.

    UPD.: when i leave task in idle, after time passes - the issue returns and i need to launch it again to achieve a normal executing process. I'm really confused