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

Fix cxd56 msc #1075

Merged
merged 3 commits into from
Sep 7, 2021
Merged

Fix cxd56 msc #1075

merged 3 commits into from
Sep 7, 2021

Conversation

hathach
Copy link
Owner

@hathach hathach commented Sep 7, 2021

Describe the PR

Revert changes in #1070 , fix the root cause of the issue with cxd56. Following is the explanation (copied from other pr)

@kamtom480 the stall condition (before PR logic) is indeed correct here, according to the MSC BOT 13 cases. this particular if is for case 5 when Host expect more data than Device could send. In this particular case is Read Format Capacity command, where host expect 252 bytes, and we only send 12 bytes in response. Device really need to send an STALL first, then resume to send SCSI status afterwards when received clearing stall request https://github.com/hathach/tinyusb/blob/master/src/class/msc/msc_device.c#L318. Doing differently by this PR will cause MSC compliance test suite to fail.

image

image

The issue is spresense has its own usb stack under nuttx system, and it Doesn't forward the Clear Feature (Endpoint) request toward tinyusb. https://github.com/sonydevworld/spresense-nuttx/blob/2ffe58b6dcb8ca7e83a4d2acec5622276f7c6f5d/arch/arm/src/cxd56xx/cxd56_usbdev.c#L1367

It is quite troublesome, since most of the msc recover is based on the Clear Stall request. I will try to figure an way. In general the setup seem to be conditionally forwards (most but not all), and Status stage can also be auto ACKed. Which could cause race condition where next setup arrive while tinyusb task doesn't fully process previous packet hence the setup queue.

WALKAROUND

The workaround is unconditionally unstall the status endpoints for cxd56 and hope for the best, which won't pass compliance test suite, but will work for most of the case with sensible host driver.

Copy link
Collaborator

@kamtom480 kamtom480 left a comment

Choose a reason for hiding this comment

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

@hathach Thank you for this PR! I tested it and it works on Spresense.

hw/bsp/spresense/board.mk Show resolved Hide resolved
@hathach
Copy link
Owner Author

hathach commented Sep 7, 2021

thank you for your review

@hathach hathach merged commit 582e5db into master Sep 7, 2021
@hathach hathach deleted the fix-cxd56-msc branch September 7, 2021 11:06
Copy link
Collaborator

@kamtom480 kamtom480 left a comment

Choose a reason for hiding this comment

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

Why not use python3 for Windows too?

@hathach
Copy link
Owner Author

hathach commented Sep 7, 2021

Why not use python3 for Windows too?

Windows only has python.exe there is no python3.exe even though you install 3.9x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants