aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src/pipe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'usbh/src/pipe.rs')
-rw-r--r--usbh/src/pipe.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/usbh/src/pipe.rs b/usbh/src/pipe.rs
index abdba2a..80ebe11 100644
--- a/usbh/src/pipe.rs
+++ b/usbh/src/pipe.rs
@@ -321,9 +321,9 @@ impl Pipe<'_, '_> {
ep.out_toggle,
);
if self.regs.status.read().dtgl().bit_is_set() {
- self.dtgl_clear();
- } else {
self.dtgl_set();
+ } else {
+ self.dtgl_clear();
}
if token == PToken::In {
ep.in_toggle = self.regs.status.read().dtgl().bit_is_set()
@@ -377,6 +377,13 @@ impl Pipe<'_, '_> {
last_err = e;
match last_err {
PipeErr::DataToggle => self.dtgl(ep, token),
+
+ // Flow error on interrupt pipes means we got
+ // a NAK, which in this context means there's
+ // no data. cf ยง32.8.7.5 of SAM D21 data
+ // sheet.
+ PipeErr::Flow if ep.transfer_type == TransferType::Interrupt => break,
+
PipeErr::Stall => break,
_ => {
naks += 1;