-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Description
Describe the bug
As the USB peripherals provides features to detect the USB bus and then enable the USB peripheral it's one of the ways to enable the USB device. The same approach is taken in Zephyrs samples for USB (if device provides such mechanism enable peripheral on VBUS notification).
On NRF5340 chip I have observed that the USB device does not get up after calling usbd_disable() and usbd_shutdown(). As I found out it is related to not cleaning the VBUSDETECT bit in the USBREGULATORE register.
The code checks if the chip has the possibility to detect the VBUS and waits for the notification while no notification is generated as the chip thinks the notification was given.
Cleaning provided bit was enough to get it working. After reenabling the device I assume that it has no configuration or any state from previous 'session'. To get it working without any modification it requires to manually call the usbd_enable().
Looks like I have made some mess while working on that - the register I mentioned is RO, so the only working solution is to enable USB manually.
Regression
- This is a regression.
Steps to reproduce
The easiest way to reproduce is to use the hid-keyboard demo and the following lines right after calling the sample_usbd_init_device:
usbd_disable(sample_usbd);usbd_shutdown(sample_usbd); sample_usbd_init_device();
Impact
Annoyance – Minor irritation; no significant impact on usability or functionality.
Environment
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status