Showing results for 
Search instead for 
Did you mean: 

some question about usb implementation for STM32F3

Posted on January 01, 2018 at 01:58

I have some questions about usb implementation (both hw and fw). My controller is STM32F373VC and I use STM32CubeF3 v1.9.0

  1. I would like to know if the usb device and fw support composite devices. I should provide both communication services to the device using CDC class and mass storage services using MSC class.
  2. For now I have only tried the CDC class (example copied from STM32373C_EVAL/Applications/USB_Device/CDC_Standalone/) and is correctly recognized by the system as a virtual com port. In particular:

    Bus 008 Device 009: ID 0483:5740 STMicroelectronics STM32F407

    I wondered if I could use the VID and PID for a product that are present in the example (


    ) or I have to change them. If I have to change them, are I obliged to request them from the usb consortium? or are they freely usable?
  3. The example taken from STM32373C_EVAL/Applications/USB_Device/CDC_Standalone/implements a usb-uart converter. Instead, I should communicate with the device itself and believe the host operating system to use a com port. Are there examples (also of other controllers) that do such a thing?

best regards


#usb #cdc #stm32-f3
Ben K
Senior III
Posted on January 03, 2018 at 09:39

1. The STM32_USB_Device_Library that is shipped with STM32CubeMX only supports one configuration and one interface, therefore it's not suitable for composite device implementation. This limitation doesn't apply to the hardware itself, and it has enough endpoints and packet memory to support your application needs. There are commercial USB device drivers that support multiple interfaces, you can check the list


2. The Vendor IDs are assigned by the USB Consortium, so for commercial use you either buy one, or find a partner with an appropriate licence who can allocate Product IDs for you. If you are developing an open-source device, you may use one of these services:


3. The CDC class is only complex in its descriptor, the actual data transfer is very straightforward: you can directly use USBD_LL_PrepareReceive() and USBD_LL_Transmit() functions to receive and transmit data through the VCP (packetizing is handled by the HAL, so you can call these with any length). Of course you should still rely on the CDC receive callback and TxState to determine if the previous transfer has completed.

Khouloud GARSI
Lead II
Posted on January 31, 2018 at 17:06




There is a composite example proposed under

.In the example, the independent interfaces are : Mass Storage (MSC) and Custom HID.

Itcould befound under the path below:



I'd highly recommend you to take it as a reference.