cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F767 Ethernet at different rate

Al3
Associate II

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

14 REPLIES 14
Pavel A.
Evangelist III

Just before we begin: do you know about MTU and fragmentation? 

Hi Pavel, of course I know them

Pavel A.
Evangelist III

In normal mode (no jumbo packets) 6554 bytes will be fragmented , this requires buffering in LwIP. Can you use smaller packets? TCP or UDP? 

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?

Pavel A.
Evangelist III

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.

 

Sorry Pavel, what is a TX descriptors? Do you think that lwip return me memory error because of this kind of block?

Pavel A.
Evangelist III

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.

 

Al3
Associate II

Ok understood what TX are. Do you think it is a good solution increase their number? I attached the point of tcp_write function in tcp_out.c file where I get the error

Ok understood what TX are. Do you think it is a good solution increase their number? I attached the point of tcp_write function in tcp_out.c file where I get the error