STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
473 stars 301 forks source link

USB composite CDC-CustomHID device problem, one of I/F hangs or data corruption occurs #274

Open danielsulik opened 10 months ago

danielsulik commented 10 months ago

Brief description A serious problem with USB composite CDC-CustomHID device working reliably. I have ported your H7 Composite Custom HID - CDC example code to STM32F723 MCU. HID interface either hangs, sometimes CDC I/F hangs or data integrity fails when running loopback test on both interfaces at the same time from two different host processes.

Describe the set-up

The board: Not applicable. I was testing with STM32F723-DISCO development board. IDE: System Workbench for STM32 Observed on Windows 7, 8.1, 10

Describe the bug I have implemented USB composite CDC- and Custom HID device based on your H7 Composite Custom HID - CDC example code. HID I/F receives 64 bytes long reports and sends the same reports back to the host running a HID loopback test process . CDC I/F receives random bytes long packets from length between 1 to 12345 bytes and sends the same data back to the host running loopback test on the same host, however in a different process. Device enumerates OK with VID 0x483 and PID 0x5741, If I run test on one interface only it works reliably 247 without any problem. Once I run loopback test on both interfaces one of the interfaces hangs or incorrect data is received by the host. Does not matter if the code is running in HS or FS mode. For simplicity no UART is implemented on CDC side. There is just a simple loopback.

The main loop is not stuck, blinking LED process is still blinking, however processing of comms on USB either CDC or HID is stuck. Looks to me like missing an interrupt processing. Minimal version of the code is in the attachment. cdc-hid-min.zip

danielsulik commented 9 months ago

To replicate the problem quicker set bInterval parameter to 0x1 on CDC and HID interface. in usbd_customhid.h

define CUSTOM_HID_HS_BINTERVAL 0x1U

define CUSTOM_HID_FS_BINTERVAL 0x1U

in usbd_cdc.h

define CDC_HS_BINTERVAL 0x1U

define CDC_FS_BINTERVAL 0x1U

danielsulik commented 8 months ago

HI there, please is anyone looking at the issue. We need to sort this out asap.

ALABSTM commented 4 months ago

Hi @danielsulik,

Our apology for this delayed reply. Your report has been forwarded to our development teams for investigation. I will keep you informed.

With regards,

ALABSTM commented 4 months ago

Hi @danielsulik,

By the way, STM32CubeF7 firmware still supports version 2.11.0 of the USB Device library, while the latest version is 2.11.2 including some fixes. Would you give it a try? You can find it here and could easily integrate it manually into your project.

With regards,

ALABSTM commented 2 weeks ago

Hi @danielsulik,

Are you still facing the same issue? Your report has been forwarded to our development teams. Let's wait for their feedback.

With regards,

ALABSTM commented 2 weeks ago

ST Internal Reference: 184861

danielsulik commented 2 weeks ago

Yes, still the same problem.

Regards

Daniel

From: Ali LABBENE @.> Sent: Monday, June 24, 2024 15:34 To: STMicroelectronics/STM32CubeH7 @.> Cc: Daniel Sulik @.>; Mention @.> Subject: Re: [STMicroelectronics/STM32CubeH7] USB composite CDC-CustomHID device problem, one of I/F hangs or data corruption occurs (Issue #274)

Hi @danielsulik https://github.com/danielsulik ,

Are you still facing the same issue? Your report has been forwarded to our development teams. Let's wait for their feedback.

With regards,

— Reply to this email directly, view it on GitHub https://github.com/STMicroelectronics/STM32CubeH7/issues/274#issuecomment-2186596192 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQ7A5YTZC7MYMMTIIUT3HLZJAN2XAVCNFSM6AAAAAA4PRNPEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGU4TMMJZGI . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ACQ7A5Z2P3AFCCN6ML7XMQTZJAN2XA5CNFSM6AAAAAA4PRNPEWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUCKTHWA.gif Message ID: @. @.> >