cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 USB composite MSD problem

original
Associate II
Posted on March 18, 2015 at 12:06

Hi,

I have  a product which works as a USB composite device (CDC + MSD). This same product was previously designed to work only as a MSD device, without composite functionality.

The device with composite funtionality has a different product ID as to when it was being previously used only as MSD.

For the composite functionality, the device parameters are,

Class EF, Subclass 02 and Device protocol 01.

The requirement is that this new device should atleast work as a Mss Storage Device even when no driver to use the COM port is installed, i.e, in case the user does not require the CDC class, he/she need not install the driver provided by us, as for MSD, it should simply use the usbstor driver provided by Windows.

The problem I am facing is that on most PC's (Windows 7, 64 bit), the device works without any problem but on some, Windows does not report that it encountered a problem and in the Device Manager list, the USB Mass Storage device is listed with a yellow ! mark, indicating it encountered a problem. The error code is 10. Even more interesting is that if the driver is updated once, it is properly recognised and works without problem, even when the driver is exactly the same as before.

The only difference I observed is the way the Hardware ID is listed. For the case where it has a problem, the Device ID is represented in the format /Vendor ID/Product ID.

After updating, it is listed as /Vendor ID/Product ID/Interface number.

So I suspect somehow Windows does not enumerate the Interface correctly.

Can anybody clarify if you have encountered similar problem or some idea in which direction I should investigate this issue further?

I am attaching the screenshots for both cases, i.e, before updating the driver and after.

Any kind of help will be highly appreciated.

Thanks.

#msc #usb #cdc #composite
2 REPLIES 2
tsuneo
Senior
Posted on March 19, 2015 at 16:56

> USB\VID_292F&PID_0002&MI_02

MI_02 of MSC (Mass Storage Class) interface suggests that the order of the descriptors is CDC first, and MSC the second.

Swap the order of interfaces, so that the MSC comes first.

In the order on the Config descriptor set, Windows parse the interfaces.

1) You have to renumber the interface numbers on the descriptors.

If you would apply the CDC descriptors macro in

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Multiple%20USB%20CDC%20%28USB%20IAD%%20How

, it's deadly easy work.

2) You may have the interface numbers in a couple of callbacks.

3) Also touch to the INF file for the CDC, at [DeviceList]

- USB\VID_292F&PID_0002&MI_00 ---> USB\VID_292F&PID_0002&MI_01

Tsuneo

original
Associate II
Posted on March 23, 2015 at 14:42

Hi Chinzei,

I actually expected you to reply on this topic as you seem to be the ''USB'' Guru.

The problem is now solved, but I have to admit, it was a very strange problem, and I am writing it here just in case somebody else stumbles upon it again.

This problem arises (in my case) due to a mismatch of bootloader(BL) and firmware(FW) USB configuration.

The bootloader before the Composite feature was by default set to a MSD device. But even in the FW, they use the same description file. The changes I made for the composite feature were (unknowingly) taken by the BL as well. Hence, the BL was reported as a Composite device, with MSD at interface 0. Windows registered this setting, in case it is plugged in in future.

When the device with the FW(Composite ON) was plugged in, Windows tried to look for the interface 0 as MSD, but couldn't find it there as its now configured as Interface 0&1 -> CDC IAD, interface 2->MSD. Hence it showed a Mass storage device with an error on it in Device Manager. Also, for the hardware ID, it showed the old registered configuration , hence USB\VID_292F&PID_0002. When you do a driver update, Windows is forced to enumerate this device from fresh, and then assigns the correct Interface number in hardware ID.

So, in the end , its not a problem of USB configuration, but actually just the way this is remembered in Windows! I have fixed the problem of same USB description file being used in BL and FW modes, and now it works as expected.

BTW, Chinzei, the link you posted here helped me a great lot in making the composite device. Thanks for that.

As a general side question, I did try using MSD at interface 0 and shifting the CDC IAD to interfaces 1&2. Doesn't work. Could it be because I have merged the MSD callback functions into the CDC functions?