@@ -439,12 +439,12 @@ void USBHALHost::_usbisr(void)
439
439
}
440
440
}
441
441
442
+
442
443
void USBHALHost::UsbIrqhandler ()
443
444
{
444
445
#if ARC_USB_FULL_SIZE
445
446
// fix from Lix Paulian : https://community.st.com/t5/stm32-mcus-products/stm32f4-stm32f7-usb-host-core-interrupt-flood/td-p/436225/page/4
446
-
447
- // Enable USB_OTG_HCINT_NAK interrupts for CTRL and BULK on USB_OTG_GINTSTS_SOF (1ms)
447
+ // Change to also stop flooding of channel halt interrupt
448
448
uint32_t ch_num;
449
449
HCD_HandleTypeDef* hhcd = (HCD_HandleTypeDef *)usb_hcca;
450
450
@@ -454,24 +454,33 @@ void USBHALHost::UsbIrqhandler()
454
454
{
455
455
// workaround the interrupts flood issue: re-enable NAK interrupt
456
456
USBx_HC (ch_num)->HCINTMSK |= USB_OTG_HCINT_NAK;
457
+
458
+ // workaround the interrupts flood issue: re-enable CHH interrupt
459
+ USBx_HC (ch_num)->HCINTMSK |= USB_OTG_HCINT_CHH;
457
460
}
458
461
}
462
+
459
463
460
464
HAL_HCD_IRQHandler ((HCD_HandleTypeDef *)usb_hcca);
461
465
462
- // Disable USB_OTG_HCINT_NAK interrupts for CTRL and BULK on USB_OTG_GINTSTS_HCINT
463
466
if (__HAL_HCD_GET_FLAG (hhcd, USB_OTG_GINTSTS_HCINT) && hhcd->Init .dma_enable == 0 )
464
467
{
465
468
for (ch_num = 0 ; ch_num < hhcd->Init .Host_channels ; ch_num++)
466
469
{
467
- if (USBx_HC ( ch_num)-> HCINT & USB_OTG_HCINT_NAK )
470
+ if ((hhcd-> hc [ ch_num]. ep_type == EP_TYPE_CTRL) || (hhcd-> hc [ch_num]. ep_type == EP_TYPE_BULK) )
468
471
{
469
- if ((hhcd-> hc [ ch_num]. ep_type == EP_TYPE_CTRL) || (hhcd-> hc [ch_num]. ep_type == EP_TYPE_BULK) )
472
+ if (USBx_HC ( ch_num)-> HCINT & USB_OTG_HCINT_NAK )
470
473
{
471
474
// workaround the interrupts flood issue: disable NAK interrupt
472
475
USBx_HC (ch_num)->HCINTMSK &= ~USB_OTG_HCINT_NAK;
473
476
}
474
- }
477
+
478
+ if (USBx_HC (ch_num)->HCINT & USB_OTG_HCINT_CHH)
479
+ {
480
+ // workaround the interrupts flood issue: disable CHH interrupt
481
+ USBx_HC (ch_num)->HCINTMSK &= ~USB_OTG_HCINT_CHH;
482
+ }
483
+ }
475
484
}
476
485
}
477
486
#else
0 commit comments