diff options
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c index 22ea69f31..52e44f011 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c @@ -414,11 +414,17 @@ static void otg_epout_handler(USBDriver *usbp, usbep_t ep) { /* Setup packets handling, setup packets are handled using a
specific callback.*/
_usb_isr_invoke_setup_cb(usbp, ep);
-
}
if ((epint & DOEPINT_XFRC) && (otgp->DOEPMSK & DOEPMSK_XFRCM)) {
- /* Receive transfer complete.*/
- USBOutEndpointState *osp = usbp->epc[ep]->out_state;
+ USBOutEndpointState *osp;
+
+ /* Receive transfer complete, checking if it is a SETUP transfer on EP0,
+ that it must be ignored, the STUPM handler will take care of it.*/
+ if ((ep == 0) && (usbp->ep0state == USB_EP0_WAITING_SETUP))
+ return;
+
+ /* OUT state structure pointer for this endpoint.*/
+ osp = usbp->epc[ep]->out_state;
/* A short packet always terminates a transaction.*/
if (((osp->rxcnt % usbp->epc[ep]->out_maxsize) == 0) &&
|