cancel
Showing results for 
Search instead for 
Did you mean: 

Implement a USB device interface descriptor constituted with a Bulk-In and an Interrupt-In endpoint with STM32Cube USB Device Library

YLin
Associate

Dear Sirs,

Can I use STM32Bube USB device library to implemet USB interface descriptor contains both a Bulk-In endpoint and an Interrupt-In endpoint? The function of these 2 endpoints are listed:

  1. Bulk-In endpoint is used to dump device status while receiving our proprietary commands via control transfer (the Endpoint 0) from the connected USB host.  
  2.  Interrupt-In endpointis used to notify the connected USB host actively while certain device status is just changed.  

To simplify the USB device firmware and the driver for our implement, I didn't declare 2 or more USB interfaces to carry each of these endpoints with different type like how the most of the USB composite device does, but declare only one interface with Vendor-Specific class/sub-class/protocol code(0xFF) in device descriptor.

But we found it is NOT working after implement the firmware on STM32F411E-DISCO board. Always only one of these 2 endpoint will be functional depend on which of their endpoint number is the first. For example:

  •  If I declare Endpoint Address of Bulk-In endpoint as 0x81 and Interrupt-In endpoint as 0x82, then only Bulk-In endpoint is functional. 
  • Vice Versa, declaring Endpoint Address of Bulk-In endpoint as 0x82 and Interrupt-In endpoint as 0x81, then only Interrupt-In endpoint is functional.

I install WinUSB to serve as the driver of this customized device, and invoke APIs of LibUSB to make Bulk-Transfer(libusb_bulk_transfer) and Interrupt-Transfer(libusb_fill_interrupt_transfer, libusb_submit_transfer, libusb_handle_events) to the corresponded endpoint. in the case of NOT functional, These APIs just end-up with time-out without capturing any data feedbacked MCU.

Since I can use USBview or USB Device Tree View on USB host to see all these 2 endpoints are enumberated correctly, and if I replace the Interrupt-In endpoint with Bulk-Out endpoint, all the 2 enpoint works correctly. For now, I don't think I have syntax error in my USB device descriptor that limit only one endpoint to be functional.

I didn't find any description in USB 2.0 spec related to USB device interface/endpoint mention about an interface descriptor can't implement multiple endpoints with the same (IN/OUT) direction or different transferring type. So currently I still can't figure out why it is not working and stucking here :(

1 REPLY 1
Pavel A.
Evangelist III

> Can I use STM32Bube USB device library to implemet USB interface descriptor contains both a Bulk-In endpoint and an Interrupt-In endpoint?

STM32Cube provides several examples and templates of standard classes (MSC, CDC and so on) from which you can gather understanding how to use the USB Device library. STM32Cube can also generate the code to initialize the USB controller. The descriptors for custom device, and part of USB device initialization are your own job.

Note the USB device low level initialization part: it should be done correctly too, not only the descriptor. This is probably what is missing.

Try to see how the host requests go on the USB bus and what the device responds, using a hardware USB analyzer.

Regards,

-- pa