[Patch][LPC17xx] Multiple endpoints and buffers

cancel
Showing results for 
Search instead for 
Did you mean: 

[Patch][LPC17xx] Multiple endpoints and buffers

238 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Fri Dec 27 11:25:55 MST 2013
Hello,

I would like to share my patch against version 0.98 to remove some of the limitations:
- Only on logical endpoint at a time (shared IN and OUT)
- shared buffers (preventing using composite devices or send and receiving at the same time)

I've split the patches in two for convenience: The first one set a buffer per logical endpoint (for this I had to decrease the buffer size from 512 to 64 bytes and left the number of enpoints to 6)
The second patch includes the first one + the ability to have all the endpoints (removing the limitation to only use one physical endpoint at a time)

Limitations:
- Only tested on lpc1769. I've made the changes for all the platforms, but I did'nt even tried to compile them.
- Tested against CDC example only. Even if it should work with other examples (after some minor modification, see below).
- The fact that I decreased the buffers from 512 to 64 bytes may break something (I've seen some hardcoded values of 512 for isochronous endpoints. So the audio examples may not work anymore. Since my next project is about audio, I will test it quickly enough)
- I've seen some weird code for the  11Uxx platform: Remain_length array is per logical enpoint and not per physical endpoint...


To apply the patch, just go the libraries/LPCUSBLib and do
patch -p2 < file.patch

Apply only one of the 2 patches, not both. I recommend the second one, the first one is only for testing.



To have access to all the endpoints, you have to do a small modification in the examples, when constructing the descriptor endpoints.
Currently, it's a logical endpoint. I've converted them to physical endpoints. Logical endpoints are not used anymore.

example for CDC:
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber         = 0,

.DataINEndpointNumber           = (CDC_TX_EPNUM<<1) | 1,
.DataINEndpointSize             = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank       = false,

.DataOUTEndpointNumber          = (CDC_RX_EPNUM<<1) ,
.DataOUTEndpointSize            = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank      = false,

.NotificationEndpointNumber     = (CDC_NOTIFICATION_EPNUM<<1) | 1,
.NotificationEndpointSize       = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
},
};


Since I don't know when the lpc17xx platform will be supported with the new usb lib, I've made the changes for the current 0.98 version of the library. I don't know if the new library will still have the limitations....

Hope this will help.


Fariouche

Original Attachment has been moved to: 01-usb_multi_buffers.patch.zip

Original Attachment has been moved to: 02-usb_in_out_endpoints.patch.zip

Labels (1)
0 Kudos
2 Replies

100 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Thu Jan 02 08:23:36 MST 2014
Hello,

Here is a second patch.
With this patch, to be put above the other patch, everything works as expected.
Audio is also working.

Now you can enjoy per endpoints buffers and have access to all the IN and OU endpoints at the same time!

Best test will be to build a usb composite device (next step, with audio and CDC at the same time!)


Enjoy
0 Kudos

100 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fariouche on Fri Dec 27 16:44:01 MST 2013
by the way, I will post later an other patch to set the buffer size individually. This is currently such a waste of space when using CDC with enpoint buffers of 8 bytes only! ;)
0 Kudos