Need help with USB HID implementation

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its my first AVR Code ever, so please be patient ;)

We got an own Board produced with an AT90USB1287 which is used to simply switch 8 digital Output PINS and to read 8 digital input PINS via USB.

I started using the ATMEL HIDGEN Demo and changed it so far to fit our own board.

Additionally I found a helpful little windows Project (USB HID) which is able to write and read data to/from a USB HID device.
I am able to send data to the AVR, this works but I am having problems, getting data out of it to the windows app.

The HID Demo from Atmel just writes data into the FIFO of the IN endpoint and then makes this:

(UEINTX &= ~(1<<TXINI) and (UEINTX &= ~(1<<FIFOCON))

I assumed that clearing the FIFOCON bit triggers an USB Interrupt (the endpoint in configured in Interrupt mode) and makes the host read the data from the IN endpoint at the next poll.

Is this assupmtion correct? Maybe the AVR does everything correctly and the error lies in the windows application although I get the events for device plugged and removed.

Any hints?
Thanks in advance,
David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi David
Here is my working code.
Dig

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dig, thanks for your help.
I did the right thing to send the data but I did not know that I had to completely fill the report.
I used an IN Report length of 32 bytes but wrote only one byte to it. The data I want to send to the host has a variable size. I probably just have to fill out all unused bytes in the report.

David