I am having problems of simultaneous reading and writing to a TCP
socket with LwIP, FreeRTOS, AVR32 (EWK1100).
I know that lwip_write() and lwip_read() calls are not threadsafe and I have seen a lot of other forum
threads discussing this and the use semaphores of lwip_select(). - I do not think this is the problem here.
I have boiled down my program to only have one thread with one lwip_write() call and one delay of app. 1 msec. (Nolwip_read() call !). (See source code below.)
When I connect a terminal program from a PC, it will start receiving the messages. When sending a few messages (Just pressing ENTER) from the terminal program to the AVR32, it will make the transmission from the AVR pause for exactly 10 sec. - Then resume. this can be repeated a number of time whereafter transmission completely stops.
I have traced down the 10sec pause to be in api_lib.c, netconn_write(), sys_mbox_fetch(conn->mbox, NULL); call.
A WireShark recording is attached. The problem appear at time: 20.147 and again at 34.903.
I may be wrong since I know nothing on sockets on lwIP, but I think I
remember reading Simon saying you can't have two threads using the same
socket. (or at least that is what I think I see on how the post is
What I do know:
Following your capture file is hard; you provide a whole net capture
with no clue whatsoever on what to see.
Who is the sender ? The HewlettPackard MAC machine ?
Who is the device ? Is it behind the Cisco MAC router ?
Your application is what ? Sending "Hello" every 2ms ?
However, I managed to see the pause you talk about
Did you try a known-good application to check if your port and your
driver are working as they should ?
OK, now I see.
Well, you _should_ (read _must_) check your port and your driver.
Perhaps your simplest application can do, but you should try one of the
apps in the app subtree or in the contrib tree. Those have been tested
by many users.
I can't help you further, I'm nil on anything other than RAW API over