Skip to content

Conversation

@ptrcr
Copy link
Contributor

@ptrcr ptrcr commented May 15, 2025

The USB CDC driver is unable to process any bulk IN transfers after receiving 'Clear Feature - Endpoint Halt' request from host due to perpetual locked state caused by previously scheduled transfer, that will never be finished, as the endpoint's state is set to NAK. Fix by cancelling the transfer and releasing the resources blocking from scheduling next transfer upon receiving 'Clear Feature - Endpoint Halt' request.

Fixes #89990

@github-actions
Copy link

Hello @ptrcr, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@ptrcr ptrcr force-pushed the bugfix/usb-cdc-in-endpoint-stuck-after-receiving-clear-halt-request branch from acf96c2 to a2960c3 Compare May 23, 2025 12:50
@erwango erwango requested a review from jfischer-no May 27, 2025 08:40
jfischer-no
jfischer-no previously approved these changes May 30, 2025
nashif
nashif previously approved these changes May 31, 2025
ydamigos
ydamigos previously approved these changes Jun 2, 2025
@kartben kartben added the DNM This PR should not be merged (Do Not Merge) label Jun 2, 2025
@kartben
Copy link
Contributor

kartben commented Jun 2, 2025

Is this intentional that it's targeting the 3.7 branch? We would typically get the fix in the main branch and then backport.

@jfischer-no jfischer-no changed the base branch from v3.7-branch to main June 2, 2025 10:40
@jfischer-no jfischer-no dismissed stale reviews from ydamigos, nashif, and themself June 2, 2025 10:40

The base branch was changed.

@jfischer-no
Copy link
Contributor

jfischer-no commented Jun 2, 2025

Is this intentional that it's targeting the 3.7 branch? We would typically get the fix in the main branch and then backport.

Sorry, I did not notice it at all. @ptrcr Please rebase on main branch. Fixed it for you.

@jfischer-no jfischer-no force-pushed the bugfix/usb-cdc-in-endpoint-stuck-after-receiving-clear-halt-request branch from a2960c3 to b38fd19 Compare June 2, 2025 10:58
@github-actions github-actions bot requested a review from mathieuchopstm June 2, 2025 10:59
@jfischer-no jfischer-no removed the DNM This PR should not be merged (Do Not Merge) label Jun 2, 2025
@kartben
Copy link
Contributor

kartben commented Jun 2, 2025

Thanks @jfischer-no :)

The USB CDC driver is unable to process any bulk IN transfers
after receiving spurious 'Clear Feature - Endpoint Halt' request
from host due to perpetual locked state caused by previously
scheduled transfer, that will never be finished, as the endpoint's state
is set to NAK. Fix by ignoring spurious request.

Signed-off-by: Piotr Ciura <[email protected]>
@ptrcr ptrcr force-pushed the bugfix/usb-cdc-in-endpoint-stuck-after-receiving-clear-halt-request branch from b38fd19 to a35ef79 Compare June 2, 2025 12:43
@ptrcr
Copy link
Contributor Author

ptrcr commented Jun 2, 2025

Sorry @jfischer-no I did not notice the edited version of your comment and rebased again.

@ptrcr ptrcr requested review from jfischer-no, marwaiehm-st, nashif and ydamigos and removed request for jfischer-no June 2, 2025 12:52
@ptrcr
Copy link
Contributor Author

ptrcr commented Jun 2, 2025

@kartben Should I open another Pull Request to v3.7 branch once this PR is merged?

@kartben kartben added backport v3.7-branch Request backport to the v3.7-branch backport v4.0-branch Backport to the v4.0-branch backport v4.1-branch Request backport to the v4.1-branch labels Jun 2, 2025
@kartben
Copy link
Contributor

kartben commented Jun 2, 2025

@kartben Should I open another Pull Request to v3.7 branch once this PR is merged?

With the GitHub labels I just added, all the backport pull requests should be automatically created when this PR merges!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2025

return -EINVAL;
}

if (!ep_state->ep_stalled) {

This comment was marked as outdated.

@kartben kartben merged commit 29a191a into zephyrproject-rtos:main Jun 2, 2025
35 checks passed
@github-actions
Copy link

github-actions bot commented Jun 2, 2025

Hi @ptrcr!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus backport v3.7-branch Request backport to the v3.7-branch backport v4.0-branch Backport to the v4.0-branch backport v4.1-branch Request backport to the v4.1-branch platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STM32: USB: USB CDC IN Endpoint stuck forever after receiving Clear feature - endpoint halt request

7 participants