Skip to main content
Associate II
April 11, 2025
Solved

Issue with Custom HID Report Size on STM32F765 – Fails Above 16 Bytes

  • April 11, 2025
  • 1 reply
  • 492 views

 

Hello ST Community & @stforum & @stforum2   

I am working on a project using the STM32F765VGT6 MCU with STM32CubeIDE on Windows, and I'm implementing a Custom HID USB interface.

Objective:
To send more than 16 bytes of data over USB using the `USBD_CUSTOM_HID_SendReport()` function.


USB Report Descriptor (Working - 16 Bytes):

__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =
{
0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page: 0xFF00)
0x09, 0x01, // USAGE (Vendor Defined)
0xA1, 0x01, // COLLECTION (Application)

// Output Report (16 bytes)
0x85, 0xE3, // REPORT_ID (227)
0x09, 0x01,
0x15, 0x00,
0x25, 0x01,
0x75, 0x08,
0x95, 0x10, // REPORT_COUNT = 16
0xB1, 0x03, // FEATURE (Data, Var, Abs)

// Input Report (16 bytes)
0x85, 0xE4, // REPORT_ID (228)
0x09, 0x02,
0x15, 0x00,
0x25, 0xFF,
0x75, 0x08,
0x95, 0x10, // REPORT_COUNT = 16
0x81, 0x02, // INPUT (Data, Var, Abs)

0xC0 // END_COLLECTION
};

#define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 16U
#define USBD_CUSTOM_HID_REPORT_DESC_SIZE 32U

#define CUSTOM_HID_EPIN_ADDR 0x81U
#define CUSTOM_HID_EPIN_SIZE 0x40U
#define CUSTOM_HID_EPOUT_ADDR 0x01U
#define CUSTOM_HID_EPOUT_SIZE 0x40U

 


Modified Descriptor for 32 Bytes (Not Working):

// Output Report (32 bytes)
0x85, 0xE3,
0x09, 0x01,
0x15, 0x00,
0x25, 0x01,
0x75, 0x08,
0x95, 0x20, // REPORT_COUNT = 32
0xB1, 0x03,

// Input Report (32 bytes)
0x85, 0xE4,
0x09, 0x02,
0x15, 0x00,
0x25, 0xFF,
0x75, 0x08,
0x95, 0x20, // REPORT_COUNT = 32
0x81, 0x02,

For 32 bytes and 64 bytes unable to transmit the data and sometimes device not detecting

Thanks
Badrinathan J

 

This topic has been closed for replies.
Best answer by FBL

Hi @Badrinathan 

Did you update buffer size?

#define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 32U

Ensure that the buffer sizes in your configuration match the report size. 

1 reply

FBLBest answer
ST Technical Moderator
May 9, 2025

Hi @Badrinathan 

Did you update buffer size?

#define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 32U

Ensure that the buffer sizes in your configuration match the report size. 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL