diff --git a/embassy-usb-synopsys-otg/CHANGELOG.md b/embassy-usb-synopsys-otg/CHANGELOG.md index 45353d9073..2e007aa72e 100644 --- a/embassy-usb-synopsys-otg/CHANGELOG.md +++ b/embassy-usb-synopsys-otg/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased - ReleaseDate +- Disabling an OUT endpoint no longer flushes the TX FIFO of the corresponding IN endpoint + ## 0.3.1 - 2025-08-26 - Improve receive performance, more efficient copy from FIFO diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs index d94209f453..8d22abd4ab 100644 --- a/embassy-usb-synopsys-otg/src/lib.rs +++ b/embassy-usb-synopsys-otg/src/lib.rs @@ -945,18 +945,6 @@ impl<'d, const MAX_EP_COUNT: usize> embassy_usb_driver::Bus for Bus<'d, MAX_EP_C regs.doepctl(ep_addr.index()).modify(|w| { w.set_usbaep(enabled); }); - - // Flush tx fifo - regs.grstctl().write(|w| { - w.set_txfflsh(true); - w.set_txfnum(ep_addr.index() as _); - }); - loop { - let x = regs.grstctl().read(); - if !x.txfflsh() { - break; - } - } }); // Wake `Endpoint::wait_enabled()` @@ -975,7 +963,19 @@ impl<'d, const MAX_EP_COUNT: usize> embassy_usb_driver::Bus for Bus<'d, MAX_EP_C regs.diepctl(ep_addr.index()).modify(|w| { w.set_usbaep(enabled); w.set_cnak(enabled); // clear NAK that might've been set by SNAK above. - }) + }); + + // Flush tx fifo + regs.grstctl().write(|w| { + w.set_txfflsh(true); + w.set_txfnum(ep_addr.index() as _); + }); + loop { + let x = regs.grstctl().read(); + if !x.txfflsh() { + break; + } + } }); // Wake `Endpoint::wait_enabled()`