FreeRTOS-LWIP fails to receive big data

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

FreeRTOS-LWIP fails to receive big data

跳至解决方案
635 次查看
jake111
Contributor I

I'm using MK64FN1M0VMD12,and read data from server by LWIP running on FreeRTOS.

LWIP version:2.2.0

FreeRTOS kernel version:10.2.0

The server sends data to client by TCP every one second.When the data transfers at the rate of about 100bps,it works well for a long time.

But a timeout occurs when the speed is larger than 200bps.At this moment,lwip_read will always timeout,and reconnecting TCP will always fail until you reboot the system.

Sometimes it can only receive 2000 bytes then a timeout occurs,but sometimes it can receive more than 100000 bytes then a timeout occurs.

the code is roughly like this:

socket = socket(AF_INET, SOCK_STREAM, 0);
connect(socket, (struct sockaddr *)&addr, sizeof(struct sockaddr));
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));

/* write to the server to request sending messages to client every second */
write(socket, buf, len);
/*  */
while(1)
{
	read(socket, buf, BUF_SIZE);
}

What is the most likely cause of the problem?

0 项奖励
回复
1 解答
581 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @jake111,

There could be a lot of causes for this timeout issue. Are you using a custom board or the evk for the MK64? Is this implementation yours, or are you utilizing an example? If it is, could you please try an example from the SDK and tell me if the problem is still present?

The lwip_enet_iperf3 example provides basic commands to measure performance of network stack. With this example, you can get an idea of how much throughput your device provides with your characteristics. Could you please test this and tell me how much throughput you get?

The timeout error could be caused by the physical connection of your circuits being damaged, so please take that into consideration aswell.

I hope you find this helpful!

Best regards, Julian

在原帖中查看解决方案

0 项奖励
回复
1 回复
582 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @jake111,

There could be a lot of causes for this timeout issue. Are you using a custom board or the evk for the MK64? Is this implementation yours, or are you utilizing an example? If it is, could you please try an example from the SDK and tell me if the problem is still present?

The lwip_enet_iperf3 example provides basic commands to measure performance of network stack. With this example, you can get an idea of how much throughput your device provides with your characteristics. Could you please test this and tell me how much throughput you get?

The timeout error could be caused by the physical connection of your circuits being damaged, so please take that into consideration aswell.

I hope you find this helpful!

Best regards, Julian

0 项奖励
回复