LWIP receive incomming packages multiple times

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LWIP receive incomming packages multiple times

ソリューションへジャンプ
1,201件の閲覧回数
michaelschuehle
Contributor II

Hello,

I'm running a LPC4357 on a OEM board from embeddedartists.com

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.

My Problem is now, that if my client send one command to the server, the server send the response two or more times.

The Wireshark screenshot shows the bevaviour: Client (@191) requenst some data (No. 86889) and the server (@10) responsed two times (No. 86890 and 86896).

pastedImage_2.png

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 -> 1 response).

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.

I tried different call intervalls for this processNetwork() function (as soon as possible, 10ms, 100ms, 250ms) but without any solutions to that problem.

I also call tcp_recved() at the end of my tcp_received() function after I processed the incomming data.

As a reason of the different behaviours between Debug and Release builds I think the problem is any kind of timing issue.

I would be happy if you have any idea what the problem could be or in which direction i have to search for.

Kind regards,

Michael

void processNetwork(void){
    /* Handle packets as part of this loop, not in the IRQ handler */
    lpc_enetif_input(&lpc_netif);

    /* lpc_rx_queue will re-qeueu receive buffers. This normally occurs
       automatically, but in systems were memory is constrained, pbufs
       may not always be able to get allocated, so this function can be
       optionally enabled to re-queue receive buffers. */
#if 0
    while (lpc_rx_queue(&lpc_netif)) {}
#endif

    /* Free TX buffers that are done sending */
    lpc_tx_reclaim(&lpc_netif);

    /* LWIP timers - ARP, DHCP, TCP, etc. */
    sys_check_timeouts();

    /* Call the PHY status update state machine once in a while
       to keep the link status up-to-date */
    physts = lpcPHYStsPoll();

    /* Only check for connection state when the PHY status has changed */
    if (physts & PHY_LINK_CHANGED)
        networkLinkChanged();

    /* Print IP address info */
    if (ipPrinted == false) {
        if (lpc_netif.ip_addr.addr) {
            static char tmp_buff[16];
            ETHERNETDEBUGOUT("IP_ADDR    : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &lpc_netif.ip_addr, tmp_buff, 16));
            ETHERNETDEBUGOUT("NET_MASK   : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &lpc_netif.netmask, tmp_buff, 16));
            ETHERNETDEBUGOUT("GATEWAY_IP : %s\n", ipaddr_ntoa_r((const ip_addr_t *) &lpc_netif.gw, tmp_buff, 16));
            ETHERNETDEBUGOUT("HOSTNAME   : %s\n\n",lpc_netif.hostname);
            ipPrinted = true;
        }
    }
}
ラベル(2)
0 件の賞賛
返信
1 解決策
1,031件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi, 

There is important to isolate the issue, could you try using only (without modifications) the webserver example from LPCOpen?

I want to know if there is a software or hardware issue. 

Regards 

Sol 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,031件の閲覧回数
michaelschuehle
Contributor II

Hi Sol,

the advice was good. I cross checked my code with the Echo example and found a memory leak.

I didn't free all received pbufs and thereby I received the package twice or more.

Thanks for the help / hint.

Best regards

Michael

0 件の賞賛
返信
1,032件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi, 

There is important to isolate the issue, could you try using only (without modifications) the webserver example from LPCOpen?

I want to know if there is a software or hardware issue. 

Regards 

Sol 

0 件の賞賛
返信