2025-10-21 1:51 AM - last edited on 2025-10-21 2:38 AM by Andrew Neil
STM32H5 USB Custom HID CubeMX issue.
When setting parameter "UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH" to 64 in CubeMX, the corresponding define in the "ux_user.h" file is commented out.
Setting this parameter to any other valid value (between 0 and 255, excluding 64) in CubeMX generates an uncommented define.
I presume CubeMX is doing this because it assumes the default value from USBX is 64 bytes.
In fact a default value is provided by usbx in "ux_device_class_hid.h", but this value is actually 32 bytes.
Thus, using out of the box CubeMX generated code when "UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH" set to 64 results in very nasty memory overwrites in the USBX device structures that subsequently result in hard fault.
Please update CubeMX to not comment out this define when set to 64.
Thank you.
Solved! Go to Solution.
2025-10-23 9:11 AM - edited 2025-10-23 9:12 AM
Hello @KaiY
Thank you for bringing this issue to our attention.
I reported this internally.
Internal ticket number: 220335 (This is an internal tracking number and is not accessible or usable by customers).
2025-10-23 8:43 AM
Hi @KaiY
Would you attach your iOC file to reproduce ?
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.
2025-10-23 9:11 AM - edited 2025-10-23 9:12 AM
Hello @KaiY
Thank you for bringing this issue to our attention.
I reported this internally.
Internal ticket number: 220335 (This is an internal tracking number and is not accessible or usable by customers).