Skip to content

Commit

Permalink
Workaround spurious ISO Tx interrupt.
Browse files Browse the repository at this point in the history
  • Loading branch information
HiFiPhile committed Apr 5, 2024
1 parent cf9257f commit a4848b5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1039,8 +1044,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);

}

Expand Down

0 comments on commit a4848b5

Please sign in to comment.