Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danielsulik opened this issue Sep 7, 2023 · 4 comments
Assignees
Labels
projects Projects-related (demos, applications, examples) issue or pull-request. question Further information is requested usb USB-related (host or device) issue or pull-request

Comments

@danielsulik
Copy link

danielsulik commented Sep 7, 2023

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

@ALABSTM ALABSTM self-assigned this Sep 15, 2023
@ALABSTM ALABSTM added projects Projects-related (demos, applications, examples) issue or pull-request. usb USB-related (host or device) issue or pull-request labels Sep 15, 2023
@danielsulik
Copy link
Author

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
Copy link
Author

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

@ALABSTM ALABSTM added the question Further information is requested label Feb 14, 2024
@ALABSTM
Copy link
Contributor

ALABSTM commented Feb 14, 2024

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 ALABSTM moved this from To do to Analyzed in stm32cube-mcu-fw-dashboard Feb 14, 2024
@ALABSTM
Copy link
Contributor

ALABSTM commented Feb 14, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
projects Projects-related (demos, applications, examples) issue or pull-request. question Further information is requested usb USB-related (host or device) issue or pull-request
Projects
Development

No branches or pull requests

2 participants