This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32F4 USB composite HID+MSC

Hi all!

Does anyone have an experience with making multi-interface (multi-class) USB with STM32F4 device? I am using STM32F4-discovery kit and usb library STM32_USB-Host-Device_Lib_V2.1.0. I have made my HID and MSC applications and now I wanna make a composite device with this classes.

The biggest problem is to set the callback functions for both interfaces. I tried to make one set of universal callbacks (for example one function USBD_HID_MSC_DataOut operating with both interfaces. The code inside the function is divided by endpoint number) but only HID is working. Windows recognize also Mass Storage device but cannot operate with it.
I thing the USR_desc (User descriptors: SerialStrDescriptor, ConfigStrDescriptor, InterfaceStrDescriptor and so on) has also some impact.
Does anyone made some USB composite application with this library?
Thanks for comments.

Jan

Parents
  • to make a composite device with STM32_USB-Host-Device_Lib_V2.1.0 you must do this stages:
    1-make your composite device describtore and pass it in GetConfigDescriptor class callback function
    2-config your endpoints with DCD_EP_Open and DCD_EP_Close function in Init and DeInit class callback functions
    3-use DCD_EP_Flush function for all new endpoints and make Out endpoits Prepare to recive data with DCD_EP_PrepareRx function in Init class callback function
    4-config TXn_FIFO_FS_SIZE in usb_conf.h file

    -note that for full speed device sum of RX_FIFO_FS_SIZE + TX0_FIFO_FS_SIZE + TX1_FIFO_FS_SIZE +TX2_FIFO_FS_SIZE can not be more than 320 so for example if you have 2 bidirectional
    endpoints(1(in and out) and 2(in and out)) other than endpoint0 correct values for RX_FIFO_FS_SIZE,TX0_FIFO_FS_SIZE,TX1_FIFO_FS_SIZE,TX2_FIFO_FS_SIZE are:

    #define RX_FIFO_FS_SIZE 128
    #define TX0_FIFO_FS_SIZE 64 //max packet size for endpoint0
    #define TX1_FIFO_FS_SIZE 64 //max packet size for endpoint1
    #define TX2_FIFO_FS_SIZE 64 //max packet size for endpoint2
    #define TX3_FIFO_FS_SIZE 0

    5-use your DataOut class callback with epnum parameter to manage which endpoint event callback occure

Reply
  • to make a composite device with STM32_USB-Host-Device_Lib_V2.1.0 you must do this stages:
    1-make your composite device describtore and pass it in GetConfigDescriptor class callback function
    2-config your endpoints with DCD_EP_Open and DCD_EP_Close function in Init and DeInit class callback functions
    3-use DCD_EP_Flush function for all new endpoints and make Out endpoits Prepare to recive data with DCD_EP_PrepareRx function in Init class callback function
    4-config TXn_FIFO_FS_SIZE in usb_conf.h file

    -note that for full speed device sum of RX_FIFO_FS_SIZE + TX0_FIFO_FS_SIZE + TX1_FIFO_FS_SIZE +TX2_FIFO_FS_SIZE can not be more than 320 so for example if you have 2 bidirectional
    endpoints(1(in and out) and 2(in and out)) other than endpoint0 correct values for RX_FIFO_FS_SIZE,TX0_FIFO_FS_SIZE,TX1_FIFO_FS_SIZE,TX2_FIFO_FS_SIZE are:

    #define RX_FIFO_FS_SIZE 128
    #define TX0_FIFO_FS_SIZE 64 //max packet size for endpoint0
    #define TX1_FIFO_FS_SIZE 64 //max packet size for endpoint1
    #define TX2_FIFO_FS_SIZE 64 //max packet size for endpoint2
    #define TX3_FIFO_FS_SIZE 0

    5-use your DataOut class callback with epnum parameter to manage which endpoint event callback occure

Children
No data