Hi,
I'm trying to use webserver_freertos example from LPCOpen_v2.10, but after some requests firmware is landing into HardFault Handler.
After searching the internet for answer, I've encountered solution about placing descriptors and buffers into peripherial memory. Could someone tell me where these buffers are located in the source code? I've checked .map (using LPCXpresso IDE) file searching for and found a line that states that whole struct is at proper place:
COMMON 0x20000868 0xb4 ./lwip/src/arch/lpc17xx_40xx_emac.o
0x20000868 lpc_enetdata
I'm not entirely sure that this is the cause of the problem. If someone was struggling with packet drop due to insufficient memory with LWIP followed by HardFault, any advice is welcome.
Regards
Hi Krzysztof,
We found a workaround to resolve this issue in the webserver project, the suggested workaround is this:
In the tcp_impl.h file change the definition of TCP_MSL to the following:
#define TCP_MSL 100 //1000 //60000UL /* The maximum segment lifetime in milliseconds */
It means the memory is freed more quickly when closing connection.
I tried the value 100 and 1000 on lpcopen webserver example on lpc1788 and it can work.
We analyze the cause should be that when TCP connection is closed, the PCB is not released in time due to the long (120s) time waiting. This cause the PCB created more and more so that memory leaks due to the limited memory of MCU (SRAM).
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer