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 race condition that could cause drop packet of Bulk OUT transfer #733

Merged
merged 1 commit into from
Mar 19, 2021

Conversation

hathach
Copy link
Owner

@hathach hathach commented Mar 18, 2021

Describe the PR
related to #723, fix issue raised by adafruit/Adafruit_nRF52_Bootloader#195.

  • NRF_USBD->SIZE.EPOUT[epnum] only need to write once to enable Bulk/Interrupt transfer. We only need to do it in dcd_edpt_open() and dcd_edpt_clear_stall()
  • Separate Control and Bulk/Int OUT hanlding
  • Some minor comment and clean up

@khpeterson I have tested and tried it with your dfu file. Seem to work well without blocking wait. Would you mind trying this out.

NRF_USBD->SIZE.EPOUT[epnum] only need to write once to enable
Bulk/Interrupt transfer. We only need to do it in dcd_edpt_open() and
dcd_edpt_clear_stall()
@khpeterson
Copy link

khpeterson commented Mar 18, 2021

Running repeats successfully for an hour now - looks good to me. Good job on the quick fix.

@hathach
Copy link
Owner Author

hathach commented Mar 18, 2021

Running repeats successfully for an hour now - looks good to me. Good job on the quick fix.

I am looking to your final number. Btw, the race condition probably get worse with the zero length packet. CDC host driver normally will send ZLP when all data is sent and is multiple of 64 (endpoint size). Hope we finally fix the issue.

@khpeterson
Copy link

khpeterson commented Mar 18, 2021 via email

@hathach
Copy link
Owner Author

hathach commented Mar 18, 2021

1 hours is good enough for me, don't leave it running too long, it could degrade your nrf flash

@khpeterson
Copy link

khpeterson commented Mar 19, 2021 via email

@hathach
Copy link
Owner Author

hathach commented Mar 19, 2021

@khpeterson thank you very much for testing and raising this very hard to catch issue 👍

@hathach hathach merged commit 7503b9f into master Mar 19, 2021
@hathach hathach deleted the fix-nrf-dcd-bulk-out-race branch March 19, 2021 03:00
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