Skip to main content
Associate III
January 16, 2026
Solved

STM32H7S7L8 usb HS and FS IRQ

  • January 16, 2026
  • 7 replies
  • 548 views

Hello, 

I'm working with the STM32H7S7L8-DK and i want to use both USB HS and FS in device mode  but it seems in cube mx that i'm unable to enable both IRQ

 

If i enable the HS one the FS one isn't generated and same fort the other way

 

Is it a bug  and how manage this to get it work?

Thanks 

Best answer by FBL

Hi @Hamady 

Technically yes, the two USB HW instances are standalone completely independent, ST classic core middleware can be instantiated twice but without CubeMX code generation.

Since a simple device should have only one connection to host side, CubeMX does not allow such configuration. So we cannot admit it as a limitation.

Also, USBX stack does not allow also to have 2 controllers (2 instances) for USB device. For multi-interfaces device, we recommend to build a composite device. 

About IRQ handlers, would you attach your ioc file?

7 replies

TDK
Super User
January 16, 2026

You asked this previously:

STM32H7S7L8 dual USB - STMicroelectronics Community

 

The answer is still the same:

CubeMX isn't set up to be able to generate a dual-usb device. The hardware supports it, but you will need to write the code yourself rather than relying on CubeMX generated code.

Perhaps generate one project for each USB device and integrate those projects together.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Technical Moderator
January 19, 2026

Hi @Hamady 

I assume STM32 libraries (including HAL) used for USB FS and HS support independent operation of the two ports as device. However, CubeMX is limited when you enable both interrupts. 

An internal ticket to CubeMX team to provide details about this limitation (225425)

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
Associate III
January 19, 2026

As TDK stated, CubeMX doesnt support it. 

What could be an option is that you generate the code with each peripheral seperately and merge it then together, but i dont know if it works. You have to watch out for Pin assignments and potential conflicts.

HamadyAuthor
Associate III
January 20, 2026

@TDK @Vidar @FBL Thanks you all for your responses

 

I know that I already created a thread about a similar thing but watching phils lab video i tried to use Tiny USB instead of classic USB middleware. But being unable to enable IRQ because a other peripheral have IRQ enable is bug of Cube MX.

@FBL So i need to make a ticket or you already make it ?

Thanks

TDK
Super User
January 20, 2026

"CubeMX can't do a niche scenario that I want" does not equal "bug"

"If you feel a post has answered your question, please click ""Accept as Solution""."
Technical Moderator
January 20, 2026

Hi @Hamady 

In the USB 2.0 specification, each USB device is defined to have exactly one upstream port.

Regarding generating IRQs, no restrictions from MX side to generate this handlers if checked properly in GUI.

/**
 * @brief This function handles USB OTG HS interrupt.
 */
void OTG_HS_IRQHandler(void)
{
 /* USER CODE BEGIN OTG_HS_IRQn 0 */

 /* USER CODE END OTG_HS_IRQn 0 */
 HAL_PCD_IRQHandler(&hpcd_USB_OTG_HS);
 /* USER CODE BEGIN OTG_HS_IRQn 1 */

 /* USER CODE END OTG_HS_IRQn 1 */
}

/**
 * @brief This function handles USB OTG FS interrupt.
 */
void OTG_FS_IRQHandler(void)
{
 /* USER CODE BEGIN OTG_FS_IRQn 0 */

 /* USER CODE END OTG_FS_IRQn 0 */
 HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
 /* USER CODE BEGIN OTG_FS_IRQn 1 */

 /* USER CODE END OTG_FS_IRQn 1 */
}

 

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
HamadyAuthor
Associate III
January 20, 2026

@TDK I don't know where the "niche" scenario is . There a two different peripheral so cube mx should not bug that's all.

 

@FBL I'm not talking about multiple connexion with one USB peripheral but just using the FS and HS like SPI1 & SPI2 

For the irq the only option was to manually enable the IRQ in the user code and add the IRq fonction

Thanks

FBLBest answer
Technical Moderator
January 21, 2026

Hi @Hamady 

Technically yes, the two USB HW instances are standalone completely independent, ST classic core middleware can be instantiated twice but without CubeMX code generation.

Since a simple device should have only one connection to host side, CubeMX does not allow such configuration. So we cannot admit it as a limitation.

Also, USBX stack does not allow also to have 2 controllers (2 instances) for USB device. For multi-interfaces device, we recommend to build a composite device. 

About IRQ handlers, would you attach your 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.Best regards,FBL