-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: Fix reconnect issues #16193
USB: Fix reconnect issues #16193
Conversation
4c9413a
to
d53a683
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found an issue which rakon then reported -- fixed. Verified on an own piece of HW.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows USB3CV tests to be executed again, but following cases from Chapter 9 Tests still fail:
-
TD 9.1, 9.2, 9.3, 9.4, 9.5, 9.7 in Configured state:
Set Configuration failed for Configuration Value : 1
(1.1.2) Devices must support being set to Addressed/Configured state.
-
TD 9.9, 9.13:
Set Configuration failed for Configuration Value : 1
(1.1.2) Devices must support being set to Addressed/Configured state.
-
TD 9.16:
Enumeration failed at iteration 1 (General failure)
Are those failures resulting from the PR? Can they be reproduced on master? |
On master the USB3CV tests do not work at all:
|
OK, This is probably because of extra checks we have added. I think we should address this in a separate issue. |
@masz-nordic Does this fix the issues?
|
@finikorg It fixes 9.1, 9.2, 9.3, 9.4, 9.5, 9.7 in Configured state and 9.9. But 9.13 and 9.16 still fail.
All of them fail with:
|
Then we need to "fix" another bug :)
|
Still same failures as in previous case. Logs:
|
@masz-nordic what sample are you using? I had tests with frdm_k64f and HID it was passing all tests. |
@finikorg |
@masz-nordic Can you please apply and test again? (https://gist.github.com/acsplayon/b594d6b2207f8923edb071fdee499b36) diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c
index e3ba244b9c..86c7e39351 100644
--- a/drivers/usb/device/usb_dc_nrfx.c
+++ b/drivers/usb/device/usb_dc_nrfx.c
@@ -637,6 +637,8 @@ static void ep_ctx_reset(struct nrf_usbd_ep_ctx *ep_ctx)
ep_ctx->buf.curr = ep_ctx->buf.data;
ep_ctx->buf.len = 0U;
+ ep_ctx->cfg.en = false;
+
ep_ctx->read_complete = true;
ep_ctx->read_pending = false;
ep_ctx->write_in_progress = false;
|
I have tested frdm_k64f, stm32f723e_disco, nucleo_f412zg they are all passing, I will check also reel_board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@masz-nordic Tests are passing for |
Add usb_cancel_transfers() helper to cancel all ongoing transfers. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Only call callback when transfer is not cancelled. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Cancel all usb transfers when receiving USB_DC_DISCONNECTED. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add extra logs catching problem with re-enabling endpoints. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Fix supended -> suspended. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Disable endpoints on following events: USB_DC_DISCONNECTED and USB_DC_SUSPEND. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Fixes USB3CV Tool tests. One case is enabling endpoints with Set Interface after Set Configuration. In this case we report warning and continue without returning error. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Set false to enable flag on USB Reset. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
@finikorg: Which test mode are you using? I have tested |
Yes Compliance "Chapter 9 Tests [USB 2 devices]", only Remote Wakeup TD 9.12 is failing. I am on top of my above mentioned PR, my reel_board is the oldest version, probably you have newer one? |
@masz-nordic Anything against to merge it? |
@finikorg Mine is @jfischer-phytec-iot No, if this fixes problems from the original issue it is fine. I will create a separate one for USB3CV testcases. |
This reverts commit f206170 introduced as workaround for nRF USBD device controller in PR zephyrproject-rtos#16193. This commit may be reverted due to changes made in commit e326c58 ("usb: device: Do not cancel transfers on suspend"). Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com> Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This reverts commit f206170 introduced as workaround for nRF USBD device controller in PR #16193. This commit may be reverted due to changes made in commit e326c58 ("usb: device: Do not cancel transfers on suspend"). Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com> Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This reverts commit f206170 introduced as workaround for nRF USBD device controller in PR zephyrproject-rtos/zephyr#16193. This commit may be reverted due to changes made in commit e326c58 ("usb: device: Do not cancel transfers on suspend"). (cherry picked from commit 81e4934) Original-Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com> Original-Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no> GitOrigin-RevId: 81e4934 Change-Id: I1ee50ed7ec2f84e30c5c7df1c359277889b58b42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4432938 Tested-by: CopyBot Service Account <copybot.service@gmail.com> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
I still need to check suspend / resume properly working.
Fixes #15917