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
chen
Associate II
Posted on May 12, 2014 at 13:53

Hi

My understanding is :

USB VID - Vendor Idnetifier

USB PID - Product Identifier

Both are defined in usbd_desc.c

You cannot just changes these Ids to what ever you like!

The

''#define USBD_PID                        0x5740''

is ST registered device ID for their implementation of a CDC device.

It should result in Windows looking for the ST driver for a CDC device.

ST have 'wrapped' the standard default Windows USB CDC driver.

mastykin
Associate II
Posted on May 12, 2014 at 14:50

Hi,

I was able to use device with my inf-file (with corrected VID/PID). I was able to do it with both 0x5740 and a modified PID. I forced driver update for the USB Composite Device (that is my board), and using ''Have Disk...'' have chosen inf-file. SetupAPI now can enumerate devices.

So one question remains, how to modify library so that device represented in Device manager not a Composite Device plus 2 x Other Devices, but only one Other Device.
chen
Associate II
Posted on May 12, 2014 at 15:08

''So one question remains, how to modify library so that device represented in Device manager not a Composite Device plus 2 x Other Devices, but only one Other Device.''

You question does not make sense to me.

The PID 0x5740 is the identifier for a serial device.

A composite device will have a totally different PID.

The way enumeration works for a composite device is different to a non-composite device. (Composite device has to enumerate the other devices encapsulated by the 'composite device ID')

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

> A composite device will have a totally different PID.

>

Sorry, but in this case all 3 items in device manager have the same PID. Other Devices in addition have MI_00 and MI_01 suffix.

>> So one question remains, how to modify library so that device represented in Device manager not a Composite Device plus 2 x Other Devices, but only one Other Device.''

>>

> You question does not make sense to me.

>

May be because you have not seen other CDC-ACM devices that simply appear as a single device even without driver installed.

chen
Associate II
Posted on May 12, 2014 at 15:37

''May be because you have not seen other CDC-ACM devices that simply appear as a single device''

No, I have not seen any CDC-ACM device before.

What I do not understand - 0x5740 is a simple CDC class and should ONLY enumerate as a virtual serial port NOT a composite device.

I cannot work out where the composite device has come from.

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

You have 2 interface descriptors in your usbd_cdc_core.c file. One for AT commands of ACM (interrupt usb transfers) and other for the information rx/tx transfers (bulk usb transfers). When driver isn't installed, system see each interface as separate device. You can try to delete CIC (communication ineface class) and all related code from the source (in case you don't need to control GET/SET_LINE_CODING). Or you may also have some experiments with *.inf  file - 

;------------------------------------------------------------------------------

;  Device list

;------------------------------------------------------------------------------

[DeviceList]

%DESCRIPTION1% = STM32CDCCMP, USBÂ¥VID_FF02&PID_0001&MI_00

[DeviceList.ntamd64]

%DESCRIPTION1% = STM32CDCCMP, USBÂ¥VID_FF02&PID_0001&MI_00

I don't know exactly what to do, but I think, you can move in such directions.

Anthony

mastykin
Associate II
Posted on May 12, 2014 at 16:28

Thank you! In my LPC (NXP's ARM) project I had 2 interfaces but only one device. Descriptors are identical with current one, that's why I think the problem is in library. I'm going to check, may be the problem is in example

http://we.easyelectronics.ru/STM32/stm32-organizaciya-virtualnogo-com-porta.html

I'll try to find another one.
tsuneo
Senior
antony
Associate II
Posted on May 12, 2014 at 23:34

Good luck for you! And can you tell about result of your check? Because I'm still using a driver from ST with modified *.inf file.