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

USBHost: Wait for device to implement SET ADDRESS #10651

Merged
merged 1 commit into from May 31, 2019

Conversation

desowin
Copy link
Contributor

@desowin desowin commented May 24, 2019

The USB Device must change the address 2 ms after completing SET ADDRESS
status stage.

Wait 2 ms before issuing GET DESCRIPTOR under the new address. In my
case, this completely resolves the timeout issues.

Description

Prior to this change the enumeration did fail every time. The output looked like this:

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1163]----- CONTROL READ [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1177]Control transfer on device: 0

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1181]SETUP PACKET:
80 6 0 1 0 0 8 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1208]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1237]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1245]CONTROL READ SUCCESS [8 bytes transferred]
12 01 10 02 00 00 00 40

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1278]CONTROL ack stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1163]----- CONTROL WRITE [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1177]Control transfer on device: 0

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1181]SETUP PACKET:
0 5 1 0 0 0 0 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1208]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1278]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:164]Address of 0x200295ec: 1
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1163]----- CONTROL READ [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1177]Control transfer on device: 1

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1181]SETUP PACKET:
80 6 0 1 0 0 8 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1208]CONTROL setup stage USB_TYPE_ERROR
[USB_DBG: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:601]Resetting hub 0, port 1

After this change, the enumeration consistently succeeds in first try. The log looks like this:

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1169]----- CONTROL READ [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1183]Control transfer on device: 0

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1187]SETUP PACKET:
80 6 0 1 0 0 8 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1214]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1243]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1251]CONTROL READ SUCCESS [8 bytes transferred]
12 01 10 02 00 00 00 40

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1284]CONTROL ack stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1169]----- CONTROL WRITE [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1183]Control transfer on device: 0

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1187]SETUP PACKET:
0 5 1 0 0 0 0 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1214]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1284]CONTROL ack stage USB_TYPE_IDLE
[USB_DBG: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:164]Address of 0x200295ec: 1
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1169]----- CONTROL READ [dev: 0x200295ec - hub: 0 - port: 1] ------
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1183]Control transfer on device: 1

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1187]SETUP PACKET:
80 6 0 1 0 0 8 0
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1214]CONTROL setup stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1243]CONTROL READ stage USB_TYPE_IDLE
[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1251]CONTROL READ SUCCESS [8 bytes transferred]
12 01 10 02 00 00 00 40

[USB_TRANSFER: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:1284]CONTROL ack stage USB_TYPE_IDLE
[USB_INFO: .\mbed-os\features\unsupported\USBHost\USBHost\USBHost.cpp:183]New device connected: 0x200295ec [hub: 0 - port: 1]

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

@ciarmcom ciarmcom requested a review from a team May 24, 2019 09:00
@ciarmcom
Copy link
Member

@desowin, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@maciejbocianski maciejbocianski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Additionally it would be good to add the description where to find this requirement:
e.g. Described in chapter 9.2.6.3 Set Address Processing of USB 2.0 doc

The USB Device must change the address within 2 ms after completing
SET ADDRESS status stage.

Wait 2 ms before issuing GET DESCRIPTOR under the new address. In my
case, this completely resolves the timeout issues.
@desowin
Copy link
Contributor Author

desowin commented May 28, 2019

Additionally it would be good to add the description where to find this requirement:
e.g. Described in chapter 9.2.6.3 Set Address Processing of USB 2.0 doc

I have updated the comment to mention the USB specification.

@0xc0170
Copy link
Contributor

0xc0170 commented May 28, 2019

Ci started

@mbed-ci
Copy link

mbed-ci commented May 29, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit a8444bd into ARMmbed:master May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants