2025-11-10 10:49 AM
Hi,
I have a video application using F767 with LWIP and without RTOS. The custmized board has an SDRAM of 512MB. When receiving data, the pbuf.len is always 1460 bytes while the other side sends 40KB each time. Comparing to the data transfer rate can reach over 20Mbit/s, it's extremely slow in a video application, there must be fundamental issues in buffer configuration in my application.
The options in lwipopts.h that I think they would be relevant to the data transfer rate are:
#define MEM_ALIGNMENT 4
#define MEM_SIZE (30*1024)
#define MEMP_NUM_PBUF 25
#define MEMP_NUM_UDP_PCB 4
#define MEMP_NUM_TCP_PCB 4
#define MEMP_NUM_TCP_PCB_LISTEN 2
#define MEMP_NUM_TCP_SEG 150
#define MEMP_NUM_SYS_TIMEOUT 6
#define PBUF_POOL_SIZE 20
#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
#define LWIP_TCP 1
#define TCP_TTL 255
#define TCP_QUEUE_OOSEQ 0
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
#define TCP_SND_BUF (11*TCP_MSS)
#define TCP_SND_QUEUELEN (8* TCP_SND_BUF/TCP_MSS)
#define TCP_WND (20*TCP_MSS)
In stm32f7xx_hal_conf.h:
/* Definition of the Ethernet driver buffers size and count */
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
#define ETH_RXBUFNB ((uint32_t)5) /* 5 Rx buffers of size ETH_RX_BUF_SIZE */
#define ETH_TXBUFNB ((uint32_t)5) /* 5 Tx buffers of size ETH_TX_BUF_SIZE */
In stm32f7xx_hal_eth.h:
#define ETH_MAX_PACKET_SIZE ((uint32_t)1524U) /*!< ETH_HEADER + ETH_EXTRA + ETH_VLAN_TAG + ETH_MAX_ETH_PAYLOAD + ETH_CRC */
#define ETH_HEADER ((uint32_t)14U) /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */
#define ETH_CRC ((uint32_t)4U) /*!< Ethernet CRC */
#define ETH_EXTRA ((uint32_t)2U) /*!< Extra bytes in some cases */
#define ETH_VLAN_TAG ((uint32_t)4U) /*!< optional 802.1q VLAN Tag */
#define ETH_MIN_ETH_PAYLOAD ((uint32_t)46U) /*!< Minimum Ethernet payload size */
#define ETH_MAX_ETH_PAYLOAD ((uint32_t)1500U) /*!< Maximum Ethernet payload size */
#define ETH_JUMBO_FRAME_PAYLOAD ((uint32_t)9000U) /*!< Jumbo frame payload size */
Any suggestions would be highly appreciated.
Regards
Chao
2025-11-10 3:45 PM
Use wireshark to understand if there are retransmissions or other anomalies- and why.