Skip to main content
Matthias Dübon
Associate II
January 9, 2018
Solved

USB performance

  • January 9, 2018
  • 5 replies
  • 2109 views
Posted on January 09, 2018 at 11:35

Hello everyone,

I am on an STM32F103 and I am using USB to stream data from uC (USB device, USB ) to PC. The USB connection is a virtual COM Port the Driver is standard ST driver.

I am wondering about USB performance, I measure data rates (64 Byte USB buffer size) of around 100kBytes. That's far beyond the USB 2.0 specification but I am not sure if that's a hardware problem of the STM32F103 or is there some way to optimize that. Currently I am using interrupts for the communication from uC to USB would it be better to poll data from PC? Does anyone have information about the max data rate in such a 'interrupt' driven USB communication?

best regards

Matthias

    This topic has been closed for replies.
    Best answer by Pavel A.
    Posted on January 10, 2018 at 01:45

    If you do not need compatibility with certain software on the PC side (for example to be a COM port or storage or MTD) and the PC means a WIndows machine, you can roll your own simple protocol - just open a bulk pipe and pump large blocks. On Windows side, use WinUSB API to access the device. Make a special Windows specific descriptor to skip installation of any custom drivers. But this is still about 12 Mbits, maybe consider upgrade to a chip with a HS interface.

    - pa

    5 replies

    Pavel A.
    January 9, 2018
    Posted on January 09, 2018 at 13:05

    The CDC 'com port' is not the protocol for best performance. You want bulk transfers, large buffers (let the USB driver split it to EP size) and queue several transfers on the PC side. Also, check that your chip actually supports HIGH SPEED mode (HS). Even if it does, an external PHY is needed. Internal PHY supports only 'full speed' ~ 12 Mbit/sec. Nevertheless, 'full speed' devices are legally USB 2.0 compliant. Cheap manufacturers shamelessly sell 'full speed' devices with 'USB 2.0' labels, hinting that they are high speed. But they aren't.

    -- pa

    Matthias Dübon
    Associate II
    January 9, 2018
    Posted on January 09, 2018 at 21:42

    Thanks for the explanations. As far as I see my device is only FS so I am limited to 12 MBit/sec. But that would be ok for my use case. But do I got you right, you're recommending to use another USB CDC class? What exactly? Mass storage device class?

    Pavel A.
    Pavel A.Best answer
    January 10, 2018
    Posted on January 10, 2018 at 01:45

    If you do not need compatibility with certain software on the PC side (for example to be a COM port or storage or MTD) and the PC means a WIndows machine, you can roll your own simple protocol - just open a bulk pipe and pump large blocks. On Windows side, use WinUSB API to access the device. Make a special Windows specific descriptor to skip installation of any custom drivers. But this is still about 12 Mbits, maybe consider upgrade to a chip with a HS interface.

    - pa