Issue with USBX Custom HID - SetReport/GetReport callbacks not triggered (STM32H573I + ThreadX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-15 7:21 AM
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:
How can I receive the data sent by the host to my OUT endpoint?
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,
- Labels:
-
STM32H5 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-16 1:11 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-19 2:30 AM
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.
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.
