Can't send data to device
Posted: Wed May 07, 2008 6:00 pm
Hi,
I'm stuck at receiving data using the AVR-USB.
My HID is simulating a gamepad with ATMega16 @ 12Mhz.
My Code:
So, you see, a very basic program. I just want to send something to my µC, and the device should return it.
For testing I'm using the SimpleHIDWrite Programm from the HidPage (as LibUsb32 causes some trouble with Windows Vista).
My Problem:
It doesn't matter, what I send to the device. "data" will always be "21 09 00 02 00 00 02 00". So test2==21, test3 ==09. test1 increments everytime I send some bytes.
What am I doing wrong
Thanks for your help!
I'm stuck at receiving data using the AVR-USB.
My HID is simulating a gamepad with ATMega16 @ 12Mhz.
My Code:
Code: Select all
int test1=0;
int test2,test3;
uchar usbFunctionSetup(uchar data[8])
{
static uchar replyBuf[2];
usbMsgPtr = replyBuf;
test1++;
test2 = data[0];
test3 = data[1];
return 0;
}
[...]
usbPoll();
if(usbInterruptIsReady()){
reportBuffer[0]=test1;
reportBuffer[1]=test2;
reportBuffer[2]=test3;
usbSetInterrupt(reportBuffer,3);
}
So, you see, a very basic program. I just want to send something to my µC, and the device should return it.
For testing I'm using the SimpleHIDWrite Programm from the HidPage (as LibUsb32 causes some trouble with Windows Vista).
My Problem:
It doesn't matter, what I send to the device. "data" will always be "21 09 00 02 00 00 02 00". So test2==21, test3 ==09. test1 increments everytime I send some bytes.
What am I doing wrong
Thanks for your help!