what is the maximum speed of the STM32 USB CDC?

Mohammad picture Mohammad · May 31, 2017 · Viewed 12.2k times · Source

I'm using stm32L151 to communicate with PC by USB CDC. I used stm32 HAL libraries to create my project. I found that the usb sends data in 1ms intervals and each time, 64 bytes is being sent. So, is the maximum speed of the USB CDC is 64kbyte/s? and this speed is very lower than the USB full speed 12Mbit/second. How I can reach this speed? or at least a fraction of this speed? Thanks

Answer

Turbo J picture Turbo J · May 31, 2017

Nope. If your code is "fast enough", the maximum CDC speed is about 1MByte/sec. This may require a big (>1KB) FIFO on the device side. Oh, and the PC side must be able to read the data fast enough, e.g. with big buffers.

The 64KByte/s limit applies for USB HID which uses interrupt endpoints. USB CDC interface uses faster bulk endpoints.