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.

How to create an UDP client socket on the OMAPL138 using NSK/SYSBIOS

Hi there,

I am planning to implement my know UDP client on the OMAP L138 LCDK board and I have read the user and design guide for the NDK with the reference design. 

I was able to run the hello world and client example provided with the NSP. however, when I try to make some changes it doesn't seem to work. 

Following changes I made: 

1) Implemented the hello world example using the BSD socket standard and hence followed the steps mentioned in the reference guide, Section 3.3.

    - Removed the reference to NDK/INC and added NDK/INC/BSD in the include path. 

 I get error about the dtask_udp_hello socket type and UINT32 type are not defined.. Which is expected after removing the reference from the NDK/INC ... but I think the socket in BSD format is of type int and I am not sure how can I change the type of the dtask_udp_hello when called in the NewDaemon function. 

2) In the user guide Section 3.3.. creating the task using configuration method.. I have created a task using static method with the stack size 4096 and priority of 5 as mentioned in the guide! 

I have also added the fdOpenSession and fdCloseSession as shown in the example design. When I run the example I get an error stating unable to create socket! that is it return INVALID_SOCKET..

I was under the impression that, if I don't want to use the NewDaemon function to create sockets then I can create task - socket using the 2nd method. 

Could you please explain,  how to create a socket using the SYSBIOS task. Thanks.

Regards,

Mitesh

  • Hi Mitesh,

    Regarding 1) I think you should not remove any include paths, just add the BSD include path.

    Regarding 2) are you ensuring that the task you are creating (with fdOpenSession ...) does not get to run until after the stack is up and IP addresses are bound, as mentioned in section 3.3.1?

    Best regards,

    Murat

  • Hi Murat,
    Regarding 2) I have created the task in the OpenNetworkHook function, I guess that is enough to make sure the stack is up?
  • Can you post a little more detail as to when you are seeing the socket error?

    Specifically is getting called after the hook function is called?

    Any other info you may provide will also help us understand the issue you are seeing,

    Best regards,
    Murat

  • Hi Murat,

    At first, I was trying to create the task using the configuration static method but then I moved to created the task dynamically in the code and called the TaskCreate function in netOpenHook but it still didn't do what I wanted and hence I moved the task into the netIPAddr. It seems to work fine now.

    But I am trying to call mmBulkAlloc in the task function to initialise the data to be send over socket and looks like the mmBulkAlloc is defined to be use the stack memory and can't be called outside the task function? is this right? 

    If I want to call something similar to mmBulkAlloc for 1024 bytes memory what function should I use outside the NDK? would it be the heap memory? 

    Regards,

    Mitesh

  • Thanks Mitesh,


    Sounds like you are making progress.

    Regarding your second question about memory allocation, my understanding is that the mmBulkAlloc function is used internally by NDK, and its allocations come from the main system heap (not stack).

    The NDK has a couple different memory managers. Here's a site that describes the different ones and how to select workable solutions.

    http://processors.wiki.ti.com/index.php/TI-RTOS_Networking_Stack_Memory_Usage

    Hope this helps,

    Murat

  • There was a suggested answer and since there has been no active on this thread for more than a week, the suggested answer was marked as verify. Please feel free to select the "Reject Answer" button and reply with more details.