<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Stuck in TCP/IP Task? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358151#M11690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm seeing a problem in my project with two TWR-MPC-5125 modules communicating via Ethernet where one of the modules will transmit something and cause both modules to be stuck in the MQX TCP/IP task. It seems to require both modules attempting to transmit to each other (5 or 6 small messages, 40k or so) at the same time&amp;nbsp; to cause this to happen. When it happens, my normal application tasks all show ready (priorities around 10 and 11) and my timer task that services my leds every 100mS (priority 2) runs properly but the TCP/IP task (priority 6) never blocks to let other tasks run. If I hit the reset button on one of the modules, the other module returns to normal operation. It seems like something has gotten the socket in a state that won't allow RTCS to allow other (lower priority) tasks to run and that bad state seems to be cleared when one of the modules is reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Any suggestions for what could cause a socket to do this or what kinds of things I should look for in troubleshooting? If I prevent one of the modules from transmitting it's 5 or 6 messages until the other one has finished all works properly. Also, once these 5 or 6, 40k messages are exchanged, continuous small (20 or 30 byte) messages are sent back and forth for days/weeks with no ill effects. I'm using MQX 3.8.1.1 patched with RTCS 4.0.1. Thanks for any guidance or ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Sep 2014 17:38:49 GMT</pubDate>
    <dc:creator>Tim562</dc:creator>
    <dc:date>2014-09-30T17:38:49Z</dc:date>
    <item>
      <title>Stuck in TCP/IP Task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358151#M11690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm seeing a problem in my project with two TWR-MPC-5125 modules communicating via Ethernet where one of the modules will transmit something and cause both modules to be stuck in the MQX TCP/IP task. It seems to require both modules attempting to transmit to each other (5 or 6 small messages, 40k or so) at the same time&amp;nbsp; to cause this to happen. When it happens, my normal application tasks all show ready (priorities around 10 and 11) and my timer task that services my leds every 100mS (priority 2) runs properly but the TCP/IP task (priority 6) never blocks to let other tasks run. If I hit the reset button on one of the modules, the other module returns to normal operation. It seems like something has gotten the socket in a state that won't allow RTCS to allow other (lower priority) tasks to run and that bad state seems to be cleared when one of the modules is reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Any suggestions for what could cause a socket to do this or what kinds of things I should look for in troubleshooting? If I prevent one of the modules from transmitting it's 5 or 6 messages until the other one has finished all works properly. Also, once these 5 or 6, 40k messages are exchanged, continuous small (20 or 30 byte) messages are sent back and forth for days/weeks with no ill effects. I'm using MQX 3.8.1.1 patched with RTCS 4.0.1. Thanks for any guidance or ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 17:38:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358151#M11690</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2014-09-30T17:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck in TCP/IP Task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358152#M11691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little more information, I set a breakpoint on the MQX function _task_set_error() and have had no hits. Also, I increased the size of the MQX RTCS Socket Tx and Rx buffers from the default size of 4380 bytes to 17,532 bytes (4 times larger). After increasing the buffer sizes I haven't seen the lockups again. Does this make sense? Do these buffers need to be sized for the largest message that will be transmitted or received to prevent the TCP/IP task from locking up? I assumed if I passed send() a buffer pointer to more data then it could hold in it's TxBuffer it would just block until it had transferred all the data then it would return. Is this incorrect? Thanks for any suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 20:53:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358152#M11691</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2014-09-30T20:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck in TCP/IP Task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358153#M11692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim, this seems like a problem with acknowledge. The send data sit in the send buffer until it is acknowledged by remote peer. So the lockup situation might be: the send buffer is full and the board is not able to receive ACK ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to be sure this is the problem, I think you can put breakpoint when PCB alloc fails. That would be in the source file "rtcspcb.c", when rtcs_pcb = RTCS_part_alloc(RTCS_data_ptr-&amp;gt;RTCS_PCB_partition); is NULL. If this occurs, it might be all PCBs are scheduled for transmission and there is no more PCB available to receive ACK ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is the case, the fix is very easy - increase the number of PCBs available: _RTCSPCB_init/_RTCSPCB_grow/_RTCSPCB_max global variables.&lt;/P&gt;&lt;P&gt;If you have enough memory for 16 KB send/receive buffers, it will give you much better throughput. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 04:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358153#M11692</guid>
      <dc:creator>Martin_</dc:creator>
      <dc:date>2014-10-02T04:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck in TCP/IP Task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358154#M11693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply Martin,&amp;nbsp; I will give this a try and post back here what I see. Your idea does make sense given what I'm seeing here. Also, when I increased the size of my send receive buffers to 17,532 bytes the problem disappeared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Oct 2014 16:54:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358154#M11693</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2014-10-02T16:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Stuck in TCP/IP Task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358155#M11694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I tested your theory that perhaps RTCSPCB_alloc(void) may be unable to allocate a PCB and didn't see this happening. To catch this, I modified the MQX ...rtcs\source\tcpip\RTCSPCB_alloc() function slightly to place an ELSE asm(nop); that I could set a breakpoint on (see code insert). Then I rebuilt MQX, recompiled my project with the size of the Tx/Rx buffers shrunk down to the default 4380 bytes (which caused the problem to re-appear). I placed a breakpoint on the asm(nop); statement in the RTCSPCB_alloc() function and let the problem happen. Neither box A or box B hit this breakpoint when the problem occurred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; At this point I have corrected the problem by increasing the size of the MQX Tx and Rx buffers from the default 4380 up to 17520 (4 times larger). Since doing this I haven't seen the problem again. What's your opinion, is this a reasonable solution? I worry about experiencing future problems as traffic increases and message sizes grow. Here's the values I used to init the Ethernet system do these values look reasonable to you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14123621356161475" jivemacro_uid="_14123621356161475"&gt;
&lt;P&gt;_RTCSPCB_init = 16;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Default value: 4&lt;/P&gt;
&lt;P&gt;_RTCSPCB_grow = 8;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Default value: 2&lt;/P&gt;
&lt;P&gt;_RTCSPCB_max = 64;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Default value: 20&lt;/P&gt;
&lt;P&gt;_RTCS_msgpool_init = 64;&amp;nbsp; //Default value: 4&lt;/P&gt;
&lt;P&gt;_RTCS_msgpool_grow = 32;&amp;nbsp; //Default value: 2&lt;/P&gt;
&lt;P&gt;_RTCS_msgpool_max&amp;nbsp; = 320;&amp;nbsp; //Default value: 20&lt;/P&gt;
&lt;P&gt;_RTCS_socket_part_init = 12; //Default value: 4&lt;/P&gt;
&lt;P&gt;_RTCS_socket_part_grow = 8;&amp;nbsp; //Default value: 2&lt;/P&gt;
&lt;P&gt;_RTCS_socket_part_max&amp;nbsp; = 160; //Default value: 20&lt;/P&gt;
&lt;P&gt;_RTCSTASK_stacksize = 10000; //Default value: 10000&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your advice Martin I appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_14123621355664753 jive_text_macro jive_macro_code" jivemacro_uid="_14123621355664753"&gt;
&lt;P&gt;RTCSPCB_PTR RTCSPCB_alloc(void)
&amp;nbsp;&amp;nbsp; {&amp;nbsp; 
&amp;nbsp;&amp;nbsp; RTCS_DATA_PTR&amp;nbsp;&amp;nbsp;&amp;nbsp; RTCS_data_ptr;
&amp;nbsp;&amp;nbsp; RTCSPCB_PTR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtcs_pcb;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; RTCS_data_ptr = RTCS_get_data();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; rtcs_pcb = RTCS_part_alloc(RTCS_data_ptr-&amp;gt;RTCS_PCB_partition);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if(rtcs_pcb != NULL)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtcs_pcb-&amp;gt;IP_SUM_PTR = NULL;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _mem_zero(&amp;amp;rtcs_pcb-&amp;gt;LINK_OPTIONS, sizeof(rtcs_pcb-&amp;gt;LINK_OPTIONS));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } /* Endif */
&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm(nop);&amp;nbsp; //To allow an error trap&lt;/P&gt;
&lt;P&gt;
&amp;nbsp;&amp;nbsp; RTCSLOG_PCB_ALLOC(rtcs_pcb);
&amp;nbsp;&amp;nbsp; return(rtcs_pcb);
&amp;nbsp;&amp;nbsp; }&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 17:35:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Stuck-in-TCP-IP-Task/m-p/358155#M11694</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2014-10-03T17:35:50Z</dc:date>
    </item>
  </channel>
</rss>

