diff options
| author | William D. Jones <[email protected]> | 2019-01-23 00:44:55 -0500 |
|---|---|---|
| committer | William D. Jones <[email protected]> | 2019-01-23 00:44:55 -0500 |
| commit | 17e418bce4ae25a009b283d5475bec85ad1650ac (patch) | |
| tree | 82aa9aa7129905f1c269128312ed67a2ed06e36e | |
| parent | d1150432fe89750f49b5a36dbc08838dcf5214ec (diff) | |
stm32f4: Fix incorrect xfer length for short packet IN xfers.
| -rw-r--r-- | src/portable/stm/stm32f4/dcd_stm32f4.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/portable/stm/stm32f4/dcd_stm32f4.c b/src/portable/stm/stm32f4/dcd_stm32f4.c index b2d308d72..4adb52a76 100644 --- a/src/portable/stm/stm32f4/dcd_stm32f4.c +++ b/src/portable/stm/stm32f4/dcd_stm32f4.c @@ -488,7 +488,8 @@ void OTG_FS_IRQHandler(void) { uint16_t remaining = (in_ep[n].DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DIEPTSIZ_XFRSIZ_Pos; xfer->queued_len = xfer->total_len - remaining; - for(uint8_t i = 0; i < xfer->max_size; i++) { + uint16_t to_xfer_size = (remaining > xfer->max_size) ? xfer->max_size : remaining; + for(uint16_t i = 0; i < to_xfer_size; i++) { (* tx_fifo) = xfer->buffer[xfer->queued_len + i]; } } |
