TCP server infinite blocking

iamtherealeimer wrote on Thursday, July 14, 2016:

Hi,

I am currently trying to implement the TCP server example from the labs demo onto my stm32f429_eval board.
So far I am able to compile the project with armcc (Keil).

I just encounter a problem, my prvConnectionListeningTask, respectively the FreeRTOS_accept never unblocks or should I say, it waits forever for the event. I tried the echotool to trigger the event, but the it returns “Can not connect to server”.

I have the same problem when I try to ping the device.

A hint where the unblocking event is generated would be highly appreciated. Or any other ideas that direct me in the right direction.

I gladly provide more details if need be.

Thanks.

rtel wrote on Thursday, July 14, 2016:

First question - as we don’t have one in the download ourselves - have
you implemented the pack_struct_start.h and pack_struct_end.h header
files for the Keil environment? This is very important and, if wrong,
could result in some protocols appearing to work (like the ICMP pings)
while others do not.

iamtherealeimer wrote on Thursday, July 14, 2016:

Hi Richard,

yes, I did implement my own.

_start.h

__packed

_end.h:

;

see
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124980173.htm
and
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124230944.htm

I am sorry, I messed up the ping. I obviously pinged another device in the network.

sbrauss wrote on Thursday, July 14, 2016:

Hi!

I maybe faced the same bug, it took me a long time to find…
The priority of the task running your TCP server must be lower than the
priority of the Ethernet task.

Best regards,
Stephan

iamtherealeimer wrote on Friday, July 15, 2016:

Good morning Stephan,

Thank you for your hint, by ethernet task you mean the prvIPTask called from FreeRTOS_IPInit?

Best regards,

sbrauss wrote on Friday, July 15, 2016:

Good Morning Unknown

The constants in the stack and in the demo are
mainTCP_SERVER_TASK_PRIORITY and ipconfigIP_TASK_PRIORITY

Best regards,
Stephan

iamtherealeimer wrote on Friday, July 15, 2016:

Hi Stephan,

Am I right that I am missing the TCP server task, because I only want to use the echo server ? So I think I need to modify the mainECHO_SERVER_TASK_PRIORITY.

Even by using the defaults provided by the demo I am stuck in the prvConnectionListeningTask and the Echo server task is never created.

My priorities are:
/#define mainECHO_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) = 2
/#define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U )

/#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) = 5
/#define configMAX_PRIORITIES (7)

Best regards,
Fabian

rtel wrote on Friday, July 15, 2016:

You are right, the “server work task” is not needed for the echo server
example, only examples that have state such as the FTP, HTTP and Telnet
servers.

So I can get it clear in my mind some questions:

I am currently trying to implement the TCP server example from the
labs demo onto my stm32f429_eval board.

Did you start with the code from this demo?

http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP-IP_FAT_Examples_ST_STM32F407.html

So far I am able to compile the project with armcc (Keil).

So it is clear you ported the demo to Keil. Did you make any other
changes? For example, take tasks out, or add new tasks, or change any
FreeRTOSConfig/FreeRTOSIPConfig.h settings?

If you built the original project with the [free] Atollic tools, did it
work then? Maybe it would be good to get that working before porting to
Keil.

my prvConnectionListeningTask, respectively the FreeRTOS_accept never
unblocks

Is this function in
\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_TCP_Demos\SimpleTCPEchoServer.c

sbrauss wrote on Friday, July 15, 2016:

Hi Fabian

no, you don’t need FreeRTOS_TCP_server.c for the Echo server in
SimpleTCPEchoServer.c.
prvConnectionListeningTask() (and better also
prvServerConnectionInstance()) must run at a lower priority than
ipconfigIP_TASK_PRIORITY.

Best regards,
Stephan

iamtherealeimer wrote on Friday, July 15, 2016:

I am not sure, I didn’t compare the sources but I used this demo:
FreeRTOS_Labs_160112\FreeRTOS-Plus\Demo\FreeRTOS_Plus_TCP_and_FAT_STM32F4xxx
from the FreeRTOSLabs.

I concensed the main to fit my needs ands also skip some initializion I am already doing in a startup task.

I zipped all the modification and used files in the attachment. I believe this compiles.

I will try the attolic approach and go from there. I suspect also some issues with my network configuration. But I can see a Broadcast of the device announcing its ip. Not the server ip obviously.

Edit:
In mz edited code I didn’t activate the ETH_IRQn so abviously I can’t get an event. Nonetheless, after enabling the interrupt the according IRQ handler calls the eth error callback because the ais flag is set. I think the NetworkInterface / DMA is not configured right. The example ist for a f409 and i am using an f429.

Best Regards,
Fabian