Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Best method to stream data from USB HS?

  1. #1
    Junior Member
    Join Date
    Feb 2021

    Best method to stream data from USB HS?

    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.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    There are several threads up here, that you can find by doing a search or google, about the T4.x USB speeds.
    Including like:
    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
    Teensy Source Code - Often times the best place to find some of the basics.

  3. #3
    Senior Member
    Join Date
    Feb 2018
    Corvallis, OR
    Quote Originally Posted by drwho9437 View Post

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts