From ad4cf53ccd8efed561649afe5fe85bc98a28168f Mon Sep 17 00:00:00 2001 From: HiFiPhile Date: Fri, 5 Apr 2024 13:16:03 +0200 Subject: [PATCH] Workaround spurious ISO Tx interrupt. --- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 08d792bfa5..0c072cf10c 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -155,6 +155,7 @@ typedef struct uint16_t max_packet_size; uint16_t pma_alloc_size; uint8_t ep_idx; // index for USB_EPnR register + bool in_complete; // Workaround for ISO IN EP doesn't have interrupt mask } xfer_ctl_t; // EP allocator @@ -519,6 +520,10 @@ static void dcd_ep_ctr_tx_handler(uint32_t wIstr) xfer_ctl_t * xfer = xfer_ctl_ptr(ep_addr); + /* Ignore spurious int */ + if(xfer->in_complete) return; + xfer->in_complete = true; + if ((wEPRegVal & USB_EP_TYPE_MASK) == USB_EP_ISOCHRONOUS) { pcd_set_ep_tx_cnt(USB, EPindex, 0); } @@ -1041,8 +1046,11 @@ static void dcd_transmit_packet(xfer_ctl_t * xfer, uint16_t ep_ix) } xfer->queued_len = (uint16_t)(xfer->queued_len + len); + dcd_int_disable(0); pcd_set_ep_tx_cnt(USB, ep_ix, len); pcd_set_ep_tx_status(USB, ep_ix, USB_EP_TX_VALID); + xfer->in_complete = false; + dcd_int_enable(0); }