Author Topic: 'stall pid' when tranmit data using HIDAPI  (Read 9283 times)

Lider Wang

  • Member
  • ***
  • Posts: 4
'stall pid' when tranmit data using HIDAPI
« on: May 07, 2014, 11:09:14 pm »

Hi, experts

I have developed the application upon Win32 to update firmware through  usb hid
(by the way, I'm using HIDAPI of signal11 -- https://github.com/signal11/hidapi )

In the hid protocol is request/response mechanism,
65 bytes each request/response (in the real data is 64bytes and 1 byte for report ID)
the program is transmit one request and receive one response continually.

The problem is, when my project run at my windows 7 desktop computer, it always works.
However, when my project run on my laptop, it may failed "sometimes".
Below is the error log in USBlyser

Quote
URB   8490-8467   10:22:37.278   83.716703 s   15.969 ms   Bulk or Interrupt Transfer   Input Report len:64   00 00 3C 00 01 00 01 00...   in   01:00:81   8C49D8E8h      usbfilter   8750B800h   Success (Success)

00000000  00 00 3C 00 01 00 01 00 00 01 00 01 00 00 01 00  ................
00000010  01 00 00 01 00 01 00 00 01 00 01 00 00 01 00 01  ................
00000020  00 00 01 00 01 00 00 01 00 01 00 00 01 00 01 00  ................
00000030  00 01 00 01 00 00 01 00 01 00 00 01 00 01 00 00  ................

URB   8491   10:22:37.278   83.716733 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C49D8E8h              usbfilter   8750B800h   
URB   8492   10:22:37.278   83.716738 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C4BA6E8h              ACPI           8750B800h   
URB   8493   10:22:37.279   83.716761 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C501030h   USBPDO-6   usbhub   8750B800h   
URB   8494   10:22:37.279   83.716816 s      Bulk or Interrupt Transfer   Output Report len:64   00 00 3C 00 01 00 38 80...   out   01:00:01   8C49D8E8h             usbfilter   8C301A80h   

00000000  00 00 3C 00 01 00 38 80 50 9A 04 58 9A 04 70 9A  ......8.P..X..p.
00000010  04 78 00 00 9A C1 20 31 03 02 9A C1 12 B7 67 22  .x.... 1......g"
00000020  90 92 4A E0 FF 30 E0 16 90 90 D5 E0 FE 90 B8 2B  ..J..0.........+
00000030  E0 54 07 B5 06 08 D2 2B 90 90 D6 74 01 F0 EF 30  .T.....+...t...0

URB   8495   10:22:37.279   83.716825 s      Bulk or Interrupt Transfer   Output Report len:64   00 00 3C 00 01 00 38 80...   out   01:00:01   8C4BA6E8h              ACPI          8C301A80h   

00000000  00 00 3C 00 01 00 38 80 50 9A 04 58 9A 04 70 9A  ......8.P..X..p.
00000010  04 78 00 00 9A C1 20 31 03 02 9A C1 12 B7 67 22  .x.... 1......g"
00000020  90 92 4A E0 FF 30 E0 16 90 90 D5 E0 FE 90 B8 2B  ..J..0.........+
00000030  E0 54 07 B5 06 08 D2 2B 90 90 D6 74 01 F0 EF 30  .T.....+...t...0

URB   8496   10:22:37.279   83.716845 s      Bulk or Interrupt Transfer   Output Report len:64   00 00 3C 00 01 00 38 80...   out   01:00:01   8C501030h   USBPDO-6   usbhub   8C301A80h   

00000000  00 00 3C 00 01 00 38 80 50 9A 04 58 9A 04 70 9A  ......8.P..X..p.
00000010  04 78 00 00 9A C1 20 31 03 02 9A C1 12 B7 67 22  .x.... 1......g"
00000020  90 92 4A E0 FF 30 E0 16 90 90 D5 E0 FE 90 B8 2B  ..J..0.........+
00000030  E0 54 07 B5 06 08 D2 2B 90 90 D6 74 01 F0 EF 30  .T.....+...t...0

URB   8497-8496   10:22:37.282   83.720683 s   3.838 ms   Bulk or Interrupt Transfer   64 bytes buffer      out   01:00:01   8C501030h   USBPDO-6   usbhub   8C301A80h   Success (Success)
URB   8498-8495   10:22:37.282   83.720705 s   3.880 ms   Bulk or Interrupt Transfer   64 bytes buffer      out   01:00:01   8C4BA6E8h              ACPI           8C301A80h   Success (Success)
URB   8499-8494   10:22:37.282   83.720707 s   3.891 ms   Bulk or Interrupt Transfer   64 bytes buffer      out   01:00:01   8C49D8E8h              usbfilter   8C301A80h   Success (Success)
URB   8500-8481   10:22:37.294   83.732683 s   23.952 ms   Bulk or Interrupt Transfer         in   01:00:81   8C501030h    USBPDO-6   usbhub   89A7ADE0h   Unsuccessful (Stall PID)
URB   8501-8480   10:22:37.294   83.732699 s   23.983 ms   Bulk or Interrupt Transfer         in   01:00:81   8C4BA6E8h                 ACPI           89A7ADE0h   Unsuccessful (Stall PID)
URB   8502-8479   10:22:37.294   83.732702 s   23.991 ms   Bulk or Interrupt Transfer         in   01:00:81   8C49D8E8h                   usbfilter   89A7ADE0h   Unsuccessful (Stall PID)
KmIO   8503   10:22:37.295   83.732757 s      Internal USB Get Port Status               8C49D8E8h              usbfilter   8C4B7358h   
KmIO   8504   10:22:37.295   83.732771 s      Internal USB Get Port Status               8C4BA6E8h              ACPI           8C4B7358h   
KmIO   8505   10:22:37.295   83.732782 s      Internal USB Get Port Status               8C501030h   USBPDO-6   usbhub   8C4B7358h   
KmIO   8506-8505   10:22:37.295   83.733219 s   437 us   Internal USB Get Port Status         8C501030h   USBPDO-6   usbhub   8C4B7358h   Success

00000000  03 00 00 00                                      ....           

KmIO   8507-8504   10:22:37.295   83.733225 s   454 us   Internal USB Get Port Status              8C4BA6E8h                ACPI           8C4B7358h   Success

00000000  03 00 00 00                                      ....           

KmIO   8508-8503   10:22:37.295   83.733226 s   469 us   Internal USB Get Port Status         8C49D8E8h                usbfilter   8C4B7358h   Success

00000000  03 00 00 00                                      ....           

URB   8509   10:22:37.295   83.733241 s      Abort Pipe            01:00:81   8C49D8E8h              usbfilter   8C4B7358h   
URB   8510   10:22:37.295   83.733246 s      Abort Pipe            01:00:81   8C4BA6E8h              ACPI           8C4B7358h   
URB   8511   10:22:37.295   83.733257 s      Abort Pipe            01:00:81   8C501030h   USBPDO-6   usbhub   8C4B7358h   
URB   8512-8493   10:22:37.312   83.749881 s   33.120 ms   Bulk or Interrupt Transfer         in   01:00:81   8C501030h   USBPDO-6   usbhub   8750B800h   Cancelled (Canceled)
URB   8513-8492   10:22:37.312   83.749889 s   33.151 ms   Bulk or Interrupt Transfer         in   01:00:81   8C4BA6E8h              ACPI           8750B800h   Cancelled (Canceled)
URB   8514-8491   10:22:37.312   83.749891 s   33.159 ms   Bulk or Interrupt Transfer         in   01:00:81   8C49D8E8h              usbfilter   8750B800h   Cancelled (Canceled)
URB   8515-8511   10:22:37.312   83.749910 s   16.653 ms   Abort Pipe            01:00:81   8C501030h   USBPDO-6   usbhub   8C4B7358h   Success (Success)
URB   8516-8510   10:22:37.312   83.749914 s   16.668 ms   Abort Pipe            01:00:81   8C4BA6E8h              ACPI           8C4B7358h   Success (Success)
URB   8517-8509   10:22:37.312   83.749915 s   16.674 ms   Abort Pipe            01:00:81   8C49D8E8h              usbfilter   8C4B7358h   Success (Success)
KmIO   8518   10:22:37.312   83.749969 s      Internal USB Reset Port               8C49D8E8h              usbfilter   8C4B7358h   
KmIO   8519   10:22:37.312   83.749975 s      Internal USB Reset Port               8C4BA6E8h              ACPI           8C4B7358h   
KmIO   8520   10:22:37.312   83.749993 s      Internal USB Reset Port               8C501030h   USBPDO-6   usbhub   8C4B7358h   
KmIO   8521-8520   10:22:37.469   83.906887 s   156.894 ms   Internal USB Reset Port               8C501030h   USBPDO-6   usbhub   8C4B7358h   Success
KmIO   8522-8519   10:22:37.469   83.906899 s   156.924 ms   Internal USB Reset Port               8C4BA6E8h              ACPI           8C4B7358h   Success
KmIO   8523-8518   10:22:37.469   83.906901 s   156.931 ms   Internal USB Reset Port               8C49D8E8h              usbfilter   8C4B7358h   Success
URB   8524   10:22:37.469   83.906918 s      Sync Reset Pipe and Clear Stall            01:00:81   8C49D8E8h      usbfilter   8C4A7800h   
URB   8525   10:22:37.469   83.906922 s      Sync Reset Pipe and Clear Stall            01:00:81   8C4BA6E8h      ACPI   8C4A7800h   
URB   8526   10:22:37.469   83.906939 s      Sync Reset Pipe and Clear Stall            01:00:81   8C501030h   USBPDO-6   usbhub   8C4A7800h   
URB   8527-8526   10:22:37.469   83.907589 s   650 us   Sync Reset Pipe and Clear Stall      01:00:81   8C501030h   USBPDO-6   usbhub   8C4A7800h   Success (Success)
URB   8528-8525   10:22:37.469   83.907594 s   672 us   Sync Reset Pipe and Clear Stall      01:00:81   8C4BA6E8h      ACPI   8C4A7800h   Success (Success)
URB   8529-8524   10:22:37.469   83.907596 s   679 us   Sync Reset Pipe and Clear Stall      01:00:81   8C49D8E8h      usbfilter   8C4A7800h   Success (Success)
URB   8530   10:22:38.312   84.749856 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C49D8E8h              usbfilter   8750B800h   
URB   8531   10:22:38.312   84.749864 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C4BA6E8h              ACPI           8750B800h   
URB   8532   10:22:38.312   84.749881 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C501030h USBPDO-6   usbhub   8750B800h   
URB   8533   10:22:38.469   84.906853 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C49D8E8h              usbfilter   89A7ADE0h   
URB   8534   10:22:38.469   84.906860 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C4BA6E8h              ACPI           89A7ADE0h   
URB   8535   10:22:38.469   84.906876 s      Bulk or Interrupt Transfer   64 bytes buffer      in   01:00:81   8C501030h   USBPDO-6   usbhub   89A7ADE0h   
Cleanup   8536   10:22:42.283           88.721526 s      Cleanup   isbtflash_refactor.exe            8C4C3168h   000000ab   HidUsb   8C4F85F8h   
Cleanup   8537-8536   10:22:42.283   88.721541 s   15 us   Cleanup   isbtflash_refactor.exe            8C4C3168h   000000ab   HidUsb   8C4F85F8h   Invalid Device Request
Close   8538   10:22:42.283           88.721551 s      Close               8C4C3168h   000000ab   HidUsb   8B28D1A8h   
Close   8539-8538   10:22:42.283   88.721559 s   8 us   Close               8C4C3168h   000000ab   HidUsb   8B28D1A8h   Success

In the middle of the error log, ther Stall PID happened in receive after write out request.
I can't recognize the reason.
Could anyone help?

If that related to my laptop hid specs?
why the stall pid happen "sometimes"
"sometimes" mean it just happened even if try many times, but sometimes... it just work..

URB   8500-8481   10:22:37.294   83.732683 s   23.952 ms   Bulk or Interrupt Transfer         in   01:00:81   8C501030h    USBPDO-6   usbhub   89A7ADE0h   Unsuccessful (Stall PID)
URB   8501-8480   10:22:37.294   83.732699 s   23.983 ms   Bulk or Interrupt Transfer         in   01:00:81   8C4BA6E8h                 ACPI           89A7ADE0h   Unsuccessful (Stall PID)
URB   8502-8479   10:22:37.294   83.732702 s   23.991 ms   Bulk or Interrupt Transfer         in   01:00:81   8C49D8E8h                   usbfilter   89A7ADE0h   Unsuccessful (Stall PID)

Lider Wang

  • Member
  • ***
  • Posts: 4
Re: 'stall pid' when tranmit data using HIDAPI
« Reply #1 on: May 08, 2014, 02:46:23 am »
I found the reason of the transmit interrupt but still don't know why.

I'm sure the data of transmit and receive are corrected.
When I use common USB 2.0 port to process, it's fine.

But the error happened when I use USB+ port (USB 3.0 and powered USB port).
Someone knows why?
« Last Edit: May 08, 2014, 04:30:39 am by Lider Wang »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: 'stall pid' when tranmit data using HIDAPI
« Reply #2 on: May 08, 2014, 09:18:57 pm »
An interrupt endpoint returns Stall when the endpoint's Halt feature is set, indicating that the endpoint can no longer send or receive data.

A hardware analyzer would show what is happening on the bus and might offer a clue. If you don't have a hardware analyzer, use whatever debugging tools you have to find out what the device is receiving and what is causing the endpoint to return Stall.

Different host controllers might use different timing, for example, scheduling multiple transactions to an endpoint more rapidly, and thus result in different behavior.




Lider Wang

  • Member
  • ***
  • Posts: 4
Re: 'stall pid' when tranmit data using HIDAPI
« Reply #3 on: May 18, 2014, 11:07:13 pm »
Thanks Jan. replying.

I found that the reason is related to the cable of USB HID.
Some kind of cable may cause it.
Or, Some kind of cable may not cause it.

However, it may the connection lost or the data IN/OUT which is transmitted wrong.
( cable too long? attenuation? )

Anyone have comment?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: 'stall pid' when tranmit data using HIDAPI
« Reply #4 on: May 19, 2014, 11:50:04 am »
Try to find cables that are certified by the USB-IF (with a logo).

If the device is low speed, the cable attached to the device should be 3 meters maximum. If using hubs, cables upstream from the hub(s) can be 5 meters max. For full and high speed, 5 meters max except cables with Micro-B plugs, which have a specified maximum length of 2 m


Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: 'stall pid' when tranmit data using HIDAPI
« Reply #5 on: May 19, 2014, 06:59:08 pm »
I would be somewhat surprised if a bad cable caused a STALL.

Bad cables can cause errors, but the errors usually cause the corrupt packet to be ignored. So bad cables tend to cause missing responses.

STALLs are usually caused when a packet is received intact, but the receiver doesn't like the content received. It should be a deliberate response to an error free reception.

Its possible that a bad device would see an error and reply with a STALL, but I've never seen something like that.