Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in embassy-usb-synopsys-otg where disabling an OUT endpoint incorrectly triggered a TX FIFO flush — a TX FIFO operation that only makes sense for IN endpoints. The fix moves the TX FIFO flush logic from the Direction::Out branch to the Direction::In branch of endpoint_set_enabled, where it belongs, since TX FIFOs are allocated per-IN-endpoint on this hardware. This resolves a likely root cause for USB CDC NCM connectivity issues on STM32F405 (and similar Synopsys OTG-based chips).
Changes:
- Removes the TX FIFO flush from the OUT endpoint disable path
- Adds the TX FIFO flush (with wait loop) to the IN endpoint disable/enable path
- Documents the fix in the CHANGELOG
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
embassy-usb-synopsys-otg/src/lib.rs |
Moves TX FIFO flush from Direction::Out to Direction::In branch in endpoint_set_enabled |
embassy-usb-synopsys-otg/CHANGELOG.md |
Adds changelog entry for the bug fix under the Unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I confirm this fixes our issue on Linux where the esp32-s3 usb ethernet would not properly come up. With this fix, it works like a charm. |
When disabling an OUT endpoint, the previous implementation flushed a TX FIFO, but TX FIFOs are assigned to IN endpoints.
I think this closes (maybe not, though?) #5521 as the PR fixes an identical-looking issue on the ESP32-S3, and the F405 uses a different version of the same IP.