Skip to main content
Visitor II
November 10, 2014
Question

STM32F4 HAL Composite USB Device Example

  • November 10, 2014
  • 9 replies
  • 5287 views
Posted on November 10, 2014 at 14:30

Hello. I am using the new HAL library for writing a program for STM32F4Discovery (for university presentation). The program activates a USB FS CDC device once running to speak with a PC. I've attached an SD card slot to the discovery, and I also need the discovery board to act as USB FS Mass Storage device after the user clicks the User Button (without losing the CDC functionality). Then become back to the only-CDC mode once the user safe-ejects the mass storage device. As far as I know this is called a composite device (one physical connection, several devices). Is this possible with STM32F4 with HAL library and USB OTG library? If yes, is there an example code for this? Please help me if you can, thank you.

Edit 1

I have found a composite device example in ''STM32_USB-FS-Device_Lib_V4.0.0'' library which is used by STM32F102xx, STM32F103xx, STM32L1 and STM32F3. But there is no composite device example in ''STM32_USB-Host-Device_Lib_v2.1.0'' which is used in my mcu's (STM32F407) case, though its documentation (UM1021) says that it supports it: ''supports multi-interface applications (composite devices)''.

#cdc #composite #msc #usb
    This topic has been closed for replies.

    9 replies

    Visitor II
    November 12, 2014
    Posted on November 12, 2014 at 17:27

    Hi,

    The STM32Cube FW package includes examples based on elementary USB classes (MSC, HID, CDC,...). 

    Multi-interface applications (composite) are not yet developed. We’ll notify our development team about this subject.  

    Regards,

    Heisenberg.

    qwer.asdfAuthor
    Visitor II
    November 14, 2014
    Posted on November 14, 2014 at 14:01

    Thank you.

    Could you please tell me if it is currently possible to achieve a composite USB device using the current version of STM32CubeF4 HAL library (so it is just lacking an example demonstration) or the libraries should be changed first (hopefully in the near future) to do that?

    And, thank you for the STM32Cube initiative, it's still not as mature as the StdPeriph libraries, but I'm sure it will be, soon enough.
    Visitor II
    January 12, 2015
    Posted on January 12, 2015 at 17:12

    Hi,

    It is possible to achieve your own composite USB Device, by combining the desired classes' drivers into one class, under your own folder within: Middlewares\ST\STM32_USB Device Library\Class

    Regards,

    Heisenberg.

    Visitor II
    July 12, 2015
    Posted on July 13, 2015 at 01:37

    Any news about composite device example?

    Visitor II
    February 1, 2018
    Posted on February 01, 2018 at 08:04

    Hi,

    I need USB Composite (MSC +HID) 

    STM32Cube 

    example based on Stm32f407 microcontroller

    please help me..

    Visitor II
    February 21, 2019

    i have an example

    Visitor II
    January 16, 2020

    Could you provide a link to your example?

    Visitor II
    March 7, 2019

    Hi,

    I need USB Composite (MSC +CDC) 

    STM32Cube 

    example based on Stm32f7 microcontroller

    please help me..

    •  

    Visitor II
    June 1, 2019

    Anyone have an example of this they would care to share?

    Trying to make composite MSC +CDC in a STM32Cube for STM32F7.

    Thanks

    Visitor II
    October 8, 2019

    I am looking for an STM32F4 CDC MSC example. Can Someone help?

    Visitor II
    July 14, 2022

    Has anyone come up with a composite CDC+MSC example? Preferably for STM32F4?

    Graduate II
    July 14, 2022
    Visitor II
    July 14, 2022

    Thank you. TinyUSB is an option, but i'd like to find a direct low level composite driver. Or build my own