lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] TM4C1294 LWIP Usage


From: Noam weissman
Subject: Re: [lwip-users] TM4C1294 LWIP Usage
Date: Thu, 18 Dec 2014 09:42:40 +0200

Hi Lee,


Do you use FreeRTOS or any other OS or no OS ?


Working with LwIP in RAW mode is a bit tricky. You have just one thread
that run everything.

This is not so obvious at  first. Let me explain:
If you have a packet received in your receive call back and you try to
send something back it will not 
be sent until you get out of the function. Sending from within the
call-back means putting some data 
in the sent queue to be sent.

As LwIP in Raw mode has just one thread if you do not get out from your
call-back the TCP stack actually is
On hold. Only after you get out from the function and the TCP stack
resumes its house keeping your data 
will be sent.

Also if you send lots of data in a loop, inside one of the call-backs,
you may get out of memory. The reason is that 
In TCP the stack waits for an ACK from the remote end before freeing the
used buffer. If you are inside one of the
Call-backs and the LwIP does not run it will not process any ACK's and
as a result will not free used buffers .. so you
Get into memory limits ...

You must design your server in such a way that sending is in a separate
thread or do some scheduling.

I got into problems in my own code, similar to what I have explained
above. 
    I had a packet received -> called my parser -> my parser sent back a
reply. 

This does not work when you need to process large amount of data.

What I did is when I got a packet I sent a message to a parser task.
This message was pushed into a FIFO. After pushing
It to the FIFO the LwIP call-back function was exited. The parser
running in the background processed the data and if needed
sent back information. This separated the LwIP and other code.

Hope that helped a bit more.

BR,
Noam.
 

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Lee
Sent: Wednesday, December 17, 2014 11:52 PM
To: address@hidden
Subject: Re: [lwip-users] TM4C1294 LWIP Usage

I am using RAW mode and have read the rawapi.txt several times. I will
have another look at the echo server example but seem to stuck at the
moment at not being able to send data after obtaining a connection and
then when I hopefully have that example working, where do I place my
code to send data using pointers to my arrays. This has to be "in the
interrupt context"
somewhere so obviously not in main(). 



--
View this message in context:
http://lwip.100.n7.nabble.com/TM4C1294-LWIP-Usage-tp23623p23625.html
Sent from the lwip-users mailing list archive at Nabble.com.

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

 
 
************************************************************************
************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals &
computer viruses.
************************************************************************
************






************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer 
viruses.
************************************************************************************






reply via email to

[Prev in Thread] Current Thread [Next in Thread]