cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP code hang on TCP socket creation/connection

andy b
Senior

Posted on July 21, 2017 at 15:25

Hi

I am currently trying to communicated to a pc via a tcp socket.I am using LwIP and FreeRTOS on my discoveryF4 board. My problem is thta the code hangs on an assert when I try to use functions for socket creation/management but what is weird is that the assert on which the code is hung changes depending on where I call these functions.If I create a seperate thread for my tcp socket the code hangs when trying to execute the socket() function (which is used to create the socket)But if I try the same code but place it in a function and call that function from the defaul thread the code executes socket() with no problem but then hangs on an assert while trying to execute the connect() function.I have seen a similar problem on this forum on this post :

https://community.st.com/0D50X00009XkXXLSA3

 .The fix that is being suggested cannot work in my case since I only have ethernet enable as peripheral. 

Could it be that I'm running out of stack/heap ? Which would be surprising since im running 0x4000 of heap and 0x6000 of stack.I've tried changing the priority of my ethernet peripheral but that didn't work. 

Are there any LwIP configs I should look at ? Or perhaps this is an issue with FreeRTOS ?

Any help , suggestions,tips ,opinions are apreciated.

Have a wonderful day

-Andy

1 ACCEPTED SOLUTION

Accepted Solutions
andy b
Senior
Posted on July 21, 2017 at 18:52

UPDATE:

The problem was simply that my alloed stack for my task was too low (128) I increased it 300 and now the code is not hanging.Noob mistake but I haven't made such big task (concercing stack size) before.If you are having a similar problem make sure you verify your task's stack size !

-Andy

View solution in original post

1 REPLY 1
andy b
Senior
Posted on July 21, 2017 at 18:52

UPDATE:

The problem was simply that my alloed stack for my task was too low (128) I increased it 300 and now the code is not hanging.Noob mistake but I haven't made such big task (concercing stack size) before.If you are having a similar problem make sure you verify your task's stack size !

-Andy