From e523acf824d24a45c3194a191057e1ed8f87b75d Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 26 Oct 2016 11:12:01 +0000 Subject: [PATCH] Fixed bug #786. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9879 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.c | 12 +++++++++--- readme.txt | 2 ++ 2 files changed, 11 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) && diff --git a/readme.txt b/readme.txt index c87ec5a18..cd2a3e3b9 100644 --- a/readme.txt +++ b/readme.txt @@ -147,6 +147,8 @@ - RT: Merged RT4. - NIL: Merged NIL2. - NIL: Added STM32F7 demo. +- HAL: Fixed OTGv1 driver not functional on STM32L4 (bug #786)(backported + to 16.1.6). - HAL: Fixed wrong bit offset in STM32F37x ADC_CR2_EXTSEL_SRC() macro (bug #785)(backported to 16.1.6, 3.0.6). - RT: Fixed tick-less mode can fail in RT for very large delays (bug #784)