Page 1 of 1

Interrupt In Endpoint 1 Question

Posted: Sun Feb 03, 2008 7:41 am
by Rukus
My client program is using AVRUSB and I have a interupt in endpoint 1 as well as a interupt out endpoint. I have it working fine with 6 bytes being transfered to the windows host with a interupt in.

My question is how do I send more than 8 bytes to the host with a interupt in endpoint?

I've tried to break it up into several report id's. That seems to work for windows as the data I'm sending is for a HID joystick. The data gets transfered to windows and I can look at the joystick data from the control panel and all of the data is getting there in 2 report id's.

The problem I'm having is when I use LIBUSB and I use -

Code: Select all

nBytes = usb_interrupt_read(handle, 0x81, (char *)buffer, 7, 5000);


Data gets transfered, but there is no way to tell it to get data from Report ID 1 or Report ID 2. Depending on when the read happens, data from either Report ID 1 or Report ID 2 will end up being read. I tried to increase the read length constant, but it will only read 1 Report ID at a time, and not both at one time.

Perhaps there is a better way? I need to transfer 14 bytes to the host. How can I do that if the max transfer size in AVRUSB is only 8 bytes?

Posted: Sun Feb 03, 2008 6:29 pm
by christian
This is a bit tricky. If you send 8 bytes with usbSetInterrupt(), the host asks for the next chunk until it receives less than 8 bytes and merges all chunks to a common message.

This means that you should send the first 8 bytes with usbSetInterrupt(), then wait until they have been sent to the host using usbInterruptIsReady() and then send the next 6 bytes with usbSetInterrupt().

Posted: Sun Feb 03, 2008 7:27 pm
by Guest
christian wrote:This is a bit tricky. If you send 8 bytes with usbSetInterrupt(), the host asks for the next chunk until it receives less than 8 bytes and merges all chunks to a common message.

This means that you should send the first 8 bytes with usbSetInterrupt(), then wait until they have been sent to the host using usbInterruptIsReady() and then send the next 6 bytes with usbSetInterrupt().


Thanks Christian, everything else is working quite well and I appreciate your efforts with AVRUSB. It is a exellent driver to implement USB with AVR's.

I'll try what you have suggested. I'll restructure the HID Report and make some modifications to my logic and see what happens.

Thanks again for all of your help :)