5 years, 4 months ago.

Multi client server limitation on LPC1768

I have developed a firmware for a custom board. The system act as a TCP/IP server, and one client can connect and send request (mainly settings read/write) using a custom protocol. I'm using mbed-rtos and EthernetInterface (and relative sockets). The client asked a modification so multiple clients can connect to the system. We agreed to allow a maximum of 4 client simultaneusly connected to the system. I've implemented the modifications, creating a thread for each client and muxes to avoid concurrent accesses. I've faced a resource (memory) problems connecting just 2 clients. Either the threads couldn't be created or the listening thread didn't have enough memory for the accept() routine. I've tweaked here and there, using custom stack sizes for the threads, moving some declarations to heap (malloc/new), and so on. I've alsoo noticed that I could shrink the stack size of threads by using CMSIS RTOS's osThreadDef_t (and relative functions) instead of the classic Thread type. Now I can have 3 clients connected. I think I'm almost there for having the fourth, too.

Any preliminary/generic suggestion?

I've read (web and .ld file) that the 64k RAM is split this way: - 32k generic - 16k USB - 16k Ethernet I'm not using USB, so it can be an idea to give 8k of RAM each to the other two "sectors". How can I do that?

Notice that I've already modified the MEMP_NUM_NETCONN define, that by default is set to 4, but actually allows only 3 connections (see this: https://os.mbed.com/questions/1492/Cant-get-more-than-3-active-TCP-connecti/ )

I can share some code, but I prefer to hear some first impressions first.

Thanks!

Be the first to answer this question.