cancel
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 (

    0483:5740

    ) 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

Max

#usb #cdc #stm32-f3
2 REPLIES 2
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 

http://www.st.com/en/embedded-software/stm32-3rd-party-embedded-software.html?querycriteria=productId=LN1900

.

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:

http://pid.codes/

http://wiki.openmoko.org/wiki/USB_Product_IDs

 

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

Hello

cialdi

‌,

There is a composite example proposed under

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stsw-stm32html

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

Itcould befound under the path below:

STM32_USB-FS-Device_Lib_V4.1.0\Projects\Composite_Examples\

MSC_HID_Composite

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

Khouloud.