2025-03-05 2:24 AM
Hello,
I am trying to use the USB HOST with CubeMX, everything works fine and I can detect my USB stick properly. The connection/disconnection is detected correctly.
Then, I tested connecting a UGREEN SD card reader, and everything works fine as long as I insert only one SD card. However, when I insert the second SD card into the card reader, CubeMX does not detect the second connection and only considers the first connection.
Similarly, when I connect a powered USB hub (Meta 7-Port USB 2.0 Hub), it detects the USB but never goes into "APPLICATION READY"...?
My question is the following: is it possible to use the USB Host with CubeMX to control a USB hub and read and write to multiple USB sticks?
I haven’t found any example on GitHub.
Thank you for reading!
2025-03-05 5:16 AM
Hi @MoGrunwalski & welcome to ST Community
Maybe this example should be helpful
even though not sure if that would be possible to use multiple USB sticks. Which product are you using? If having issues, would you attach ioc file?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-03-05 5:20 AM - edited 2025-03-05 5:24 AM
Yes this may be possible, with good USB libraries that support hubs.
Regarding the UREEN reader - if you connect it with two cards to a PC, will the PC see both cards? If yes, does PC see the reader as USB composite device with two functions, or one device/function with two LUNs?
2025-03-05 6:17 AM
Hi @FBL
I just saw your example, but nothing seems to resemble the ability to control a USB hub with the USB Host. Here is my .ioc file attached.
2025-03-05 6:28 AM
Hi @Pavel A.
Isn't this kind of library managed and defined directly with the code generated by STM32CubeMX?
Regarding the UGREEN card reader, the PC sees a device with two LUNs. I find my two distinct disks in the disk manager (E:) and (G:), and in the task manager, I see "Generic MassStorageClass USB Device" listed twice
Thank you
2025-03-05 6:51 AM - edited 2025-03-05 6:52 AM
Hi @MoGrunwalski , maybe one device with two LUNs will be possible to implement with the existing ST USB library, as it does not require composite or hub support or other complications on the USB level.
Some tweaking is needed in the MSC (mass storage) protocol layer. Unlikely that STM32CubeMX can help here.
2025-03-05 7:01 AM
And do you think I would have the same issue if I want to connect multiple USB Serial (CDC Virtual Com Port) from a HUB ?
2025-03-05 11:12 AM
Multiple CDC (host) unfortunately requires a hub or composite.
Multiport serial adapters were popular many years ago, but AFAIK this kind of device has not made it to official usb.org standard. This is a pity because need for such devices still exists.