Problem with IN and OUT endpoints

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Hansi on Sat Aug 04 13:37:50 MST 2012

I'm evaluating nxpUSBlib for a small project. This should not use any USB device class but implement a fully custom protocol.

My first problem was that in the .zip file there are no examples for this use case. I had to dive into the USB class .c files and distill how to transfer data through endpoints by hand. Could you please implement such an example? If desired, I gladly offer my current "training" example. :-)

The second problem is IMHO a real bug in the endpoint handling. In nxpUSBlib/Drivers/USB/Core/LPC/DCD/EndpointCommon.h and in nxpUSBlib/Drivers/USB/Core/LPC/Endpoint_LPC.c the variable <code>endpointhandle</code> is defined. This maps logical endpoint numbers (as array index) to physical endpoint numbers (the values are set by <code>Endpoint_ConfigureEndpoint()</code>).

This leads to the problem, that for every logical endpoint, only either the IN or the OUT endpoint can be used. So if you want to transmit data in both directions, you can not use e.g. EP2IN and EP2OUT, but you have to use EP2IN and EP3OUT.

The USB specification does not create this restriction, and neither does the LPC11Uxx USB hardware. Indeed, I used the setup using EP2IN and EP2OUT before with multiple projects involving an EZ-USB AN2131 chip.

Why didn't come up anybody with this problem before? Why didn't it show up with the USB class examples?