cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with USBX Custom HID - SetReport/GetReport callbacks not triggered (STM32H573I + ThreadX)

Musa2
Associate II

Hello,

I'm new to the USB protocol and currently facing an issue with USBX.
I'm working on a project using ThreadX and the USBX stack, trying to develop a Custom HID device with two endpoints: one IN and one OUT.

I generated the code using STM32CubeMX, and then modified:

  • the HID descriptor,

  • the USBD_Custom_HID_Activate and USBD_Custom_HID_Deactivate functions,

  • as well as the thread entry:

static VOID app_ux_device_thread_entry(ULONG thread_input) { /* USER CODE BEGIN app_ux_device_thread_entry */ TX_PARAMETER_NOT_USED(thread_input); HAL_PWREx_EnableVddUSB(); // Enable USB power /* Initialize USB DRD_FS controller */ MX_USB_PCD_Init(); /* Configure USB packet memory area (PMA) for endpoints */ HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x00, PCD_SNG_BUF, 0x0C); // EP0 HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x80, PCD_SNG_BUF, 0x4C); // EP1 IN HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x81, PCD_SNG_BUF, 0x8C); // EP2 IN HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x02, PCD_SNG_BUF, 0xCC); // EP2 OUT /* Initialize the device controller driver */ ux_dcd_stm32_initialize((ULONG)USB_DR

However, I noticed that the USBD_Custom_HID_SetReport and USBD_Custom_HID_GetReport functions are never called by the program, even though I have defined the necessary flags:

#define UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT #define UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT

Technical Details:

  • Board: STM32H573I-DK

  • RTOS: ThreadX

  • USB Stack: USBX middleware

  • USB Class: Custom HID Device

  • Report Size: 64 bytes (defined in the HID report descriptor)

I also tested sending data using the USB HID Demonstrator (v1.0.2) software.
The GET_FEATURE command works, but SET_REPORT does not seem to trigger any callback on the firmware side.

USB HID Demonstrator available here.

Questions:

  1. How can I receive the data sent by the host to my OUT endpoint?

  2. Why are the SetReport and GetReport callback functions never triggered?
    Is there any specific configuration required in CubeMX or during USBX initialization?

Thank you in advance for your help.

Best regards,

2 REPLIES 2
Pavel A.
Super User

To receive IN or OUT report requests in the device, the host must make these request. Otherwise the device won't see anything. Can you show the host code sending these requests?

 

Musa2
Associate II

Hi @Pavel A. ,

To send data to my board, I use the WebAuthn site, which allows simulating the registration of a FIDO2 security key. My STM32H573 is configured to be enumerated as a "HID-compliant FIDO" device. I have attached my descriptor file below.

Musa2_1-1747646896579.png

During registration, the site is supposed to send data to the authenticator device via the CTAP protocol on the OUT endpoint.

I have also tested with STMicroelectronics' USB HID Demonstrator tool and can see that data is successfully transmitted from the STM32 board to the host. However, when I send data using the SET_REPORT command, the associated callback function is not invoked; only the SET_FEATURE function works.

Musa2_0-1747646870751.png