Skip to main content
Vinay_Shirol
Associate II
February 8, 2026
Question

USB Dual-Role (Host + Device) support on U585I-IOT02A — example for firmware upgrade

  • February 8, 2026
  • 2 replies
  • 106 views

Hi team,

I am working on the STM32U585I-IOT02A board and trying to implement USB dual-role functionality (Host + Device).

My goal is:

  • USB Host: MSC class (to read firmware from a USB flash drive)

  • USB Device: CDC class (for communication with a PC)

I have enabled both the USB Host stack and USB Device stack in CubeMX, but I am unable to get the dual-role setup working reliably.

My main objective is to upgrade firmware using a USB flash drive (MSC Host) while still supporting CDC Device communication.

I would like to know:

  1. Does STM32U5 support USB dual-role operation (Host + Device) simultaneously or via role switching?

  2. Is there any example project or reference implementation for USB dual-role on STM32U5?

  3. Are there recommended approaches for implementing firmware upgrade via USB MSC Host on this board?

Any guidance or example projects would be very helpful.

Thank you.

2 replies

Technical Moderator
February 9, 2026

Hello @Vinay_Shirol 
Although there is unfortunately no example that meets your specific requirements, I have a project that switches between two device class functionalities on an STM32U585 IoT kit.
The project starts as a HID device, then switches to the CDC device class after five seconds. you can use USB tree viewer to track the switch
You can use this project as a reference to fulfill your request.
However, since you want to implement both device and host functionality at the same time, you should select OTG_Dual_Role_Device option so you can select host files in your project alongside device files.

Gyessine_0-1770640735047.png

You can also review this article, where we implemented dual-role data functionality on the STM32H7 (HID host and CDC device) but with using ST middleware, not USBX. In this example, we manually implemented device files.
BR
Gyessine

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.
Vinay_Shirol
Associate II
February 10, 2026

Thanks @Gyessine , 

                                I will go though this article and try it on my board. I will update here whatever the status of this later.