In LPC1768 change keil USBHID example for bulk transfer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

In LPC1768 change keil USBHID example for bulk transfer

854 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Amir Poursadegh on Wed Oct 28 22:55:48 MST 2015
I changed the keil USBHID example like http://www.keil.com/forum/21413/lpc1769-usbhid-example/ and I could send 64 bytes about each 1 ms

my changes is a little different

in demo.c and demo.h
U8 InReport[64]

U8 OutReport[64]

demo.c
void GetInReport(void) {

for(amiri=0;amiri<64;amiri++)
{
InReport[amiri]=amiri;
}
}

void SetOutReport(void) {
for(amiri=0;amiri<64;amiri++)
{
OutReport[amiri]=InReport[amiri]
}
}

hiduser.c
...
GetInReport();
for(amiri2=0;amiri2<64;amiri2++)
{
EP0Buf[amiri2]=InReport[amiri2];

}
break;

...

case HID_REPORT_INPUT;
for(amiri2=0;amiri2<64;amiri2)
{
OutReport[amiri2]=EP0Buf[amiri2];
}

usbuser.c

...
if(USB_Configuration) {
GetInReport();
USB_WriteEP(HID_EP_IN, &InReport[64],sizeof(InReport));
}
...
void USB_EndPoint1 (U32 event) {
...
USB_WriteEP(HID_EP_IN, &InReport[64],sizeof(InReport));
...
}

and I can receive 64 byte (0 to 63) in C# by libusb

which changes needed for bulk transfer and send multiple endpoints??. I want to reach 1Mbyte/s speed, I know it's possible but I don't know which changes is needed ...
can I use Isochronous transfer and send 1000 bytes per milisecond and reach this speed?which changes is nedd for this?

I would be so thankful if someone help me
Labels (1)
0 Kudos
3 Replies

715 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ahoyhoy on Mon Nov 09 04:11:25 MST 2015
Hi Amir,

that's actually a good idea to use multiple end points. Might try this.

Are you using the nxp USB rom with HID and 1023 bytes per millisecond? I thought the rom limits the packet size, see app_usbd_cfg.h line 65 to 70

/* Manifest constants used by USBD LIB stack. These values SHOULD NOT BE CHANGED
   for advance features which require usage of USB_CORE_CTRL_T structure.
   Since these are the values used for compiling USB stack.
*/
#define USB_MAX_IF_NUM          8/*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
#define USB_MAX_EP_NUM          16/*!< Max number of EP used for building USBD_Lib. DON'T CHANGE. */
#define USB_MAX_PACKET0         64/*!< Max EP0 packet size used for building USBD_Lib. DON'T CHANGE. */
#define USB_FS_MAX_BULK_PACKET  64/*!< MAXP for FS bulk EPs used for building USBD_Lib. DON'T CHANGE. */
#define USB_HS_MAX_BULK_PACKET  512/*!< MAXP for HS bulk EPs used for building USBD_Lib. DON'T CHANGE. */
#define USB_DFU_XFER_SIZE       2048/*!< Max DFU transfer size used for building USBD_Lib. DON'T CHANGE. */

if you are able to use packet sizes of 1023 bytes, could you please let me know how? it would be greatly appreciated. thanks
0 Kudos

715 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Amir Poursadegh on Fri Nov 06 01:17:48 MST 2015
Hi ahoyhoy,

I'm new too in this area....:)

but I know in full speed, use isochronous transfer,1023 bytes per 1ms is possible or use bulk transfer and send multiple endpoints is another way to reach to this purpose..
but I really don't know what I have to do for this... I'm trying for this... I hope to be successful in near future...;)
0 Kudos

715 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ahoyhoy on Thu Nov 05 08:06:43 MST 2015
Hi Amir,

I have done something similar and I want to change the packet size to 1024 bytes per 1ms. Did you get any answers or help regarding this issue?

I too started with the HID example and got it to transmit and receive 64 byte packets. I used Microsoft Visual Express 2013 and an old hidapi library to communicate to the nxp LPC1778.

Since then I have bought the keil MCB4300 dev board with the LPC4357 on it because this micro-controllers can handle high-speed usb (1024 bytes per transaction). Where as the LPC1778 can only handle full speed (64 bytes per transaction)

I am still very new to the USB protocol so any help you can give me would be greatly appreciated.

0 Kudos