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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[USB] Fixes an issue with Serial when receiving consecutive multiple 64-byte transmissions from Host #1336

Merged
merged 1 commit into from May 25, 2017

Conversation

@avtolstoy
Copy link
Member

commented May 18, 2017

Problem

With RX queue full, the device NAKs OUT (Host->Device) transfers. With bInterval set to 0 (1 ms) this causes the device to spend too much time in USB interrupt, not giving any processing time to the application/system thread to consume RX queue. For some reason CDC driver on OSX doesn't attempt to send any data after about 300 NAKed transfers. Closing/re-opening the port doesn't help either.

Solution

Set bInterval to a maximum value (16 ms) on OUT endpoint to give enough time for the device to consume RX queue and not send too many NAKs to Host.

We should probably add some workaround as well: e.g. count the number of NAKs sent and silently drop incoming data after a certain threshold instead of NAKing it. Even though this is OSX driver's fault. 馃

Steps to Test

The bug is easily reproducible on OSX when setting WPA Enterprise credentials over Serial. A simple copy-paste of a certificate (e.g. CA) will not complete and get stuck somewhere half-way through.

Example App

N/A

References

N/A


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation (N/A)
  • Added to CHANGELOG.md after merging (add links to docs and issues)

Bug fix

  • [PR #1336] Fixes an issue with Serial when receiving consecutive multiple 64-byte transmissions from Host
[USB Serial] Set bInterval to a maximum value on OUT endpoint. Fixes 鈥
鈥n issue with Serial on OSX when consecutive multiple 64-byte (CDC_DATA_OUT_PACKET_SIZE) transmissions from Host occur, causing it to no longer receive any data at all if RX queue is not cleared fast enough and multiple NAKs are sent to the Host

@avtolstoy avtolstoy added this to the 0.7.0 milestone May 18, 2017

@technobly technobly added the bug label May 25, 2017

@technobly technobly merged commit 6608495 into feature/photon/wiced-3.7.0-7 May 25, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@technobly technobly deleted the fix/usb-serial-ep-interval branch May 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.