Hello everybody,
I habe the same problem with the webserver demo application.
Do I need to change the chip manufacturer, or is there a solution?
Best Regards,
Mario
Hi greg and Mario,
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
Hi Carlos,
thank you for the workaround. First I want to say, I'm working on a LPCpresso 1769 Board.
I changed the value of TCP_MSL to 100, as recommended. I put
<meta http-equiv=\"refresh\" content=\"1\" > in the head-tag to reload the site every second. After a little while I end up in the
Hard_fault_Handler.
The "vecthpc" Register shows the following status:
Faults = IBusErr
Fault PC = 0x10008000
= No symbol matches 0x10008000.
= No line number information available for address 0x10008000
Fault status registers:
IPSR = 0x1000003: 3 (HardFault)
CFSR = 00000100 (Configurable Fault Status Register)
HFSR = 40000000 (Hard Fault Status Register)
DFSR = 00000000 (Debug Fault Status Register)
MMAR = e000edf8 [INVALID] (MemManage Fault Address Register)
BFAR = e000edf8 [INVALID] (Bus Fault Address Register)
AFSR = 00000000 (Auxiliary Fault Status Register)
Stacked registers:
R0 = 00000004
R1 = 0000007b
R2 = 00000004
R3 = 10008000
R12 = 10001df4
LR = 0000ced9
PC = 10008000
PSR = 00000000
SP = 10001638
Could you please give me an advice to resolve this issue?
Best Regards
Mario
Hi Mario,
Are you using the unmodified webserver project? You could extend your hardFault handler to get more information about the MCU state before it happens:
https://community.nxp.com/message/630605
Best Regards!
Carlos Mendoza
Technical Support Engineer
Hi Carlos,
I have the same issue: The completely unchanged weberver example code stops after ca. 100 requests with a hard fault. This is also true for the webserver_freetos example. Please try it yourself!
Your proposed "fix" above does not change anything for me.
To build the exampels I used your latest and greatest MCU Expresso IDE and the OM13085 Dev Kit from embedded artists as atervtised on your web site.
Frustrating if even the most basic examples code crashes right out of the box after light usage. :smileysad:
Some examples do not even compile in a Mac environment as they use in #include statements the non standard folder delimiter \ (instead of /) that only seems to work on PC environments.
So any solution or any activity / willingness to fix your obviously broken example code that comes along with your dev kits?
Best regards,
Robert
Hi everyone,
Is there any update for this thread?
The problem still occurs and has not been fixed for more than a year.
I'm able to reproduce the last issue, even with the latest lwip 2.0.2 and LPCOpen v2.10.
I know that there is an option such Keil, but I am glued to LPCXpresso using macOS because Keil is generally for MS Windows (virtualization is not an option for me).
Has anyone tried to port FreeRTOS-Plus network services, especially a web server, to LPC1788?
I would be very grateful if any of you would give me an access to such resources.
Thank you,
Greg
#include <stdint.h> #include <string.h> #include "lpc_types.h" #include "FreeRTOS.h" #define mem_free vPortFree #define mem_malloc pvPortMalloc STATIC INLINE void *pvPortCalloc(size_t nmemb, size_t size) { void *x = mem_malloc(nmemb * size); if (x != NULL) memset(x, 0, nmemb * size); return x; } #define mem_calloc pvPortCalloc |
/* FreeRTOS malloc fail hook */ void vApplicationMallocFailedHook(void) { DEBUGOUT("DIE:ERROR:FreeRTOS: Malloc Failure!\r\n"); //FIXME: Comment out the following two statements so this function will // return. This allows the lwip stack to recover from out of heap // errors. //taskDISABLE_INTERRUPTS(); //for (;; ) {} } |