2024-07-28 02:31 AM
Hi everyone. I'm using stm32f767zi board with lwip stack and I need to transmit at different rate through Ethernet: 50mbit/s, 80mbit/s and 100mbit/s. When I tried to send a buffer of 6554 byte every 1ms (in order to send 6553600 byte aka 50mbit every second) lwip give me memory error: I tried to change some of its parameters but the maximum rate I got was 27mbit/s. So anyone can help me and give me some tips to solve this problem
2024-07-28 03:12 AM
Just before we begin: do you know about MTU and fragmentation?
2024-07-28 03:14 AM
Hi Pavel, of course I know them
2024-07-28 03:18 AM
In normal mode (no jumbo packets) 6554 bytes will be fragmented , this requires buffering in LwIP. Can you use smaller packets? TCP or UDP?
2024-07-28 03:24 AM
I'm using TCP with an MTU of 1460 bytes, of course I can use smaller packets. How can I see if I send data at 50 Mbit/s?
2024-07-28 03:32 AM - edited 2024-07-28 03:37 AM
Capture sent packets with wireshark for some time, then calculate average per second?
Maybe you need more TX descriptors to send large fragmented packets. By default the driver has only 4 descriptors, so after fragmentation it makes more than 4 ETH packets. So LwIP will be blocked until at least 1 ETH packet is send and a TX descriptor becomes available.
After couple of fragments are sent, the receiving side may start ACK'ing, these packets must be received and handled. It can get complicated.
2024-07-28 03:47 AM
Sorry Pavel, what is a TX descriptors? Do you think that lwip return me memory error because of this kind of block?
2024-07-28 03:52 AM - edited 2024-07-28 03:55 AM
Not sure about specific LwIP error. Need to debug.
TX descriptors are like tags attached to L2 TX packets, they point to data buffers and hold some control info. Their number is hardcoded in the driver. Same about the RX descriptors. The bottom line is that the driver cannot queue more ETH packets for TX than the number of descriptors, even if you have enough memory for the data.
2024-07-28 04:14 AM
2024-07-28 04:15 AM