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.

ethernet and http client both will not working together.

Hello sir

We have use tirtos with tm4c1294 controller. In this we have used NDK for Ethernet communication.  

For Ethernet communication we have used Modbus and it is derive from TCP echo sample code.

And we have used HTTP client to display data on web page.  

if connect both in to our system (Modbus TCP is connected and http client from browser),it gets crash

If we connect only Modbus TCP -  working ok

If we connect only webpage  -  working ok

for modbus it connected form 502 port no and http clent is from 80

ti-rtos config file(.CFG) is attached.

7558.tcpEcho.cfg

What will be the reason for this.  Please give us some suggestion

  • Hi,

      I'm not sure what caused the crash. I wonder if it has something to do with the stack usage. Try to find out from ROV if you have any stack overflow. For experiment, can you increase the below parameters. See if doubling the values will make a difference. If it makes a difference then you can work your way back to reduce the sizes to the amount that you really need. 

    Global.ndkThreadStackSize = 1536;
    Global.lowTaskStackSize = 1024;
    Global.normTaskStackSize = 1024;
    Global.highTaskStackSize = 1024;
    Tcp.transmitBufSize = 1024;
    Tcp.receiveBufSize = 1024;

    This post has additional info on the various parameters for tuning the stack and heap. 

    https://e2e.ti.com/support/processors/f/processors-forum/947313/faq-how-is-memory-managed-in-the-ndk

  • hello sir,

    changing buffer and stack isnt solve my issue .

    web browsing and single TCP connection is working ok if we mad more then one TCP connection then only web browsing is not working. and multiple TCP connection data communication is working properly. only the web browsing gives the error message like "

    This site can’t be reached"

    if we made only one TCP connection then web browsing is working ok .

  • Hi,

      I will suggest you use the wireshark to capture the network traffic and find out why the webserver is not working if there are multiple TCP connections. What does the wireshark show? Please compare the wireshark between a working webserver vs. not-working webserver. 

  • hello,

    On CCS though debug i have checked. it is observed that when multile TCP connection connected (port 502) and when webpage request came it give following error messge on console. 

    it seems like heap memory related problem is it ?  

    00013.255 out of memory: handle=0x0, size=536962716
    00013.255 SBNew: Buffer OOM
    3.374 mmBulkAlloc(): could not allocate memory.
    00013.374 out of memory: handle=0x0, size=536962716
    00013.374 SBNew: Buffer OOM
    3.509 mmBulkAlloc(): could not allocate memory.
    00013.509 out of memory: handle=0x0, size=536962716
    00013.510 SBNew: Buffer OOM
    3.630 mmBulkAlloc(): could not allocate memory.
    00013.630 out of memory: handle=0x0, size=536962716
    00013.631 SBNew: Buffer OOM
    3.765 mmBulkAlloc(): could not allocate memory.

  • Hi,

    web browsing and single TCP connection is working ok

    I think we know that one TCP connection and web browsing is working, correct? Use this as a baseline and then try to add one more TCP connection at a time. How many TCP connections can you add until it crashes? When it crashes, increase the heap again and will it resolve the issue? If it succeeds, then add another TCP connection and so on. Don't immediately add bunch of TCP connections as this may be the reason that it crashes the system due to lack of memory. Please bear in mind that there is only 256kB of SRAM on chip. There is a physical limit as to how much heap you can allocate. 

    Earlier I suggested you to increase the heap and stack. Not sure if you have increased enough heap. 

  • 00013.255 out of memory: handle=0x0, size=536962716
    00013.255 SBNew: Buffer OOM

    That size reported in the out-of-memory error is 512 Mbytes, which as there is only 256 Kbytes of SRAM on chip means the memory allocation is never going to be successful.

    it is observed that when multile TCP connection connected (port 502) and when webpage request came it give following error messge on console. 

    What is the webpage request which caused the error?