Skip to main content
Robertson.Jamie
Associate II
April 23, 2025
Solved

STM32U5A9J-DK1 USB Device question

  • April 23, 2025
  • 4 replies
  • 672 views

I'm attempting to implement a USB MSC Device using the USB_OTG_HS on a STM32U5A9J-DK1. I'm using the STM32CubeMX version 6.14.1 and STM32Cube_FW_U5_V1.7.0 to create a USBX stand-alone (without THREADX) MSC device. The project builds and runs, with successful initialization of the USBX device subsystem. However, connecting to a host does not trigger the OTG_HS_IRQHandler() interrupt. A couple of questions:

A call to MX_USB_OTG_HS_PCD_Init() is generated in main by CubeMX, but I don't find anywhere in the code where PA11 and PA12 are initialized to the USB_OTG_HS alternate functions.

Since enabling VBUS Sensing via PA9 is not an available option for this device in the CubeMX, and I see from the schematic that VBUS_SENSE is connected to PG1, I'm not at all clear how connection to a host is detected to fire the USB_OTG_HS interrupt.

The STM32Cube_FW_U5 only contains examples for USBX Host, so I'm not sure where to look for guidance.

 

 

 
Best answer by FBL

Hi @Robertson.Jamie 

PA11 and PA12 are kept in default state (analog mode).

Check section 8.2 USB Type-C® (High Speed, sink only) in UM2967.

Also you can find some examples on STM32H5 provided without threadx.

About how connection is detected, check Figure 926. Interrupt hierarchy in RM0456. This figure should summarizes the flow, monitoring the host status registers for changes in connection.

4 replies

FBLBest answer
Technical Moderator
April 30, 2025

Hi @Robertson.Jamie 

PA11 and PA12 are kept in default state (analog mode).

Check section 8.2 USB Type-C® (High Speed, sink only) in UM2967.

Also you can find some examples on STM32H5 provided without threadx.

About how connection is detected, check Figure 926. Interrupt hierarchy in RM0456. This figure should summarizes the flow, monitoring the host status registers for changes in connection.

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
Robertson.Jamie
Associate II
April 30, 2025

Thank you for the response. I did get it working in the meantime. I've successfully implemented a MSC Device using the Standalone USBX drivers as well as a (separate) CDC Device using the legacy USB drivers. Both work without using VBUS Sensing.

Associate II
September 10, 2025

Hi,@Robertson.Jamie

 
I am also using the STM32U5A9J-DK1 board and want to implement a USB device.
I would like to reference your project—could you share it?
Thank you very much!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Technical Moderator
September 10, 2025

Hi @tod & Welcome to ST community! 
Do you have an issue running the examples provided?

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 II
September 11, 2025

HI,@Robertson.Jamie @FBL 

Please give me some help!

Thank you both very much!