diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.c b/os/hal/platforms/STM32/USBv1/usb_lld.c index eac014de0..22af59866 100644 --- a/os/hal/platforms/STM32/USBv1/usb_lld.c +++ b/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -350,13 +350,11 @@ CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) { transmitted = (size_t)USB_GET_DESCRIPTOR(ep)->TXCOUNT0; epcp->in_state->txcnt += transmitted; - epcp->in_state->txsize -= transmitted; - if (epcp->in_state->txsize > 0) { + n = epcp->in_state->txsize - epcp->in_state->txcnt; + if (n > 0) { /* Transfer not completed, there are more packets to send.*/ - if (epcp->in_state->txsize > epcp->in_maxsize) + if (n > epcp->in_maxsize) n = epcp->in_maxsize; - else - n = epcp->in_state->txsize; if (epcp->in_state->txqueued) usb_packet_write_from_queue(USB_GET_DESCRIPTOR(ep), diff --git a/readme.txt b/readme.txt index 594592590..a92dab5e0 100644 --- a/readme.txt +++ b/readme.txt @@ -89,6 +89,7 @@ ***************************************************************************** *** 2.5.2 *** +- FIX: Fixed wrong STM32 USBv1 driver behavior (bug #410). - FIX: Fixed STM32 wrong peripherals reset procedure (bug #409)(backported to 2.4.4). - FIX: Fixed STM32 SPIv2 polled exchange (bug #372).