Hi Adrian,

Are you using RAW, netcon or Socket API ?


I think that you have set a too large window size for the mem size you have.

You should not send 32K blocks in one go. You need to send smaller block, say 
1K or 1.5K,

check available memory of send buffer and if available send another chunk of 
data.


If you work with RAW API you can and probably need to use the sent call-back to 
synchronize

when to send more data.


I suggest checking some examples and incorporate ideas from them.


Memory errors are normally happening when one does not follow the LwIP threading

requirements. If you are using RAW API and your module is the client 
(initiating the connection)

you probably are sending data from outside the LwIP context, you are not using 
it as it should be.


Hope that helps,

Noam.


________________________________
From: lwip-users <lwip-users-bounces+noam=silrd....@nongnu.org> on behalf of 
Adrian Figueroa <adrian.figue...@tu-dresden.de>
Sent: Friday, September 1, 2017 11:15 AM
To: lwip-users@nongnu.org
Subject: [lwip-users] ERR_MEM when sending large data, LWIP stats show no error


Hello all,



I am trying to send large amounts of data continuously. I use lwIP as a TCP 
client on an STM32F7 and Matlab on a PC as a TCP server.



I send blocks of 32768 bytes. Here are some settings for the memory sizes in 
lwIP:



#define MEM_ALIGNMENT 4

#define MEM_SIZE 17520

#define MEMP_NUM_TCP_SEG 65

#define PBUF_POOL_BUFSIZE 1516

#define TCP_WND 8760

#define TCP_MSS 1460

#define TCP_SND_BUF 8760



When sending with tcp_write(), I get ERR_MEM errors. So, I switched on 
LWIP_STATS for seeing memory statistics. When should I be using tcp_output()? 
Should I check for the remaining tcp_sndbuf and use tcp_output() if it gets low?



In Wireshark, I can see TCP Dup ACKs and “TCP Previous segment not captured” 
errors. Find the dump here:



https://sync.coda.pw/r/Z_uuIXRtl2#NT5OwZOSW4Nd8erfCRvLvSdAmMS1YODnWL3tP+dGRMk=



I send data every 2 seconds and it takes around 1.5 seconds to send it to the 
PC, which is too long.



Here are some of the results after ERR_MEM happened:

https://snip.coda.pw/?69c4627d150293fa#3cUX2gAqvAKaflXk8NTs7k+TxBAjQwmNT+IYu+GfiJE=



There is no Mem/Memp section that contains even one error. So, I am not sure 
where to look next.



Thank you in advance!

Adrian


_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to