Hello,
I am using lwip 1.41 on an STM32F4 with a DP83848 PHY, running under FreeRTOS 
8.1.2 . The driver I have taken from the new Stmcubex software, which generates 
code for lwip 1.41, and an older version of FreeRtos. I am having lwip appear 
to just stall, and am suspecting configuration problems are the cause of my 
issues, but I am having a hard time figuring out what exactly might be wrong.
I have an extremely simple setup with the tcp_ip task, running at priority 6, 
the EthIf task running at priority 5, and my own task that uses the socket 
layer running at priority 3.
After initializing lwip with the following..
    netif_set_addr(&netiface,&ipaddr,&netmask,&gateway);    
netif_add(&netiface, &ipaddr, &netmask, &gateway, NULL, &ethernetif_init, 
&tcpip_input);    netif_set_default(&netiface);    netif_set_up(&netiface);     
  Inside my task, I am creating a socket, binding, listening, accepting.. 
I then have a python script on my desktop that connects to the stm32f4 server, 
and starts sending 4 bytes, then receiving 2 bytes - forever.the server runs 
the following after it has accepted the connection  - Accepts 2 bytes, then 
accepts 2 more, then replies with 2 bytes.
    while(1)    {
            int count = 0;            char buff[4];
            printf("\r\n\r\n-----------------------\r\n\r\n");            
printf("--- REC1\n");
            count = recv(fd_new_client,(char*)buff,2,0);
            if (count != 2){                while(1) {  __NOP(); }            }
            printf("--- REC2\n");            count = 
recv(fd_new_client,(char*)buff,2,0);
            if (count != 2){                while(1) {  __NOP(); }            }
            char response[2] = {'o','k'};            printf("--- SEND\n");      
      int8_t sent = send(fd_new_client,response,2,0);
            if (sent != 2) {                while(1) { __NOP(); }            }  
  }
After anywhere from a few messages to a few thousand, the connection stalls, my 
20 second timeout on the PYTHON socket kicks in an that times out, and lwip 
keeps printing. Judging by the log, its stuck somewhere in the first 
recv(fd_new_client,(char*)buff,2,0); - I also have breakpoints set on my 
while(1) { __NOP(); } loops should the call return -1 or something. These are 
not getting hit.
tcp_output: snd_wnd 65044, cwnd 536, wnd 536, seg == NULL, ack 7931
to my serial connection window. This seems to go on indefinitely. I have pasted 
a debug log below with the following defines.

#define SOCKETS_DEBUG LWIP_DBG_ON#define API_LIB_DEBUG LWIP_DBG_ON#define 
MEMP_DEBUG LWIP_DBG_ON#define MEM_DEBUG  LWIP_DBG_ON#define RAW_DEBUG  
LWIP_DBG_ON#define TCP_INPUT_DEBUG LWIP_DBG_ON#define TCP_CWND_DEBUG LWIP_DBG_ON
any help as to where to start debugging what is breaking would be greatly 
appreciated - or indeed what settings configuration parameters might be the 
trouble.
Thanks,
Rob.

Here is the log of the last few messages up to the 277th where it 
stopped.....--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top 
while sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: congestion avoidance cwnd 
14735tcp_receive: ACK for 7049, unacked->seqno 7047:7049tcp_receive: removing 
7047:7049 from pcb->unackedtcp_output: snd_wnd 65390, cwnd 14735, wnd 14735, 
seg == NULL, ack 7049netconn_recv_data: received , len=536904428lwip_recvfrom: 
netconn_recv err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65390, cwnd 14735, wnd 14735, effwnd 2, seq 7049, 
ack 7049tcp_output: snd_wnd 65390, cwnd 14735, wnd 14735, effwnd 2, seq 7049, 
ack 7049, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: congestion avoidance cwnd 
14754tcp_receive: ACK for 7051, unacked->seqno 7049:7051tcp_receive: removing 
7049:7051 from pcb->unackedtcp_output: snd_wnd 65388, cwnd 14754, wnd 14754, 
seg == NULL, ack 7051netconn_recv_data: received , len=536904428lwip_recvfrom: 
netconn_recv err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65388, cwnd 14754, wnd 14754, effwnd 2, seq 7051, 
ack 7051tcp_output: snd_wnd 65388, cwnd 14754, wnd 14754, effwnd 2, seq 7051, 
ack 7051, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: congestion avoidance cwnd 
14773tcp_receive: ACK for 7053, unacked->seqno 7051:7053tcp_receive: removing 
7051:7053 from pcb->unackedtcp_output: snd_wnd 65386, cwnd 14773, wnd 14773, 
seg == NULL, ack 7053netconn_recv_data: received , len=536904428lwip_recvfrom: 
netconn_recv err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65386, cwnd 14773, wnd 14773, effwnd 2, seq 7053, 
ack 7053tcp_output: snd_wnd 65386, cwnd 14773, wnd 14773, effwnd 2, seq 7053, 
ack 7053, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=tcp_slowtmr: cwnd 536 ssthresh 7386tcp_output: snd_wnd 65386, 
cwnd 536, wnd 536, effwnd 2, seq 7053, ack 7053tcp_output: snd_wnd 65386, cwnd 
536, wnd 536, effwnd 2, seq 7053, ack 7053, i 0tcp_output: snd_wnd 65386, cwnd 
536, wnd 536, seg == NULL, ack 7053+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: 
flags -+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 1072tcp_receive: 
ACK for 7055, unacked->seqno 7053:7055tcp_receive: removing 7053:7055 from 
pcb->unackedtcp_output: snd_wnd 65384, cwnd 1072, wnd 1072, seg == NULL, ack 
7055netconn_recv_data: received , len=536904428lwip_recvfrom: netconn_recv 
err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65384, cwnd 1072, wnd 1072, effwnd 2, seq 7055, 
ack 7055tcp_output: snd_wnd 65384, cwnd 1072, wnd 1072, effwnd 2, seq 7055, ack 
7055, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 1608tcp_receive: ACK 
for 7057, unacked->seqno 7055:7057tcp_receive: removing 7055:7057 from 
pcb->unackedtcp_output: snd_wnd 65382, cwnd 1608, wnd 1608, seg == NULL, ack 
7057netconn_recv_data: received , len=536904428lwip_recvfrom: netconn_recv 
err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65382, cwnd 1608, wnd 1608, effwnd 2, seq 7057, 
ack 7057tcp_output: snd_wnd 65382, cwnd 1608, wnd 1608, effwnd 2, seq 7057, ack 
7057, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 2144tcp_receive: ACK 
for 7059, unacked->seqno 7057:7059tcp_receive: removing 7057:7059 from 
pcb->unackedtcp_output: snd_wnd 65380, cwnd 2144, wnd 2144, seg == NULL, ack 
7059netconn_recv_data: received , len=536904428lwip_recvfrom: netconn_recv 
err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65380, cwnd 2144, wnd 2144, effwnd 2, seq 7059, 
ack 7059tcp_output: snd_wnd 65380, cwnd 2144, wnd 2144, effwnd 2, seq 7059, ack 
7059, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 2680tcp_receive: ACK 
for 7061, unacked->seqno 7059:7061tcp_receive: removing 7059:7061 from 
pcb->unackedtcp_output: snd_wnd 65378, cwnd 2680, wnd 2680, seg == NULL, ack 
7061netconn_recv_data: received , len=536904428lwip_recvfrom: netconn_recv 
err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65378, cwnd 2680, wnd 2680, effwnd 2, seq 7061, 
ack 7061tcp_output: snd_wnd 65378, cwnd 2680, wnd 2680, effwnd 2, seq 7061, ack 
7061, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=tcp_slowtmr: cwnd 536 ssthresh 1340tcp_output: snd_wnd 65378, 
cwnd 536, wnd 536, effwnd 2, seq 7061, ack 7061tcp_output: snd_wnd 65378, cwnd 
536, wnd 536, effwnd 2, seq 7061, ack 7061, i 0+-+-+-+-+-+-+-+-+-+-+-+-+-+- 
tcp_input: flags -+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 
1072tcp_receive: ACK for 7063, unacked->seqno 7061:7063tcp_receive: removing 
7061:7063 from pcb->unackedtcp_output: snd_wnd 65376, cwnd 1072, wnd 1072, seg 
== NULL, ack 7063netconn_recv_data: received , len=536904428lwip_recvfrom: 
netconn_recv err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65376, cwnd 1072, wnd 1072, effwnd 2, seq 7063, 
ack 7063tcp_output: snd_wnd 65376, cwnd 1072, wnd 1072, effwnd 2, seq 7063, ack 
7063, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 2719756760tcp_output: 
snd_wnd 65376, cwnd 1072, wnd 1072, seg == NULL, ack 
7063+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 2719756760tcp_output: 
snd_wnd 65376, cwnd 1072, wnd 1072, seg == NULL, ack 7063tcp_slowtmr: cwnd 536 
ssthresh 1072tcp_output: snd_wnd 65376, cwnd 536, wnd 536, effwnd 2, seq 7063, 
ack 7063tcp_output: snd_wnd 65376, cwnd 536, wnd 536, effwnd 2, seq 7063, ack 
7063, i 0+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: slow start cwnd 1072tcp_receive: ACK 
for 7065, unacked->seqno 7063:7065tcp_receive: removing 7063:7065 from 
pcb->unackedtcp_output: snd_wnd 65374, cwnd 1072, wnd 1072, seg == NULL, ack 
7065netconn_recv_data: received , len=536904428lwip_recvfrom: netconn_recv 
err=0, netbuf=lwip_recvfrom: buflen=4 len=2 off=0 
sock->lastoffset=0lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: lastdata now netbuf=--- REC2lwip_recvfrom(1, , 536872532, 
0x2, ..)lwip_recvfrom: top while sock->lastdata=lwip_recvfrom: buflen=4 len=2 
off=0 sock->lastoffset=2lwip_recvfrom(1): addr=192.168.1.64 port=34736 
len=2lwip_recvfrom: deleting netbuf=--- SENDlwip_send(1, data=, size=536872528, 
flags=0x2)tcp_output: snd_wnd 65374, cwnd 1072, wnd 1072, effwnd 2, seq 7065, 
ack 7065tcp_output: snd_wnd 65374, cwnd 1072, wnd 1072, effwnd 2, seq 7065, ack 
7065, i 0lwip_send(1) err=0 written=2

-----------------------
--- REC1lwip_recvfrom(1, , 536872532, 0x2, ..)lwip_recvfrom: top while 
sock->lastdata=+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 2719756764tcp_output: 
snd_wnd 65374, cwnd 1072, wnd 1072, seg == NULL, ack 
7065+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 2719756764tcp_output: 
snd_wnd 65374, cwnd 1072, wnd 1072, seg == NULL, ack 7065tcp_slowtmr: cwnd 536 
ssthresh 1072tcp_output: snd_wnd 65374, cwnd 536, wnd 536, effwnd 2, seq 7065, 
ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, effwnd 2, seq 7065, ack 
7065, i 0+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 2719756764tcp_output: 
snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 7065tcp_output: snd_wnd 
65374, cwnd 536, wnd 536, seg == NULL, ack 7065tcp_output: snd_wnd 65374, cwnd 
536, wnd 536, seg == NULL, ack 7065+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: 
flags -+-+-+-+-+-+-+-+-+-+-+-+-+-+tcp_receive: duplicate seqno 
2719756764tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_slowtmr: cwnd 536 ssthresh 1072tcp_output: snd_wnd 65374, cwnd 536, wnd 
536, effwnd 2, seq 7065, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
effwnd 2, seq 7065, ack 7065, i 0tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
seg == NULL, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, 
ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_slowtmr: cwnd 536 ssthresh 1072tcp_output: snd_wnd 65374, cwnd 536, wnd 
536, effwnd 2, seq 7065, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
effwnd 2, seq 7065, ack 7065, i 0tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
seg == NULL, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, 
ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_slowtmr: cwnd 536 ssthresh 1072tcp_output: snd_wnd 65374, cwnd 536, wnd 
536, effwnd 2, seq 7065, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
effwnd 2, seq 7065, ack 7065, i 0tcp_output: snd_wnd 65374, cwnd 536, wnd 536, 
seg == NULL, ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, 
ack 7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 
7065tcp_output: snd_wnd 65374, cwnd 536, wnd 536, seg == NULL, ack 7065
.... ad infinitum ....

                                          
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to