USB stack artificially limits endpoints for LPC17XX

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by smoorby on Wed Apr 18 07:42:38 MST 2012
With the USB device block in the LPC17XX family there is support for 16 bidirectional logical endpoints.  This is realised by 32 physical endpoints alternating OUT / IN.  The nxpUSBlib code limits this in two ways :-

1/ ENDPOINT_TOTAL_ENDPOINTS is defined to be 6.
This is easily changed as needed.

2/ The global variable variable 'endpointhandle' is an array storing the mapping from logical to physical endpoint.  This array only allows you to map a logical endpoint number to either OUT or IN, not both as is supported by the hardware. 
This leads to what seems to me to be a strange descriptor for the 'Example_VirtualSerial' code.  CDC_TX_EPNUM is 2 and CDC_RX_EPNUM is 5.  Looking at it from the device point of view you might also expect the RX_EPNUM to be 2 rather than having to jump to the next endpoint capable of bulk transfers.  There's also several places in the code I've seen that assumes this restriction.

I guess this might not be of practical importance for a lot of applications, as long as they have enough endpoints for the application they perform.  Seems stange to me though that nxpUSBlib doesn't make best use of the very good USB device block in the LPC17XX.