Hi
I'm using USB HID library to implement an small HID device. I already have read this library and USB 1.1 specification, but I still have a small problem. I still cannot understand relation between 3 sizes in descriptor: 1- EP0 packet size(that you can specify in usbcfg.h) 2- Endpoint's wMaxPacketSize 3- maximum size of reports
In my case, I need to transfer 128 bytes of data to and from device. Then I have defined my reports like this: ReportSize(8) ReportCount(128) But I still cannot get how wMaxPacketSize and EP0 packet size are related to these values. From some samples, I saw that people set wMaxPacketSize to 64. But how I should transfer my reports if wMaxPacketsize is 64? or are they related at all?
Regards
Yes,I'm working on windows. And as I told in 2nd post, I have finally successfully transfered 128 bytes of data from host to device with no problem. But sending 128 bytes of data from device to host is still a problem that I cannot solve. My windows application needs to use a ReadFile with a 129 byte buffer length for getting data from device, but I cannot find a way to send a 128 byte report from device to host when wMaxPacketSize is 64.
> but I cannot find a way to send a 128 byte report from device to host when wMaxPacketSize is 64.
**sigh** I've already explained about the way in above post. See above code.
128 bytes input report is split into two 64 bytes packets. 1) The first packet is passed to the IN endpoint outside of the IN EP ISR. Usually, at the place where the input report is made up.
2) When the USB engine finishes to send the first packet, IN EP interrupt occurs. Then, the second packet is passed to the IN EP inside of the IN EP ISR.
3) When the USB engine finishes the second packet, another interrupt occurs, the IN EP ISR is called again. But this time, there is nothing to send. Therefore, a flag (or a counter) is required to do control this behavior.
This flag is set when the first packet is sent in 1) stage The IN EP ISR sees this flag. When it is set, it drops the flag and does 2) stage.
Tsuneo
It seems that I forgot to say, but I have already tried this way of sending 128 Bytes of data to host by splitting it into two 64 bytes part and it didn't work.
How didn't it work?
Place a break point in the USB_EndPoint2() Is this ISR visited?
Aha, mistaken again.
Place a break point in the USB_EndPoint1() (IN EP) Is this ISR visited?