cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 composite USB device

franck
Associate II
Posted on August 06, 2014 at 10:12

Hi,

I'd like to implement a composite USB device with MSC + a custom class. I'm using a STM32428I-EVAL board and some code generated by STMCube.

MSC alone is working (with bulk endpoint 0x82 and 0x02). When I add a new interface (a custom class, with one bulk IN endpoint 0x81 as Interface 0), my MSC (as Interface 1) doesn't receive anymore datas on its endpoints.

However, if I put my MSC as Interface 0 and my custom class as Interface 1, the MSC works and the custom class doesn't.

WORKING:
---------------
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0483 (STMicroelectronics)
idProduct: 0x572A
bcdDevice: 0x0200
iManufacturer: 0x01
0x0409: ''STMicroelectronics''
iProduct: 0x02
0x0409: ''STM32 Mass Storage''
iSerialNumber: 0x03
0x0409: ''00000000001A''
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x05
Open Pipes: 2
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Configuration Descriptor:
wTotalLength: 0x0030
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x04
0x0409: ''MSC Config''
bmAttributes: 0xC0 (Bus Powered Self Powered )
MaxPower: 0x32 (100 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x05
0x0409: ''MSC Interface''
0x0409: ''MSC Interface''
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x00
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x05
0x0409: ''MSC Interface''
0x0409: ''MSC Interface''
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
NOT WORKING:
--------------
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0483 (STMicroelectronics)
idProduct: 0x572A
bcdDevice: 0x0200
iManufacturer: 0x01
0x0409: ''STMicroelectronics''
iProduct: 0x02
0x0409: ''STM32 Mass Storage''
iSerialNumber: 0x03
0x0409: ''00000000001A''
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x05
Open Pipes: 1
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Configuration Descriptor:
wTotalLength: 0x0030
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x04
0x0409: ''MSC Config''
bmAttributes: 0xC0 (Bus Powered Self Powered )
MaxPower: 0x32 (100 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x00
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x05
0x0409: ''MSC Interface''
0x0409: ''MSC Interface''
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x05
0x0409: ''MSC Interface''
0x0409: ''MSC Interface''
Endpoint Descriptor:
bEndpointAddress: 0x82 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

Any idea ? Anyone can point me to an existing composite USB device example based on the ST HAL ? Thanks in advance, Franck. #usb #composite #stm32f4
1 REPLY 1
franck
Associate II
Posted on August 06, 2014 at 10:25

Found the answer in an older thread:

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/2%20HID%20in%20Composite%20device&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=162

''If the VID+PID is already known, Windows loads the known driver regardless whether it's a multi-function device or not. ''

''Windows remembers the Class-Driver-To-VID+PID-binding for the next plug-in event persistently, probably for performance purposes. Therefore, when you swap your Interfaces keeping VID+PID, you earn errors. But you can get rid easily by uninstalling your device in Device Manager. This will remove the memorized bindings.''

Sorry for the noise.

Franck.