Fix missed ep0-data-out transaction

The ep0-out buffer must not be marked as available unless required.
Otherwise, the controller will acknowledge the data-out packet but
won't reflect that in its status registers.

This patch forces the controller to nack the data-out phase until we have
processed the setup packet.
This commit is contained in:
Wilfried Chauveau 2022-07-30 10:09:20 +01:00
parent 067f1396d9
commit fa7c9275b4
No known key found for this signature in database
GPG key ID: 0BC4C0B2B0879D6A

View file

@ -352,8 +352,12 @@ impl Inner {
w.full_0().clear_bit();
w.pid_0().bit(!r.pid_0().bit())
});
if index != 0 || len == ep.max_packet_size.into() {
// only mark as available on the control endpoint if and only if the packet was
// max_packet_size
cortex_m::asm::delay(12);
buf_control.modify(|_, w| w.available_0().set_bit());
}
Ok(len)
}
}