cancel
Showing results for 
Search instead for 
Did you mean: 

"UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH" is commented out when set to 64

KaiY
Associate II

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.

 

 

 

 

0 REPLIES 0