stm32 fsdev dcd: set ISO IN count inside the critical section A VALID single-buffered ISO IN starts sending as soon as its count is set. Setting the count before entering the section let a host IN token send the packet before iso_in_sending was armed, so the USB ISR ignored the completion.
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 1ca945f..bd0c299 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -719,10 +719,10 @@ } xfer->queued_len += len; - btable_set_count(ep_ix, buf_id, len); - // Re-read inside the section: the fifo copy above may take the fifo mutex, so it stays outside usbd_critical_enter(in_isr); + // A VALID single-buffered ISO IN sends as soon as the count is set, so set it with iso_in_sending + btable_set_count(ep_ix, buf_id, len); // Set inside the section so a spurious ISO CTR cannot claim the packet before it is armed if (is_iso) { xfer->iso_in_sending = true;