Best method to stream data from USB HS?

drwho9437

New member
I often have applications where I need to send commands and receive data back from my target system. Out of some level of lazy simplicity I often just use CDC type serial stuff. A lot of microcontrollers just have USB FS and for a lot of uses that is enough.

However the 4.0 has USB HS, so my question is two fold.

First if you use CDC how much throughput can you get with the default firmware stack?

Second is there a better way? I know mass transfer classes exist but essentially I need in order data out and the ability to receive command data at any time.

If I need to write a custom class for this optimally I'd love to get some pointers about what to read before attempting that task.
 
There are several threads up here, that you can find by doing a search or google, about the T4.x USB speeds.
Including like: https://forum.pjrc.com/threads/60609-Maximum-Data-Rate-still-12-Mbit-sec-for-the-Teensy-4-0
Note: the CDC stuff does run at the 480mbit speed and as mentioned in the thread mentioned causes lots of issues for host software like terminal monitor.

And as mentioned in the thread a lot of the throughput depends on lots of things including what the host is doing, USB Hubs, cables...

As for the best interface? Not sure. For example RAWHID I believe still runs at the slower speeds. Probably not hard to create a version that runs at higher speed.
There is a version of MTP that we are playing with in the current beta Teensyduino,

Where to find more information:
USB documents - from USB.org
Teensy Source Code - Often times the best place to find some of the basics.
 
First if you use CDC how much throughput can you get with the default firmware stack?

Using the default Teensy Serial USB, I can send about 22MB/second to my PC data logger host app. Your host application has to be optimized for data transfer---the only screen output I use is a byte count about once per second. Other host screen output will slow things down significantly.

The actual file transfer rate depends on the T4.1 SD File characteristics (contiguous or non-contiguous, FAT32 or EXFAT, etc.). Multiple smaller files (2MB or less) transfer more slowly because of file open and close times, both on the T4.1 and PC.
 
Back
Top