cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC, composite device, Windows SetupAPI

mastykin
Associate II
Posted on May 12, 2014 at 12:15

Hello,

I tried virtual COM port example on STM32 and used driver VCP_V1.3.1. I'm surprised that without pre-installing driver the device is found as a composite in Device Manager, and I cannot use the same inf file (attached) as for my old product, based on another ARM and represented a bundle of ACM and CDC interfaces.

My problems are:

1) It's not nice to include VCP installer in my own one. But it's a minor problem.

2) VCP_V1.3.1 device is not discoverable by SetupAPI interface (SetupDiEnumDeviceInterfaces() and others). In my old inf I added serenum.sys  for that. It's a bigger problem.

How can I modify firmware to support custom inf-file, or how can I modify driver to be compatible with SetupAPI?

Many thanks

Dmitry

#vcp #usb #stm32
15 REPLIES 15
antony
Associate II
Posted on May 12, 2014 at 23:40

Hi, Tsuneo! 

I've read a lot of your posts about USB-devices and it was very helpfull, thanks for it. 

May I ask you to help me? My problem is discribed in post: 

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fCDC%20Host%20for%20STM32F407&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy%2Es...

I'll be appriciate for any help.

Anthony

mastykin
Associate II
Posted on May 13, 2014 at 10:37

Dear Tsuneo,

Thank you for taking part in the discussion!

I don't need to create a composite device. Surprisingly the STM32 VCP without installed drivers is seen as a ''Composite Device'' in Device Manager (and additionally 2 interfaces also are seen in Device Manager as ''Other Devices''). I need that the device behaves the same way as my old device based on LPCUSB VCP.

I would send a log from USBlyzer to compare, but LPCUSB device doesn't generate a log without drivers installed.

mastykin
Associate II
Posted on May 13, 2014 at 10:40

Mard's example

http://mcu.cz/comment-n2800.html

behaves the same way.

mastykin
Associate II
Posted on May 13, 2014 at 11:46

We succeeded to use own inf instead of ST driver by adding IAD - interface association descriptor:

USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END =

  {

    0x12,                       /*bLength */

    USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/

    0x00,                       /*bcdUSB */

    0x02,

    0xEF, //0x00,                       /*bDeviceClass*/

    0x02, //0x00,                       /*bDeviceSubClass*/

    0x01, //0x00,                       /*bDeviceProtocol*/

...............

and then

usbd_cdc_CfgDesc[USB_CDC_CONFIG_DESC_SIZ+8]  __ALIGN_END =

{

  /*Configuration Descriptor*/

  0x09,   /* bLength: Configuration Descriptor size */

  USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */

  USB_CDC_CONFIG_DESC_SIZ+8,                /* wTotalLength:no of returned bytes */

  0x00,

  0x02,   /* bNumInterfaces: 2 interface */

  0x01,   /* bConfigurationValue: Configuration value */

  0x00,   /* iConfiguration: Index of string descriptor describing the configuration */

  0xC0,   /* bmAttributes: self powered */

  0x32,   /* MaxPower 0 mA */

  0x08, // Number  Size of this descriptor in bytes. 

  0x0B, //  INTERFACE ASSOCIATION Descriptor

  0x00, // Interface number of the first interface that is associated with this function.

  0x02, // Number of contiguous interfaces that are associated with this function.

  0x02, // Class  Class code (assigned by USB-IF).

  0x02, // Subclass code (assigned by USB-IF).

  0x01, // Protocol  Protocol code (assigned by USB-IF).

  0x00, // Index of string descriptor describing this function.

...............

Then in inf I added &_MI00 after PID. Now inf file is accepted and 2 devices are in Device Manager: 1 x Composite and 1 x Port.

antony
Associate II
Posted on May 13, 2014 at 16:07

Thanks for information. Good idea, my congradulations =) 

mastykin
Associate II
Posted on May 15, 2014 at 09:04

Tsuneo was right, suggesting to read Multiple USB CDC (USB IAD). How?

I'm bookmarking it, very useful, thanks again!!