USB probleme on function call of "EnableEvent"

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by namorada on Fri Oct 09 08:20:37 MST 2015

I'm trying to implement a homemade USB driver in a LPC1825.
Communication happens on the endpoint 2.
For this, I try to initialize it like that:

retour = USBD_API->core->RegisterEpHandler(g_hUsb, 5, EP2_Hdlr, 0);
USBD_API->hw->EnableEP(g_hUsb, EP2_IN);
retour = USBD_API->hw->EnableEvent(g_hUsb, 0x82, USB_EVT_OUT & USB_EVT_IN, 0x01);

The fonction "EnableEvent" always return me : ERR_USBD_INVALID_REQ
The documentation about this function is really light. Any idea of why it is giving me this error?

Did i miss something?
Does anyone have an example of a  custom EndPoint2 initialization?