cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 & STM32F7 USB Host Core (Interrupt flood)

Tim Michals
Associate II
Posted on May 19, 2017 at 01:02

Issue:

USB Core issing interrupt at a rate of 8.65us causing high CPU loading.

Software/Chip:

Using USB Host/CDC from STM32Cube V1.15 on a STM32F429 board. 

  USB interrupt sources:

- SOF Interrupts (It is not needed for CDC type transfers) turned this interrupt off and still getting high interrupt rate.

   This is configured in

HAL_StatusTypeDef USB_HostInit (USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg)

.....

  /* Enable interrupts matching to the Host mode ONLY */

  USBx->GINTMSK |= (USB_OTG_GINTMSK_PRTIM            | USB_OTG_GINTMSK_HCIM |\

                 

   USB_OTG_GINTMSK_SOFM

|USB_OTG_GINTSTS_DISCINT|\

                    USB_OTG_GINTMSK_PXFRM_IISOOXFRM  | USB_OTG_GINTMSK_WUIM);

 

  return HAL_OK;

}

- NAK interrupts from bulk in endpoint.  The issue is when the OTG USB gets enough NAKs from the bulk endpoint and issues an interrupt at a rate of 8.625us. 

Solutions

?

Is there a work around that does not degrade USB performance?  The STM32FH7 also has has the same code to re-enable the bulk in endpoint. 

static void HCD_HC_IN_IRQHandler   (HCD_HandleTypeDef *hhcd, uint8_t chnum)

  }

  else if ((USBx_HC(chnum)->HCINT) &  USB_OTG_HCINT_NAK)

  {   

    if(hhcd->hc[chnum].ep_type == EP_TYPE_INTR)

    {

      __HAL_HCD_UNMASK_HALT_HC_INT(chnum);  

      USB_HC_Halt(hhcd->Instance, chnum);   

    }

    else if  ((hhcd->hc[chnum].ep_type == EP_TYPE_CTRL)||

         (hhcd->hc[chnum].ep_type == EP_TYPE_BULK))

    {

      /* re-activate the channel  */

      tmpreg = USBx_HC(chnum)->HCCHAR;

      tmpreg &= ~USB_OTG_HCCHAR_CHDIS;

      tmpreg |= USB_OTG_HCCHAR_CHENA;

      USBx_HC(chnum)->HCCHAR = tmpreg;

    }

    hhcd->hc[chnum].state = HC_NAK;

    __HAL_HCD_CLEAR_HC_INT(chnum, USB_OTG_HCINT_NAK);

  }

}

There are several postings about this issue (The first posting is the best description of the issue)

https://community.st.com/0D50X00009XkYz2SAF

 

https://community.st.com/0D50X00009XkYSSSA3

 

https://community.st.com/0D50X00009Xked0SAB

 

null
37 REPLIES 37
Imen.D
ST Employee
Posted on May 23, 2017 at 13:33

Hi,

Thank you for this reported issue. This is shared internally for further review and investigation.

I will keep you informed about the taken actions/explanation if needed.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 30, 2017 at 20:52

Imen,

Status update?

Thanks,

Tim

Posted on June 29, 2017 at 16:50

Status update?

Posted on July 06, 2017 at 12:54

Hi

Michals.Tim

,

I will check internally the status of your issue & come back to you as soon as possible with any update on this.

Sorry for the inconvenience may bring.

With Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on July 20, 2017 at 15:44

Status? 

Klang.Martin
Associate III
Posted on January 02, 2018 at 16:56

Any news on this?

I am experiencing the same problem.

Posted on February 05, 2018 at 00:03

It takes a lot of time to solve this issueI I have it too: USB FS CDC in Host mode, interrupts every 8 us or so on an STM32F745. Almost 50% of the processor time is lost in this interrupt. Is there any solution?

Ant M
Associate II
Posted on February 13, 2018 at 13:17

Any update? Having the same issue.

Imen.D
ST Employee
Posted on February 27, 2018 at 11:11

Dear All,

Sorry for this late answer.

In fact, DMA mode is recommended in case using HS IP in order to optimize the CPU and let the core managing the reactivation of the channel.

Recently

,

we have reworked the HAL driver for STM32F7 to enhance this part

and i

t should be available in the next release of the STM32CubeF7 v1.10.0.

Kind Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen