i all,
I am working with Keil for software development of my custom board which is based on LPC2368 device.
I could run USBHID and USBaudio code samples of keil now when I want to change length of data for EP1 and send a string instead of one byte it won't send the stream anyway it has some problem with the length of data?! while I saw that Ep1 max packet size is defined 64bytes?!..
can anybody help me with this issue.
below I copied codes:
/* * USB Endpoint 1 Event Callback * Called automatically on USB Endpoint 1 Event * Parameter: event */
void USB_EndPoint1 (DWORD event) { BYTE str[] = {"This is a test for USB2.0 Connection Speed."}; switch (event) { case USB_EVT_IN: // GetInReport(); // USB_WriteEP(0x81, &InReport, sizeof(InReport)); USB_WriteEP(0x81, &str[0], sizeof(str)); break; } }
DWORD USB_WriteEP (DWORD EPNum, BYTE *pData, DWORD cnt) { DWORD n;
USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN;
TX_PLENGTH = cnt;
for (n = 0; n < (cnt + 3) / 4; n++) { TX_DATA = *((__packed DWORD *)pData); pData += 4; }
delay_ms(1); USB_CTRL = 0;
WrCmd(CMD_SEL_EP(EPAdr(EPNum))); WrCmd(CMD_VALID_BUF);
return (cnt); }