|
From: | praveenkumar raavi |
Subject: | [lwip-users] Need support on TCP/IP packet transmission |
Date: | Thu, 13 Feb 2020 09:54:55 +0530 |
Hi Everyone,
we are using LWIP 2.0.3 for one of our project to establish
the TCP connection from ECU and Atmel micro.
We got the LWIP from Atmel itself and I have modified little to support VLAN
data receive and transmit.
But now we are seeing some issue during data transmission.
When the ECU goes to sleep, it cut down the Ethernet link and when it wakes up
it will establish the Ethernet connection.
But here when the ECU wakes up the communication is not going well from our
LWIP stack. We are seeing multiple re transmissions which are causing issues in
data transmission.
So we planned to reinitialize
the LWIP stack after ECU goes to sleep.
But when I do shut down the connection, the connection is not closing as there
is no FIN request response from ECU and its getting stuck in tcp_slow timer.
Also I have seen new behavior like when i received new frame on TCP, I am
trying to ACK back using ACK now function(pcb->prio = TCP_PRIO_MAX; tcp_send_empty_ack(pcb); tcp_output(pcb);), but I am seeing the ACK packet
transmitted after my data packet is been transferred.
This I didn't understand like why the ACK packet is transferred after data
packet? this is also one of the reason for us to see communication failure.
I am attaching the images for
our communication issues.
Here LWIP_IP: 192.168.6.182
ECU IP : 192.168.6.144
If you see LWIP_TCP_DataSentoutFirst.JPG, the data is send first and ACK is
sent after that even though the ACK transmission is initiated first with
priority level set to MAX.
Please let us know how to solve this issue.
I am adding following steps during lwip init.
TCPIP_STACK_INTERFACE_0_init(st_ETH_ConfigStruct.u8_SourceMacAddress, Src_IP, gw);
netif_set_up(&TCPIP_STACK_INTERFACE_0_desc);
netif_set_default(&TCPIP_STACK_INTERFACE_0_desc);
mac_async_enable(&MACIF);
etharp_add_static_entry(&Dest_IP, (struct eth_addr *)&st_ETH_ConfigStruct.u8_DestMacAddress[0]);
pcb_tcp = tcp_new();
error = tcp_bind(pcb_tcp, &address, st_ETH_ConfigStruct.u16_SourcePortNum);
pcb_tcp = tcp_listen(pcb_tcp);
tcp_accept(pcb_tcp, Etherdo_connected);
After link established, below functions are used to do data transfer.
tcp_write(pcb_tcp,u8_DataBuff,u16_DataLen,TCP_WRITE_FLAG_MORE);
tcp_output(pcb_tcp));
This is how I initialized LWIP stack and transmitting data over ethernet. Here I have used static MAC address as we should connect to particular MAC address.
Regards,
PraveenKumar.
LWIP_TCP_DataSentoutFirst.JPG
Description: JPEG image
[Prev in Thread] | Current Thread | [Next in Thread] |