From 6cad159483b99aafebb4070c280cc2869d9eacdb Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 17 Dec 2020 22:12:15 +0100 Subject: [PATCH] stm32-f4discovery-usb: don't re-activate the channel for BULK endpoints --- .../STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/port/stm32-f4discovery-usb/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c b/port/stm32-f4discovery-usb/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c index f0ffd0b14..6a7476015 100644 --- a/port/stm32-f4discovery-usb/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c +++ b/port/stm32-f4discovery-usb/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c @@ -1306,11 +1306,16 @@ static void HCD_HC_IN_IRQHandler(HCD_HandleTypeDef *hhcd, uint8_t chnum) else if (hhcd->hc[ch_num].state == HC_NAK) { hhcd->hc[ch_num].urb_state = URB_NOTREADY; - /* re-activate the channel */ - tmpreg = USBx_HC(ch_num)->HCCHAR; - tmpreg &= ~USB_OTG_HCCHAR_CHDIS; - tmpreg |= USB_OTG_HCCHAR_CHENA; - USBx_HC(ch_num)->HCCHAR = tmpreg; + + // BK: don't re-activate the channel for BULK endpoints + if (hhcd->hc[ch_num].ep_type != EP_TYPE_BULK){ + /* re-activate the channel */ + tmpreg = USBx_HC(ch_num)->HCCHAR; + tmpreg &= ~USB_OTG_HCCHAR_CHDIS; + tmpreg |= USB_OTG_HCCHAR_CHENA; + USBx_HC(ch_num)->HCCHAR = tmpreg; + } + // BK: end fix } else if (hhcd->hc[ch_num].state == HC_BBLERR) {