Skip to main content
AWack
Associate III
April 22, 2026
Question

USB-Host with STM32U5 and ThreadX

  • April 22, 2026
  • 2 replies
  • 169 views

Hi,

I try to get the USB-Host running with USBX. Hardware is a custom board with TCPP02 and STM32U575.

Init process is running, but I never get an interrupt (ux_host_event_callback) when plugging in a USB stick. Any idea?

ioc file and schematic are attached.

Best regards,

Achim

2 replies

Technical Moderator
April 24, 2026

Hello @AWack 

When initializing host USBX stack , did you use ux_host_event_callback? You can refer to this example.

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
AWack
AWackAuthor
Associate III
April 27, 2026

Yes, I initialize this function as in your example...

Is this callback triggered by the CC1/2 lines? (I´m using USB-C)

 

AWack
AWackAuthor
Associate III
April 27, 2026

Hi, don´t know why, but when I started debugging again this morning, the interrupt was fired. But then in void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd) I get a hard fault in this call: hcd_stm32 = (UX_HCD_STM32*)hcd -> ux_hcd_controller_hardware;

After this hard fault hcd_stm32 has the following content:

AWack_0-1777278034251.png

 

Technical Moderator
April 27, 2026

Hi @AWack 

The ux_host_event_callback is normally triggered by the USB interrupt. This interrupt is not expected to fire if the USB stick is not detected, or if it is not properly recognized/processed, as this is not related to the CC lines.

The function is registered to handle USB events, but based on your description, it appears that it is not being called initially.

Could you please check whether App_ThreadX_Init() is called before or after MX_USBX_Host_Init()? It should be after MX_USBX_Host_Init()  even though CubeMX is still generating it in the opposite order..

There may be a timing issue where the USB host interrupt fires before the USBX host objects are fully initialized.

Also, please ensure that the byte pool buffer is cleared before initialization:

	memset(ux_host_byte_pool_buffer, 0, UX_HOST_APP_MEM_POOL_SIZE);

 

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