cancel
Showing results for 
Search instead for 
Did you mean: 

OTG_HS_IRQHandler isn't fired on STM32U5A9J-DK when USBC attached

nico23
Senior II

So, the situation has been pretty uncomfortable and frustrating.

I'm trying to implement the code to make the USB-C on the STM32U5A9J-DK work so that my PC recognizes the board as a Device.

I first started to try to implement it with my currently running code with ThreadX and TouchGFX, but it didn't work.

So, I started with a clean project, directly from CubeMX with just the USB OTG switched ON. No custom code, just the one generated by CubeMX.

Tried to attach the board to my PC, no device appeared on my PC, and, despite the breakpoint set on the only line of code inside OTG_HS_IRQHandler, when attaching the board to the USB, the interrupt doesn't fire.

I've checked step by step if the initialization and HAL_NVIC_SetPriority(OTG_HS_IRQn, 0, 0); HAL_NVIC_EnableIRQ(OTG_HS_IRQn); are executed, and everything seemed ok.

So, my question is, because there's no real documentation on how to implement the USB handling with the STM32 microcontroller, how am I supposed to make it work?

This is the github base project with just the USB OTG enabled https://github.com/NicoCaldo/USB_OTG_Test

1 REPLY 1
FBL
ST Employee

Hi @nico23 

First, the GitHub link is not working!

Second, CubeMX generates only MX_USB_OTG_HS_PCD_Init()  which you need to call to initialize the USB device. Then, you should set RX and TX FIFO and initialize the controller driver. After that, by calling HAL_PCD_Start (), you will enable the global USB interrupt internally.

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.