Skip to main content
AL_it
Associate II
October 30, 2025
Solved

Is dual USB host (FS and HS) supported on STM32H7 MCUs?

  • October 30, 2025
  • 3 replies
  • 742 views

Hi community,

Before I start discussing my specific issue, I would like to know if dual USB host operation is allowed on STM32H7 MCUs. The H7 MCU has both FS and HS USB cores, and I want to configure both FS and HS as USB hosts, not using the OTG feature. The HS USB core will also run in full-speed host mode without an external PHY, with each host having its own USB port. Are there any potential issues with this configuration?

I encountered unexpected behavior during project development: USB FS MSC class functionalities were affected when devices were plugged into the USB HS port.

Here is my USB class setup:

  • The USB FS core is registered with two classes — MSC class and a custom printer class.

  • The USB HS core is registered with a HID class.

All classes worked individually.

If no device is plugged into the USB HS port, the USB FS port works normally. It prints correctly when connected to a thermal receipt printer and creates text file reports using FATFS when connected to a flash drive.

However, after I plugged a barcode scanner or any other device (another flash drive or SD card adapter) into the USB HS port, the USB FS core started experiencing issues with MSC class operations. It seemed like the USB host controller stayed busy and eventually timed out. Specifically:

  • USBH_MSC_RdWrProcess flagged a busy status and eventually returned a timeout error.

  • Luckily, the printer class still worked on the USB FS port.

I also checked the USB HS port HID class operations after this issue occurred. The barcode scanner still worked. It appears that, so far, the issue only affects MSC class operations on the USB FS side.

After unplugging devices from both HS and FS ports and reattaching a flash drive to the USB FS port, text file writing function worked normally again.

I also tried changing the interrupt priorities for both USB cores (FS = 6, HS = 7), but this had no effect. No DMA is being used. I checked the USB driver code, and it does not appear that FS and HS share the same static/global buffers.

I hope someone has some insight into this issue. Thank you!

 

 

 

Best answer by AL_it

Hi T_Hamdi,

Thank you for the hint about using the IOC file and CubeMX. I just noticed that my team used a modified stm32h7xx_hal_hcd.c driver file when starting this project — perhaps by mistake. I commented out the special code that had been added in HAL_HCD_IRQHandler, the issue seems to be completely gone now.

3 replies

waclawek.jan
Super User
October 31, 2025

In hardware, the two OTG USB devices are entirely independent from each other, and so are their respective integrated FS PHYs. 

That leaves us with software.

While you haven't stated which sort of software did you use, I suspect, it's Cube-based. Besides potential bugs there, you may experience also bandwidth issues (you mention timeouts). It also sounds like you are using some sort of an RTOS, which adds to complexity and potential points of failure.

Sorry for such a vague statement, but I am afraid at this point you are at your own. Cube is open source, so you can debug it yourself, although this is not going to be simple.

JW

AL_it
AL_itAuthor
Associate II
October 31, 2025

Yes, I used the STM32CubeMX to generated the USB source codes. The firmware package is STM32 Cube FW_H7 V1.12.1.

FreeRTOS is used in this project, and the system contains several tasks — the main GUI task for TouchGFX and a task for UART communication. Initially, I had a single USB task that handled both the USB FS and HS state machines in a loop. Later, I created two separate tasks, one for each USB host, but the issue still persisted. When this issue occurs, the system is not performing any intensive work besides exporting data to the USB drive. The barcode scanner is simply connected but not actively scanning.

We also have a peripheral board powered by another identical H7 MCU, which uses two USB ports: the USB FS is configured as a host, and the USB HS is configured as a device. The USB FS port is registered with the MSC class, and the USB HS port is registered with the CDC class. There are no issues with this setup.

 

 

T_Hamdi
ST Employee
October 31, 2025

 

Hello @AL_it,

Could you please first provide the exact reference of the STM32H7 MCU used so that I can assist you properly?

Best regards,

 

 

"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.Hamdi Teyeb"
AL_it
AL_itAuthor
Associate II
October 31, 2025

The MCU model is STM32H743BITx. 

T_Hamdi
ST Employee
October 31, 2025

@AL_it 

Yes, dual USB host operation is supported on the STM32H743BITx MCU. However, your issue seems related to managing two classes simultaneously on a single USB core. Which classe are you using to handle this in mode Host ?

Also, are you using any RTOS to manage the two USB hosts concurrently?

"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.Hamdi Teyeb"
Technical Moderator
October 31, 2025

Hi @AL_it 

Here is an example:  DualCore_Standalone

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.Best regards,FBL
AL_it
AL_itAuthor
Associate II
October 31, 2025

Thank you for your input. I hope I can find something useful in the example.