lpcware

lwIP configurations and crashes?

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by tjoAG on Mon Nov 19 03:18:29 MST 2012
Hi all

I'm using lwIP (latest stable) on a LPC1788 and FreeRTOS.
I'm using one single TCP connection to a PC server. Only one packet is send at a time. Using the Netconn API

I do have some difficulties getting the stack running flawless.

It is just a matter of time before something goes wrong and it stop receiving new data. Although the stack still runs. Packet are received but not delivered to the netconn API (?). It is connected to the cooperate network, so it receive at lot of data, that is not part of the actual TCP connection. But it still has to process them. I assume the packets send from the PC server are received (Server log and Wireshark say they are), but not received by the applications receive thread. Wireshark also has send the TCP/IP syn for that packet. But never arrives on the netconn receive call!!!

I also have some Hardfaults. This especially happens when I increase the LPC_NUM_BUFF_RXDESCS value. A value of 5 makes this happen very soon. But it also seen with smaller values. (seems not to be the case with LPC_NUM_BUFF_TXDESCS)

I have tried lower the LPC_NUM_BUFF_RXDESCS to 2 (Even though it is not allowed). It seems to work better then 3. But haven't have enough testing time to be sure.

Any suggestions how I can debug this? Something to try or change?
Better way using raw mode and supply the callback functions myself? (But would to much different then already done by Nettconn)

Attaches is the call stack with LPC_NUM_BUFF_RXDESCS 5 after the hardfault. The TCP connection on done and this happens short after.

The callstack seems strange. the vPacketReceiveTask is the FreeRTOS task that waits for packets from the ISR.
It then handles all packets with lpc_enetif_input function before it is ready to receive another packet.

How can this function be twice in the callstack just after each other? And way does the callstack start with the lpc_enetif_input that is only calles from the task? 
Is there some heap/stack memory corruption???

Any help is appreciated..

Thomas

Attachments

Outcomes