AnsweredAssumed Answered

STM32 USB disable endpoint interrupt is not generated

Question asked by donchev.petar on Aug 17, 2014
Latest reply on Nov 18, 2015 by kessler.vincent
I'm working on usb device project and I need after receiving a command from the host to return the device to predetermined state. To do this, all prepared OUT transfers must be canceled. I set endpoint disable bit(EPDIS) in the endpoint control register. USB core must generate endpoint disable interrupt, but this never happens. The interrupt is not masked. I checked with a debugger inside the interrupt service routine, that bit EPDIS remain set.
What I'm doing wrong?
This is the code of endpoint disable function:

void USB_OTG_DisableEP (USB_OTG_CORE_HANDLE *pdev , USB_OTG_EP *ep)
{
  USB_OTG_DEPCTL_TypeDef  depctl;
  __IO uint32_t *depctl_addr;

  /* Process for IN endpoint */
  if (ep->is_in == 1)
  {
    depctl_addr = &(pdev->regs.INEP_REGS[ep->num]->DIEPCTL);
    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
  }
  else /* Process for OUT endpoint */
  {
    depctl_addr = &(pdev->regs.OUTEP_REGS[ep->num]->DOEPCTL);
    depctl.d32 = USB_OTG_READ_REG32(depctl_addr);
  }

  if(depctl.b.epena)
  {
      depctl.b.epena = 0;
      depctl.b.epdis = 1;
      depctl.b.snak = 1;
  }

  USB_OTG_WRITE_REG32(depctl_addr, depctl.d32);
}



Outcomes