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,

0 REPLIES 0