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

usb: ZEPHYR FATAL ERROR when running USB test for Nordic. #29468

Closed
eobalski opened this issue Oct 23, 2020 · 0 comments · Fixed by #29474
Closed

usb: ZEPHYR FATAL ERROR when running USB test for Nordic. #29468

eobalski opened this issue Oct 23, 2020 · 0 comments · Fixed by #29474
Assignees
Labels
area: Tests Issues related to a particular existing or missing test area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Milestone

Comments

@eobalski
Copy link
Collaborator

Describe the bug
When running ./tests/subsys/usb/device test Zephyr will run into fatal error.

To Reproduce

Build and flash USB test (./tests/subsys/usb/device) for Nordic device, eg. nrf52840dk_nrf52840.

Expected behavior
The test should work and pass.

Impact
The root cause of the bug is that the test is reconfiguring USB in run time(usb_deconfig).
This function calls usb_dc_reset() which usb_dc_detach() and later usb_dc_attach().
usb_dc_attach() starts workqueue used internally for by Nordic driver. Starting workqueue
is firstly done on usb_enable() and later by usb_deconfig() this leads to the situation when
there is an attempt to start already started workqueue thread.

IMO this function should be dropped as we do not provide any sample that could disable/enable
USB during runtime. This was implemented to provide such functionality but it does not work
with the current USB device stack.

Logs and console output

START - test_usb_dc_api_invalid
D: ep_write: ep 0x20, len 1
D: ep_read: ep 0x20, maxlen 1
 PASS - test_usb_dc_api_invalid
===================================================================
START - test_usb_deconfig
D: USBD Reset
ASSERTION FAIL [old_val != 0x1337C0D3] @ WEST_TOPDIR/zephyr/kernel/thread.c:545
        re-use of active thread object 0x20000240 detected
E: r0/a1:  0x00000004  r1/a2:  0x00000221  r2/a3:  0x00000000
E: r3/a4:  0x000027bd r12/ip:  0x00000000 r14/lr:  0x000099b9
E:  xpsr:  0x61000000
E: Faulting instruction address (r15/pc): 0x0000a8a0
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Current thread: 0x200002e8 (unknown)
E: Halting system

Environment (please complete the following information):

  • OS: Ubuntu 16.04
  • Toolchain: zephyr-sdk v0.11.3
  • 668cbe1

Additional context
I will post a PR resolving this issue soon, just want to test it a bit more.

@eobalski eobalski added bug The issue is a bug, or the PR is fixing a bug area: USB Universal Serial Bus area: Tests Issues related to a particular existing or missing test labels Oct 23, 2020
@eobalski eobalski self-assigned this Oct 23, 2020
@eobalski eobalski added this to the v2.5.0 milestone Oct 23, 2020
@nashif nashif added the priority: medium Medium impact/importance bug label Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Tests Issues related to a particular existing or missing test area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants