LUFA RAW HID Polling Interval and lost packets

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Hi,

 

I'm using an at90usb1287 in my LUFA based project as a raw hid device.

It's communicating with a custom C# .net app and I have following issues:

 

  1. Sometimes some packets gets lost. Host app asks the device for data and every now and then the response doesn't get to the host. I know it has been sent from the device because I enumerate the device as a CDC as well for debugging and tracing sent message.
    I thought it may be related with the poll interval so I tried anything from 5ms to 150ms but it's the same.
    Should I add safe mechanism of re-sending the packet when the host doesn't confirm receiving it or LUFA handles it but there is something wrong? 
  2. I added unique id to each poll command to trace the order of messages for debugging and I noticed weird behavior. I always send a command asking for data and immediately after (when success) asking for the response data. What is weird that the response is always coming back 16 requests later.
    Let's say I send a command with id=1 and I know that the device answered with some data. However the immediate response is empty. It will arrive back to host 16 tries later with the id=17. Is it normal?

 

I'm using this library for HID communication on the C# side, but I suppose it's irrelevant:

https://www.waitingforfriday.com/?p=415#The_USB_Generic_HID_C_Class_Library

 

Any clues?