I have a project where I need to reliably receive a lot of data on the ethernet port of a Teensy 4.1. Ideally I'd like to hit around 20 Mbit/s, not a lot on some scales but a lot for something like a teensy.
Since I need reliability I'm using TCP rather than UDP. Since I need high data rates I'm using a raw TCP socket stream rather than any higher level protocols.
I'm currently using the Teensy41_AsyncTCP library to handle the network layer. I and then using TeensyThreads.h to run separate threads that take the received network data and push it out on the FlexIO interface.
Logically my data is being sent in 1k packets from a PC application. As soon as the data rate becomes anything over a few kbytes/s the windows IP stack starts combining and fragmenting packets. My teensy code is handling this and recombining / splitting the network packets back into my logical packets as they arrive. This code all works correctly for moderate data rates.
However once I dial the data rate up to around 4 Mbits/s I start to see errors in the data that would imply that packets are getting lost. Exactly where/how I'm not entirely sure at this point.
I have a few tricks left up my sleave to try to improve this performance but don't have much hope for them making a huge difference.
Has anyone else tried to do something like this or have any ideas or tips on how to get more data through the network port? Even something along the lines of "Don't use that library, it's really slow, use this one instead." would be appreciated.
Since I need reliability I'm using TCP rather than UDP. Since I need high data rates I'm using a raw TCP socket stream rather than any higher level protocols.
I'm currently using the Teensy41_AsyncTCP library to handle the network layer. I and then using TeensyThreads.h to run separate threads that take the received network data and push it out on the FlexIO interface.
Logically my data is being sent in 1k packets from a PC application. As soon as the data rate becomes anything over a few kbytes/s the windows IP stack starts combining and fragmenting packets. My teensy code is handling this and recombining / splitting the network packets back into my logical packets as they arrive. This code all works correctly for moderate data rates.
However once I dial the data rate up to around 4 Mbits/s I start to see errors in the data that would imply that packets are getting lost. Exactly where/how I'm not entirely sure at this point.
I have a few tricks left up my sleave to try to improve this performance but don't have much hope for them making a huge difference.
Has anyone else tried to do something like this or have any ideas or tips on how to get more data through the network port? Even something along the lines of "Don't use that library, it's really slow, use this one instead." would be appreciated.