We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi friends.
My English is very limited.
I am sending data to a computer via USB and LPC2368. but the data comes back to me once, come back I want to stop. Would not help but do?
Thank you.
Link: www.4shared.com/.../USBHID.html
As your firmware always puts data to the HID interrupt IN endpoint, the data is always sent to the PC. If you want to send the data just when it is required, pass the data to the endpoint just when it is required.
Keil HID example passes data in the endpoint interrupt, to make the stuff simple. But it isn't practical, as you experienced.
On the later half (from my post on 26-Sep-2009 03:46 GMT) of this thread, we've discussed on this problem and its solutions. http://www.keil.com/forum/docs/thread15613.asp
Tsuneo
Usb hid in you please advise if you have the example files? I'm very beginner can do.
Follow this thread http://www.keil.com/forum/docs/thread16862.asp
Most of the essence that USB beginner should know is there.
Ah, in above thread, the target MCU is AT91SAM7S256. The code for LPC2368 is almost similar. But minor difference is here. KEIL binds IN and OUT ISR into single USB_EndPointNN function (though I don't think this coding good). Then, you have to check "event" parameter in the EP ISR as follows.
usbuser.c void USB_EndPoint1 (U32 event) { if (event == USB_EVT_IN) { // // IN endpoint ISR // } else if (event == USB_EVT_OUT) { // // OUT endpoint ISR // } }
I've tried many methods but could not manage. I'm about to go crazy:)
my sample code
void USB_EndPoint1 (DWORD event) {
switch (event) { case USB_EVT_IN: GetInReport(); fg_endpoints &= ~(Bit(1)<<16); //USB_WriteEP(0x81, InReport, sizeof(InReport)); OutReportBufCnt = USB_WriteEP(0x81, InReport, sizeof(OutReport)); break; case USB_EVT_OUT:
OutReportBufCnt = USB_WriteEP(0x81, InReport, sizeof(OutReport)); // fg_endpoints &= ~(Bit(1)<<16); break; } }