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); }
Ah, I see. You didn't ignore "switch (event)" on the code, but you ignored forum regulation to post code. And then, the forum engine mixes up your code lines.
Anyway, read my post of 10-May-2011 19:26 GMT on this topic. http://www.keil.com/forum/18571/ I'm bored to answer to quite alike questions.
99% of the code on keil USB examples are same for MCUs of NXP LPC family. Just the PINSEL and USB clock settings are different.
Tsuneo
Hi, I couldn't find USB_HID_REPORT_IN & USB_HID_REPORT_OUT in my source files of HIDUSB project. I only found some parameters which look like the one has been mentioned in the thread and that is : HID_ReportCount(3), HID_ReportSize(2),
which are related to the HID_ReportDescriptor array defined in usbdesc.c file. Would you please tell me which parameters I should change for LPC2368 in usb source files?
thanks, Hossein
Ah, this one is more alike to the LPC2368 example than above post. The descriptors are same. http://www.keil.com/forum/11137/
Ah, this post is more alike to the LPC2368 example than above post. The descriptors are same. http://www.keil.com/forum/11137/
> I couldn't find USB_HID_REPORT_IN & USB_HID_REPORT_OUT > in my source files of HIDUSB project.