Skip to content

feat: PROVES USP radio integration (collapses PRs #1-#2) - #3

Closed
Mikefly123 wants to merge 4 commits into
v4.4.1-basefrom
feat/proves-usp-radio
Closed

feat: PROVES USP radio integration (collapses PRs #1-#2)#3
Mikefly123 wants to merge 4 commits into
v4.4.1-basefrom
feat/proves-usp-radio

Conversation

@Mikefly123

Copy link
Copy Markdown

Purpose

Collapses the two open CDC-ACM fix branches into a single integration branch off v4.4.1-base, so the proves-core-reference superproject has one stable west pin for zephyr instead of tracking two separate branches.

This branch is a --no-ff merge of PR #1 then PR #2, in order, onto v4.4.1-base. Both constituent PRs stay open for traceability/review; do not merge or close them as part of landing this branch.

Constituent PRs

Both PRs touch subsys/usb/device_next/class/usbd_cdc_acm.c; merge #2 applied cleanly on top of #1 (git auto-merge, no manual conflict resolution needed).

Verification

Diffed the resulting subsys/usb/device_next/class/usbd_cdc_acm.c against a pristine v4.4.1 checkout with patches 0005-fix-usbd-cdc-acm-stuck-tx-fifo-busy-on-disable-and-retry.patch and 0007-fix-usbd-cdc-acm-bound-poll-out-backpressure-wait.patch applied in order — byte-identical.

Related

…stuck

Problem: if the USB host stops issuing IN tokens while a CDC-ACM TX
transfer is in flight (e.g. a host-side driver that pauses polling
without disconnecting), CDC_ACM_TX_FIFO_BUSY is left set indefinitely.
The existing error-completion path clears the flag on disconnect or
transfer cancellation, but a passive stall that never fires a
completion leaves it stuck. Once stuck, uart_poll_out() keeps
scheduling cdc_acm_tx_fifo_handler(), but the handler returns
immediately on every invocation because the busy check short-circuits
it, so the TX path stops draining permanently even after the host
resumes polling.

Mechanism: usbd_cdc_acm_disable() now clears CDC_ACM_TX_FIFO_BUSY,
guaranteeing the flag starts clean on the next enable/reconnect cycle.
Additionally, when cdc_acm_tx_fifo_handler() finds BUSY already set
and the ring buffer still has data pending, it reschedules itself
after a 10 ms delay instead of returning permanently. If BUSY clears
normally when the in-flight transfer completes, the retry fires once
more and is a no-op (the ring buffer is already drained). If BUSY is
stuck because the host stopped acknowledging the IN endpoint, the
handler keeps retrying every 10 ms at negligible CPU cost until the
host resumes polling and the transfer completes.

Fix: the pending retry re-arms the IN endpoint as soon as the host
resumes issuing IN tokens, instead of requiring an explicit
disable/enable cycle (e.g. USB replug) to recover the TX path.

Signed-off-by: Michael Pham <phamlongmichael@gmail.com>
Problem: cdc_acm_poll_out() sleep-retries in an unbounded loop while
the TX ring buffer is full and flow control is active. When a host
session is attached but stalled (e.g. a host-side USB driver that
stops issuing IN tokens for an extended period without disconnecting),
this loop blocks for the full duration of the stall on every console
byte written. Any thread that logs while this is happening backs up
behind the stalled writer, and if enough producers share the same
downstream queues, the backpressure cascades into a system-wide
livelock rather than staying contained to the console path.

Fix: cap the retry loop at 20 iterations of the existing 1 ms sleep
(~20 ms total). Once the retry budget is exhausted, treat the
still-attached-but-unresponsive session the same as the already-handled
detached case: log once and discard the pending byte instead of
continuing to block. This keeps the console best-effort under sustained
backpressure while leaving the normal (non-stalled) flow-controlled
path unaffected, since the loop still exits immediately once the ring
buffer drains.

Signed-off-by: Michael Pham <phamlongmichael@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ba6757be-bd92-4e5a-859a-ab733d5428bb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Mikefly123

Copy link
Copy Markdown
Author

Superseded by native GitHub stacked PRs #1 and #2 (stack zephyrproject-rtos#4, linked via gh stack link --base v4.4.1-base 1 2). PR #2 rebased onto PR #1's head (git rebase --onto); stack-top tree verified identical to this branch's head (3838a28) — file-level and full-tree diff both empty, tree hash 1602620... matches on both sides.

Closing this integration PR; the feat/proves-usp-radio branch is retained (not deleted) since proves-core-reference's west.yml pins it at 3838a28.

@Mikefly123 Mikefly123 closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant