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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
T_Hamdi
ST Employee

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).

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.
Hamdi Teyeb

View solution in original post

2 REPLIES 2
FBL
ST Employee

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.


T_Hamdi
ST Employee

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).

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.
Hamdi Teyeb