<?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のトピックLWIP receive incomming packages multiple times</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865026#M34492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running a LPC4357 on a OEM board from embeddedartists.com&lt;/P&gt;&lt;P&gt;I have a LWIP implementation based on LPCOpen where I receive commands from a client computer (LPC is server) and response some data to the client.&lt;/P&gt;&lt;P&gt;My Problem is now, that if my client send one command to the server, the server send the response two or more times.&lt;/P&gt;&lt;P&gt;The Wireshark screenshot shows the bevaviour: Client (@191) requenst some data (No. 86889) and the server (@10) responsed two times (No. 86890 and 86896).&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/72231i216F5A46AFD0E27A/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The strange thing is: This behaviour only happens if I'm using the debug mode or if the client is far away. If I build a release programm and the client is my Computer next to the server I have a perfect communication (1 command -&amp;gt; 1 response).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On my main loop i call a function processNetwork() where all the network stuff is done (code below), this is part of the LPCOpen examples.&lt;/P&gt;&lt;P&gt;I tried different call intervalls for this processNetwork() function (as soon as possible, 10ms, 100ms, 250ms) but without any solutions to that problem.&lt;/P&gt;&lt;P&gt;I also call tcp_recved() at the end of my tcp_received() function after I processed the incomming data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a reason of the different behaviours between Debug and Release builds I think the problem is any kind of timing issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be happy if you have any idea what the problem could be or in which direction i have to search for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;void processNetwork(void){
&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Handle packets as part of this loop, not in the IRQ handler */
&amp;nbsp;&amp;nbsp; &amp;nbsp;lpc_enetif_input(&amp;amp;lpc_netif);

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* lpc_rx_queue will re-qeueu receive buffers. This normally occurs
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; automatically, but in systems were memory is constrained, pbufs
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; may not always be able to get allocated, so this function can be
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; optionally enabled to re-queue receive buffers. */
#if 0
&amp;nbsp;&amp;nbsp; &amp;nbsp;while (lpc_rx_queue(&amp;amp;lpc_netif)) {}
#endif

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Free TX buffers that are done sending */
&amp;nbsp;&amp;nbsp; &amp;nbsp;lpc_tx_reclaim(&amp;amp;lpc_netif);

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* LWIP timers - ARP, DHCP, TCP, etc. */
&amp;nbsp;&amp;nbsp; &amp;nbsp;sys_check_timeouts();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Call the PHY status update state machine once in a while
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; to keep the link status up-to-date */
&amp;nbsp;&amp;nbsp; &amp;nbsp;physts = lpcPHYStsPoll();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Only check for connection state when the PHY status has changed */
&amp;nbsp;&amp;nbsp; &amp;nbsp;if (physts &amp;amp; PHY_LINK_CHANGED)
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;networkLinkChanged();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Print IP address info */
&amp;nbsp;&amp;nbsp; &amp;nbsp;if (ipPrinted == false) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (lpc_netif.ip_addr.addr) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;static char tmp_buff[16];
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("IP_ADDR&amp;nbsp;&amp;nbsp;&amp;nbsp; : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.ip_addr, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("NET_MASK&amp;nbsp;&amp;nbsp; : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.netmask, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("GATEWAY_IP : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.gw, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("HOSTNAME&amp;nbsp;&amp;nbsp; : %s\n\n",lpc_netif.hostname);
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ipPrinted = true;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2020 14:17:32 GMT</pubDate>
    <dc:creator>michaelschuehle</dc:creator>
    <dc:date>2020-11-02T14:17:32Z</dc:date>
    <item>
      <title>LWIP receive incomming packages multiple times</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865026#M34492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running a LPC4357 on a OEM board from embeddedartists.com&lt;/P&gt;&lt;P&gt;I have a LWIP implementation based on LPCOpen where I receive commands from a client computer (LPC is server) and response some data to the client.&lt;/P&gt;&lt;P&gt;My Problem is now, that if my client send one command to the server, the server send the response two or more times.&lt;/P&gt;&lt;P&gt;The Wireshark screenshot shows the bevaviour: Client (@191) requenst some data (No. 86889) and the server (@10) responsed two times (No. 86890 and 86896).&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;IMG alt="pastedImage_2.png" src="https://community.nxp.com/t5/image/serverpage/image-id/72231i216F5A46AFD0E27A/image-size/large?v=v2&amp;amp;px=999" title="pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The strange thing is: This behaviour only happens if I'm using the debug mode or if the client is far away. If I build a release programm and the client is my Computer next to the server I have a perfect communication (1 command -&amp;gt; 1 response).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On my main loop i call a function processNetwork() where all the network stuff is done (code below), this is part of the LPCOpen examples.&lt;/P&gt;&lt;P&gt;I tried different call intervalls for this processNetwork() function (as soon as possible, 10ms, 100ms, 250ms) but without any solutions to that problem.&lt;/P&gt;&lt;P&gt;I also call tcp_recved() at the end of my tcp_received() function after I processed the incomming data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a reason of the different behaviours between Debug and Release builds I think the problem is any kind of timing issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be happy if you have any idea what the problem could be or in which direction i have to search for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;void processNetwork(void){
&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Handle packets as part of this loop, not in the IRQ handler */
&amp;nbsp;&amp;nbsp; &amp;nbsp;lpc_enetif_input(&amp;amp;lpc_netif);

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* lpc_rx_queue will re-qeueu receive buffers. This normally occurs
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; automatically, but in systems were memory is constrained, pbufs
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; may not always be able to get allocated, so this function can be
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; optionally enabled to re-queue receive buffers. */
#if 0
&amp;nbsp;&amp;nbsp; &amp;nbsp;while (lpc_rx_queue(&amp;amp;lpc_netif)) {}
#endif

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Free TX buffers that are done sending */
&amp;nbsp;&amp;nbsp; &amp;nbsp;lpc_tx_reclaim(&amp;amp;lpc_netif);

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* LWIP timers - ARP, DHCP, TCP, etc. */
&amp;nbsp;&amp;nbsp; &amp;nbsp;sys_check_timeouts();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Call the PHY status update state machine once in a while
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; to keep the link status up-to-date */
&amp;nbsp;&amp;nbsp; &amp;nbsp;physts = lpcPHYStsPoll();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Only check for connection state when the PHY status has changed */
&amp;nbsp;&amp;nbsp; &amp;nbsp;if (physts &amp;amp; PHY_LINK_CHANGED)
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;networkLinkChanged();

&amp;nbsp;&amp;nbsp; &amp;nbsp;/* Print IP address info */
&amp;nbsp;&amp;nbsp; &amp;nbsp;if (ipPrinted == false) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (lpc_netif.ip_addr.addr) {
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;static char tmp_buff[16];
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("IP_ADDR&amp;nbsp;&amp;nbsp;&amp;nbsp; : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.ip_addr, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("NET_MASK&amp;nbsp;&amp;nbsp; : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.netmask, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("GATEWAY_IP : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &amp;amp;lpc_netif.gw, tmp_buff, 16));
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ETHERNETDEBUGOUT("HOSTNAME&amp;nbsp;&amp;nbsp; : %s\n\n",lpc_netif.hostname);
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ipPrinted = true;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}
&amp;nbsp;&amp;nbsp; &amp;nbsp;}
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:17:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865026#M34492</guid>
      <dc:creator>michaelschuehle</dc:creator>
      <dc:date>2020-11-02T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: LWIP receive incomming packages multiple times</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865027#M34493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is important to isolate the issue, could you try using only (without modifications) the webserver example from LPCOpen?&lt;/P&gt;&lt;P&gt;I want to know if there is a software or hardware issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sol&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2019 16:52:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865027#M34493</guid>
      <dc:creator>soledad</dc:creator>
      <dc:date>2019-03-01T16:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: LWIP receive incomming packages multiple times</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865028#M34494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sol,&lt;/P&gt;&lt;P&gt;the advice was good. I cross checked my code with the Echo example and found a memory leak.&lt;/P&gt;&lt;P&gt;I didn't free all received pbufs and thereby I received the package twice or more.&lt;/P&gt;&lt;P&gt;Thanks for the help / hint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2019 09:31:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LWIP-receive-incomming-packages-multiple-times/m-p/865028#M34494</guid>
      <dc:creator>michaelschuehle</dc:creator>
      <dc:date>2019-03-06T09:31:55Z</dc:date>
    </item>
  </channel>
</rss>

