Interrupt In Endpoint 1 Question

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Rukus
Rank 1
Rank 1
Posts: 24
Joined: Tue Nov 06, 2007 10:18 am

Interrupt In Endpoint 1 Question

Post by Rukus » Sun Feb 03, 2008 7:41 am

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?

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Sun Feb 03, 2008 6:29 pm

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().

Guest

Post by Guest » Sun Feb 03, 2008 7:27 pm

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 :)

Post Reply