zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.82k stars 6.59k forks source link

STM32H723 USB CDC ACM sample stops working when sending packets >= 64 byte #59828

Open oktokl opened 1 year ago

oktokl commented 1 year ago

Describe the bug When I send packets >= 64 bytes to the USB CDC ACM sample, I either get no reponse or get one after several more transmission without response.

To Reproduce Steps to reproduce the behavior:

  1. Flash usb cdc acm sample on nucleo_h723zg
  2. Either send packets >= 64 bytes or use my test program: SerialTest COMxx 64

Expected behavior USB full speed packets have a maximum size of 64 bytes. Data packets >= 64 bytes are assembled out of multiple USB packets. The sample should handle this packets or at least the receiver shouldn't stop working.

Impact In case it is the usb cdc implementation, it's really bad if it can be put in a freezed state. Also, in order to reach high data rates, it's generally a good idea to transmit big packets. Actually, that seems not possible.

Logs and console output Here are different outputs of SerialTest and the corresponding traces: wireshark-trace.zip The traces show that the sample application successfully echos the first 64 bytes of the first 64+ bytes packet. After this reponse, rx doesn't accept any further packets.

Packet size 63 (working)

Sending 63 bytes:
0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Sending 63 bytes:
1: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Sending 63 bytes:
2: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
...

Packet size 64 (not working)

Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
Timeout
Sending 64 bytes:
0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Sending 64 bytes:

[tx freezes here]

Packet size 65 (not working)

Sending 65 bytes:
Timeout
Sending 65 bytes:

[tx freezes here]

Environment (please complete the following information): Platform: nucleo_h723zg; full speed usb interface with internal PHY Host: Windows 10 Pro 22H2 Zephyr version: v3.4.0

github-actions[bot] commented 1 year ago

Hi @oktokl! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. πŸ€–πŸ’™

erwango commented 1 year ago

@loicpoulain Would you have time to take a look ?

github-actions[bot] commented 1 year ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

Desvauxm-st commented 10 months ago

@oktokl i confirm that when we send a packets >= 64 bytes it doesn't works with the nucleo_h723zg in fact the nucleo_h723zg use Otg_HS and not Otg_FS to increase the length of the packet you must enable the CONFIG_USB_DC_HAS_HS_SUPPORT=y after that in my case i can send more than 64 byte for example 101 bytes see after:

image

and in debug mode see the console ( first 64 byte and after 37 bytes) image

I read that the host must also manage the ZLP ( zero length packet).

erwango commented 9 months ago

@oktokl We consider this is closed by https://github.com/zephyrproject-rtos/zephyr/pull/66692. Please reopen if it is not the case.

marwaiehm-st commented 1 month ago

I reopened this issue because the proposed solution caused a problem with the WebUSB sample.