Futterama
Joined: 17 Oct 2005 Posts: 98
|
USB HID device problems |
Posted: Sat Jan 12, 2008 4:20 am |
|
|
Hello forum,
I'm building an USB device with PIC18F2550 and the ex_usb_hid.c code example and a PC application in C# using Visual C# 2008 Express and USBHIDIO HID example from www.lvr.com.
I want to send 131072 bytes of data as fast as possible using HID. According to the ex_usb_hid.c code example, the HID is capable of sending 64000 bytes per second at full speed. This is done by sending 64 bytes in a packet, every 1ms.
I'm not sure how to build the application. I was thinking, the PC app sends a request (2 bytes) to my PIC app, and the PIC app will send one packet with 64 bytes to the PC app.
The PC would then wait 1ms and send a new request for more data and so on.
Is this the correct way of doing it?
I'm also having a bit trouble with the packet size. The ex_usb_hid.c code example says:
"...if you send a packet that is the same size as the max packet size then you need to send a 0 len packet to specify end of message marker."
So if I send 64 data bytes in one packet, the next packet would need to be a 0 len packet to indicate end of report? I have tried sending 64 bytes without sending any 0 len packet, and the PC will receive that packet, but I guess it's only receiving it because it times out waiting for the 0 len packet?
If someone with knowledge in USB could explain how to best send the required amount of data using HID, I would appreciate it.
Thanks.
Regards,
Futterama |
|