STM32H7 and LWIP settings for 2 simultaneous connections.
Hello to everyone,
I found LWIP settings working fine with 2 ports open at the same time. I want to share with you. I am working with the NUCLEO-H753ZI board.
in addition to the manual here.
I shifted the Ethernet and LWIP buffers to addresses 0x30000000 and 0x30004000. I installed the MPU in two ram regions of 64K and 256B starting from 0x30000000 as follows.
I got most settings from LwIP_HTTP_Server_Netconn_RTOS app. I increased some values until it works stable.
I set MEMP_NUM_TCP_PCB to 10.
I set MEMP_NUM_UDP_PCB to 6.
Since it is not clear which setting will consume how much ram in the manuals, I set MEM_SIZE to 32768 bytes.
I set TCP_MSS to 1460 bytes.
I set PBUF_POOL_BUFSIZE to 1528 bytes.
I set TCP_WND and TCP_SND_BUF to 5840 bytes (4*TCP_MSS)
Cubemx set TCP_SND_QUEUELEN to 17 bytes.
I set MEMP_NUM_TCP_SEG to 24.
From advanced parameters;
I have enabled LWIP_TCPIP_TIMEOUT, LWIP_SO_SNDTIMEO, LWIP_SO_RCVTIMEO so that the ports can be closed if the connection is lost.
I know very little about LwIP. but with these settings, I can work from two different ports without losing packets.
I have written C# applications that query again for each port when the answer is received. In the scenario where I made a total of 5k queries per second from two applications, it worked for 2 days without any packet loss.
