I'm using an STM32L151 to communicate with a PC using USB CDC. I used the STM32 HAL libraries to create my project. I found that the USB sends data in 1 ms intervals, and each time 64 bytes are being sent. So, is the maximum speed of the USB CDC 64 kbyte/s? That is much lower than the USB Full Speed data rate of 12 Mbit/s. How can I reach this speed, or at least a fraction of this speed?
Some STM32 MCUs include two USB peripherals and support both OTG in FS and HS speeds.
USB communications device class (or USB CDC class) is a composite Universal Serial Bus device class. The communications device class is used for computer networking devices akin to a network card, providing an interface for transmitting Ethernet or ATM frames onto some physical media.
A subset of the USB Communication Device Class (CDC) can be used to emulate a serial port providing a virtual COM port UART interface. This allows developers to use legacy applications with new products using the same COM port interface as before, with few hardware and software modifications.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With