heinbali01 wrote on Monday, July 04, 2016:
[ please do not include the entire text when replying to a message ]
I then included SimpleTCPEchoServer.c into the project to test the
socket interface. My system crashes as soon as I open the echo port by
my linux machine (“telnet 192.168.200.169 7”). I thought that I maybe
get out of memory, but I have >5K left, at least before the crash…
5K doesn’t sound like a lot of memory. The cost of creating a TCP socket depends partly on the config settings. Especially the buffer sizes are important:
/* Define the size of Rx buffer for TCP sockets */
#define ipconfigTCP_RX_BUF_LEN ( 5840 )
/* Define the size of Tx buffer for TCP sockets */
#define ipconfigTCP_TX_BUF_LEN ( 5840 )
In the above case, when communication starts, more than 5KB of buffer space will be allocated in either direction. Give them a smaller size, e.g. 2880.
You might consider using the cheaper option:
/* USE_TCP_WIN: Let TCP use windowing mechanism. */
#define ipconfigUSE_TCP_WIN ( 0 )
And if you do use sliding TCP windows, you can decrease the value of:
#define ipconfigTCP_WIN_SEG_COUNT 256
E.g. make it 16 to allow for 16 simultaneous TCP connections.
But even if you run out of dynamic memory, the IP-task will not crash (at least I haven’t seen it happening).
Stack size is 512bytes, so the same as in the demos.
Do you mean 512 words in stead of bytes?
Are you testing from a debugger? Do you have configASSERT()
defined and also:
#define configCHECK_FOR_STACK_OVERFLOW 2
?
Stack overflows, of course, will lead to a crash. Even when CHECK_FOR_STACK_OVERFLOW
is defined, a crash may still occur.
Have you tried running the application with e.g. :
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( 1024 )
The IP-task uses a lot less stack but it can be useful as a quick test.
How much RAM do you have available, 64 or 96 KB?
Maybe you can post your config files (as an attachment please): both FreeRTOSConfig.h
and FreeRTOSIPConfig.h
?
As a ping works, my first thought was that the MAC and PHY layer works
fine.
That sounds logical. The higher levels will also work pretty soon