Skip to content

Conversation

@tmon-nordic
Copy link
Contributor

It is possible for usbd_disable() to be called when the core is hibernated. When done so, the USB stack will attempt to deactivate all the endpoints. Because the core is hibernated, register reads are really undefined. This can lead to udc_dwc2_ep_deactivate() not calling udc_dwc2_ep_disable() which will leave struct udc_ep_config busy flag set.

When endpoint 0x00 busy flag is left to true, the driver won't allocate buffer to receive SETUP data which is mandatory in Buffer DMA mode. This leads to essentially dead device after reconnect, because the device will not respond to any control transfers.

Solve the issue by modifying backup register value instead of real one when endpoint is deactivated while core is hibernated.

It is possible for usbd_disable() to be called when the core is
hibernated. When done so, the USB stack will attempt to deactivate all
the endpoints. Because the core is hibernated, register reads are
really undefined. This can lead to udc_dwc2_ep_deactivate() not calling
udc_dwc2_ep_disable() which will leave struct udc_ep_config busy flag
set.

When endpoint 0x00 busy flag is left to true, the driver won't allocate
buffer to receive SETUP data which is mandatory in Buffer DMA mode. This
leads to essentially dead device after reconnect, because the device
will not respond to any control transfers.

Solve the issue by modifying backup register value instead of real one
when endpoint is deactivated while core is hibernated.

Signed-off-by: Tomasz Moń <[email protected]>
@zephyrbot zephyrbot added the area: USB Universal Serial Bus label Oct 22, 2025
@sonarqubecloud
Copy link

@jfischer-no jfischer-no added bug The issue is a bug, or the PR is fixing a bug area: Drivers labels Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Drivers area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants