Author Topic: Packet Error/Loss on HID  (Read 13751 times)

vanweric

  • Member
  • ***
  • Posts: 24
Packet Error/Loss on HID
« on: May 16, 2011, 06:14:42 pm »
I am unclear as to what happens when a packet "on the wire" becomes corrupt.  What side(s) are alerted? Is a retry automatically attempted?

I'm specifically interested in HID.

Thank you
 - Eric

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Packet Error/Loss on HID
« Reply #1 on: May 16, 2011, 08:40:06 pm »
If the CRC value in a token, data, or SOF packet doesn't match, the receiver doesn't return ACK and the sender knows it has to retry. This requires no firmware intervention.

If the data toggle is wrong, the receiver ignores the data and returns ACK to re-synchronize with the sender. Depending on the hardware, this may require firmware control.

Jan

vanweric

  • Member
  • ***
  • Posts: 24
Re: Packet Error/Loss on HID
« Reply #2 on: May 17, 2011, 12:42:33 pm »
Thank you Jan!

Does this mean that I can assume a "lossless" link?  That is, all packets will either (eventually) arrive intact or error out (e.g. cable is pulled).

I've been told that the windows HID stack is lossy if I don't read my buffers quickly enough.  If I can guarantee that I do read fast enough, can the rest of the stack guarantee that packets are lossless and in order?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Packet Error/Loss on HID
« Reply #3 on: May 17, 2011, 12:55:51 pm »
The HID driver has a finite buffer. If your application doesn't read reports from the buffer fast enough, the buffer fills and the driver drop the oldest reports to fit new ones.

See:

HidD_SetNumInputBuffers

Yes, the host will retry on receiving corrupt data and will reset the device if major problems occur.

Isochronous transfers have no error correcting but that's not an issue for HIDs.

Jan