<?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>LPC MicrocontrollersのトピックProblem with lwip/webserver_freertos</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-lwip-webserver-freertos/m-p/583350#M20828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alramlechner on Mon Aug 10 05:59:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am using the LPC1768 webserver_freertos LPCOpen example. i am running into strange problems with an PC application connected via TCP to the MCU. because i spent hours of debugging and can't really find the problem, i tried to reproduce some similiar behavior with the original code. and that was quite easy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i just brought the webserver_freertos example (vanilla code) running and just modified the netconn_fs.c in the following way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;old code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;line 47:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;const static char http_index_html[] = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Congrats!&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Welcome to our lwIP HTTP server!&amp;lt;/h1&amp;gt;&lt;P&gt;This is a small test page, served by httpserver-netconn.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";
&lt;/P&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;near line 135:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;modified to call netconn_write more often:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
const static char http_index_start_html[] = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Congrats!&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Welcome to our lwIP HTTP server!&amp;lt;/h1&amp;gt;&lt;P&gt;This is a small test page, served by httpserver-netconn.&amp;lt;table&amp;gt;";
const static char http_index_data_html[] = "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;cell1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell2&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell4&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell5&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
const static char http_index_end_html[] = "&amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";
&lt;/P&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i think that should be a harmless change - but the webserver isn't responding any longer. i captured the whole traffic with wireshark. there are problems with TCP fragement overlaps. (wireshark capture attached)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the interesting part: it is working, as soon as i call netconn_write really often:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t i;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=0; i&amp;lt;100; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;another workaround is, to enabled TCP_NO_DELAY:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn-&amp;gt;pcb.tcp-&amp;gt;flags |= TF_NODELAY;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is there anything, i made wrong? i think, that should work ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;additionally i found some possible other problems in that example code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configASSERT is not defined. defining it will produce some assertion errors. for example: the eth rx/tx tasks are started with priorities 5 and 6. but FreeRTOS config only allows 5 priorities. so the tasks will be running at the same priority (which is 4). the tcp ip thread is running with priority 3. but lwipopts.h says, tcp ip thread should run at higher priority than MAC threads ... chaning that, wont' change any to above errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;are there any suggestion, what should help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:24:16 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:24:16Z</dc:date>
    <item>
      <title>Problem with lwip/webserver_freertos</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-lwip-webserver-freertos/m-p/583350#M20828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alramlechner on Mon Aug 10 05:59:18 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i am using the LPC1768 webserver_freertos LPCOpen example. i am running into strange problems with an PC application connected via TCP to the MCU. because i spent hours of debugging and can't really find the problem, i tried to reproduce some similiar behavior with the original code. and that was quite easy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i just brought the webserver_freertos example (vanilla code) running and just modified the netconn_fs.c in the following way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;old code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;line 47:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;const static char http_index_html[] = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Congrats!&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Welcome to our lwIP HTTP server!&amp;lt;/h1&amp;gt;&lt;P&gt;This is a small test page, served by httpserver-netconn.&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";
&lt;/P&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;near line 135:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;modified to call netconn_write more often:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
const static char http_index_start_html[] = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Congrats!&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Welcome to our lwIP HTTP server!&amp;lt;/h1&amp;gt;&lt;P&gt;This is a small test page, served by httpserver-netconn.&amp;lt;table&amp;gt;";
const static char http_index_data_html[] = "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;cell1&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell2&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell3&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell4&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;cell5&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;";
const static char http_index_end_html[] = "&amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";
&lt;/P&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i think that should be a harmless change - but the webserver isn't responding any longer. i captured the whole traffic with wireshark. there are problems with TCP fragement overlaps. (wireshark capture attached)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the interesting part: it is working, as soon as i call netconn_write really often:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t i;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=0; i&amp;lt;100; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;another workaround is, to enabled TCP_NO_DELAY:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn-&amp;gt;pcb.tcp-&amp;gt;flags |= TF_NODELAY;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_start_html, sizeof(http_index_start_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_data_html, sizeof(http_index_data_html)-1, NETCONN_NOCOPY);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; netconn_write(conn, http_index_end_html, sizeof(http_index_end_html)-1, NETCONN_NOCOPY);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is there anything, i made wrong? i think, that should work ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;additionally i found some possible other problems in that example code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configASSERT is not defined. defining it will produce some assertion errors. for example: the eth rx/tx tasks are started with priorities 5 and 6. but FreeRTOS config only allows 5 priorities. so the tasks will be running at the same priority (which is 4). the tcp ip thread is running with priority 3. but lwipopts.h says, tcp ip thread should run at higher priority than MAC threads ... chaning that, wont' change any to above errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;are there any suggestion, what should help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:24:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-lwip-webserver-freertos/m-p/583350#M20828</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with lwip/webserver_freertos</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-lwip-webserver-freertos/m-p/583351#M20829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dariy on Mon Feb 01 08:55:12 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It would make sense if somebody was monitoring this forum because the software obviously has not been tested with these options. :( &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:24:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-lwip-webserver-freertos/m-p/583351#M20829</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:24:17Z</dc:date>
    </item>
  </channel>
</rss>

