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/MSP432E411Y: socket() call failing with out-of-memory condition

Part Number: MSP432E411Y


Tool/software: TI-RTOS

I am trying to trace the cause of failure for a socket() call failure.  The call fails in NDK_socket() SockNew() returing 12 (ENOMEM), which I would assume is due to memory exhaustion. 

What can I do to increase the memory used for the calls?   I do have the NDK configuration mapped through XDCTools/RTSC, but cannot see any difference when setting the  NDK.Global PBM/Mmoeyr manager buffer sizes for packet/memory manager buffers.  ROV shows (assuming I interpret this correctly) there to be at least a 0x3e58 size object, but I assume that's not available to the NDK here?  (I would assume there's heap left, and that can be set in the linker .cmd file, but that's not used here, or is it?)

DHCP client works, so at least something is functional.

  • Here are some suggestions gleaned from the NDK Memory Manager Guide (section: "How to reduce RAM usage/Reducing Socket size"):

    • Reducing Task stack sizes
      • The most common way to reduce the memory used from the dynamic heaps is to reduce the stack sizes. In CCS Debug mode, you can use the RTOS Object View (ROV) tool to see the "Detailed" view of the Task module. This view allows you to determine whether a task size can be reduced. 
        See the Guide above for more details
    • Reducing socket sizes
      • Depending on your worst case socket usage, you can reduce the buffers sizes using the Tcp.transmitBufSize, Tcp.receiveBufSize and Udp.receiveBufSize properties.

    Here's another link to NDK RAM sizing. The example is from another processor, but the technique should work the same.

    Other References:

    Hope these references help.

    Regards,

      Bob L.

  • The problem is that I think I've got (assuming I am reading the ROV output correctly) more than 100 K heap left.-- This memory seems however unavailable to the NDK. Actually later on I got the same problem linking to pre-compiled libraries with the MSP432 SDK on the FAT filesystem code. I am having some troubles understanding how the kernel / NDK / SDK libraries allocate dynamic memory, and how to define that correctly with RTSC/XDC tools. Just a C heap (and C++ dynamic store). Now it seems the calls fail due to exhausting "some dynamic allocation store" which I cannot really trace how to increase. I am really struggling with some basics here it seems to me and would really appreciate some help in the form of a configuration file and/or linker script. I am quite sure the linker .cmd is all right, but the .cfg file is quite black magic to me.
  • Hello Jaakko,

    Sorry for the delay in response! Are you still working on this issue? Let us know where you are so that I can try to help.

    Thanks,
    Sai
  • Hello Sai!

    Thanks, help would be much appreciated.  I am afraid the issue still persists.  However, have shifted most attention to another (CC3220-based) project right now (actually, we expect to run the same application with very slight modifications on both designs which are very similar externally except for the physical network medium.)  So haven't really been putting effort into solving it in the past week.

    I have had previously success with the socket calls, but after adding bits here and there I have arrived where it seems I see unexpected memory exhaustion (in somewhere which to me seems is not the main heap?)  I cannot rule out stack exhaustion (?), but to me it seems the main heap itself is intact (at least ROV does report it to be sane, as far as I can tell.)

  • Hello Jaakko,

    If you need portability with CC3220 SDK then I would recommend using SL_NetSock APIs, instead of NDK APIs. Please refer to "tcpecho" and "udpecho" in the folder ./examples/rtos/MSP_EXP432E401Y/ns/ of the MSP432E4 SDK.

    Let me know if you are continue to have issues even after using SL_NetSock APIs.

    Thanks,

    Sai

**Attention** This is a public forum