2026-01-16 9:20 AM - edited 2026-01-16 9:20 AM
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
2026-01-16 10:56 AM
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.
2026-01-19 3:07 AM
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.
2026-01-19 3:13 AM
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.
2026-01-19 11:22 PM
@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
2026-01-20 7:07 AM
"CubeMX can't do a niche scenario that I want" does not equal "bug"
2026-01-20 8:20 AM - edited 2026-01-23 6:43 AM
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.
2026-01-20 9:40 AM
@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
2026-01-21 5:51 AM
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.