I am porting an old application to a new platform using FreeRTOS+lwIP. The problem is, the data rate of the new application is not nearly close to the old one. I'm talking about 200 kbps versus 8 Mbps.
I searched around for a solution but I suppose my application is very peculiar, because I didn't really find anything useful.
Essentially the application is made up by a few tasks: a business logic task, a TCP server (which receives most of the traffic) and 2 UDP servers used very rarely. The TCP server waits for new connections, receives some commands and passes them to the business logic task. The last of these commands is used to send a large buffer to the client (around 4 MB) generated by the business logic task.
Just like in the old application, I'm using the Berkeley socket like API (lwip_socket, lwip_send, lwip_recv, etc...). In particular, for sending the large buffer:
sent = lwip_send(cli_sock, (void*)buf, len, 0);
I've already tried some tweaks to increase the performance but I didn't manage to obtain a data rate higher than 200 kbps:
- Raised the Maximum Segment Size
- Compiled with -O3 and no debug option
In the following the specifications of the old and new platforms.
- Intel Cyclone 10 LP FPGA
- Intel Nios2 CPU
- DDR3 RAM
- MAC: Intel Triple Speed Ethernet MAC
- OS: uC-OS/II
- TCP/IP stack: Interniche Nichestack
- Microsemi SmartFusion2 FPGA
- ARM M3
- MAC: ARM MAC
- DDR3 RAM
- OS: FreeRTOS
TCP/IP stack: lwIP
- CPUs and RAMs are running at about the same frequencies of the old platform.
- Task priorities are the same as the old application.
- Both PHYs manage to negotiate
- When the TCP server task calls the lwip_send function, all the other tasks are waiting on some event, so the "tcpip_thread" task should be the only one to be scheduled, can you confirm that?
The only things I can think of now are some tweaks to implement in the "lwipopts.h" file or in the MAC driver, but I have no clue.
What do you think? What can I do to improve the data rate? Any suggestions? Or experience with sending large buffers?
Thank you very much,