Skip to content

Commit 55fa2a6

Browse files
committed
CHH flood fix only for CONTROL endpoints
1 parent 2d7534e commit 55fa2a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/targets/TARGET_STM/USBHALHost_STM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ void USBHALHost::UsbIrqhandler()
456456
USBx_HC(ch_num)->HCINTMSK |= USB_OTG_HCINT_NAK;
457457

458458
// workaround the interrupts flood issue: re-enable CHH interrupt
459-
USBx_HC(ch_num)->HCINTMSK |= USB_OTG_HCINT_CHH;
459+
if(hhcd->hc[ch_num].ep_type == EP_TYPE_CTRL)
460+
USBx_HC(ch_num)->HCINTMSK |= USB_OTG_HCINT_CHH;
460461
}
461462
}
462463

@@ -467,6 +468,7 @@ void USBHALHost::UsbIrqhandler()
467468
{
468469
for (ch_num = 0; ch_num < hhcd->Init.Host_channels; ch_num++)
469470
{
471+
LogicUint7(USBx_HC(ch_num)->HCINT);
470472
if ((hhcd->hc[ch_num].ep_type == EP_TYPE_CTRL) || (hhcd->hc[ch_num].ep_type == EP_TYPE_BULK))
471473
{
472474
if (USBx_HC(ch_num)->HCINT & USB_OTG_HCINT_NAK)
@@ -475,7 +477,7 @@ void USBHALHost::UsbIrqhandler()
475477
USBx_HC(ch_num)->HCINTMSK &= ~USB_OTG_HCINT_NAK;
476478
}
477479

478-
if (USBx_HC(ch_num)->HCINT & USB_OTG_HCINT_CHH)
480+
if ((USBx_HC(ch_num)->HCINT & USB_OTG_HCINT_CHH) && (hhcd->hc[ch_num].ep_type == EP_TYPE_CTRL))
479481
{
480482
// workaround the interrupts flood issue: disable CHH interrupt
481483
USBx_HC(ch_num)->HCINTMSK &= ~USB_OTG_HCINT_CHH;

0 commit comments

Comments
 (0)