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 2.0 high-speed support in Zephyr #11000

Closed
aurel32 opened this issue Nov 1, 2018 · 0 comments
Closed

USB 2.0 high-speed support in Zephyr #11000

aurel32 opened this issue Nov 1, 2018 · 0 comments
Assignees
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features

Comments

@aurel32
Copy link
Collaborator

aurel32 commented Nov 1, 2018

To the best of my knowledge, Zephyr supports at least one high-speed USB controller, the one in the STM32F723 SoC. The PR #10977 adds the USB driver for the SAM E70 SoC, which also support high-speed USB.

I have done some basic testing of the USB device stack in high-speed mode. So far it seems most of the issues are on the descriptor side. The control and interrupt endpoints work fine, but the bulk endpoints do not always work, as we usually define their size to be 64 bytes, while they should be 512 bytes in high-speed mode. This leads to issues like this one with the Linux kernel:

usb 2-2.2: new high-speed USB device number 9 using xhci_hcd
usb 2-2.2: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
usb 2-2.2: config 1 interface 0 altsetting 0 bulk endpoint 0x2 has invalid maxpacket 64
usb 2-2.2: New USB device found, idVendor=2fe3, idProduct=0100, bcdDevice= 0.11
usb 2-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-2.2: Product: Zephyr MSC sample
usb 2-2.2: Manufacturer: ZEPHYR
usb 2-2.2: SerialNumber: 0.01

In practice it works or not depending on the host, I got it working on a host with an EHCI controller, but I experienced data loss with an XHCI controller. On the other hand, after increasing the endpoints size to 512 bytes (by changing the limits in the Kconfig code), all work as expected.

I believe that the way to fix that is to fix the descriptors just after the USB reset, when the connection speed is known. The bulk descriptors should be reduced to 64 bytes. That is probably also the good place to fix the bInterval values, and provide a Device Qualifier Descriptor.

Now I am not fully sure how to re-architecture the code to be able to do that. I am therefore opening this issue in the hope to get some guidelines. I guess @finikorg and @jfischer-phytec-iot could help there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants