Hot!CDC - stalled bulk IN

Author
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
2010/11/25 13:06:56 (permalink)
5 (1)

CDC - stalled bulk IN

a) Problem - no error recovery on Windows CDC

CDC class driver on PC starts to poll bulk and interrupt IN endpoints, just after enumeration. Usually, these IN transactions are NAKed by the CDC device, unless the device has any data to send. Attached figure (left side) shows screen shot of bus analyzer for this polling IN transactions, taken on Windows.

When an IN transaction is disturbed by noise, host controller (HC) retries it automatically. When the third retry fails, HC notifies an error to the PC class driver. This is applied to NAKed transactions, too. Receiving error notification, decent class driver starts recovery sequence, like pipe reset (Clear_Feature(endpoint)), device reset (bus reset), etc.

However, Windows CDC driver (usbser.sys) does no error recovery. It just stop polling on the bulk IN endpoint on error. Attached figure (right side) shows it clearly. After errors on bulk IN, just polling interrupt INs remain. No other activity for error recovery on the bus. This trace was taken on Windows XP(x86) SP3. Lack of error recovery has been succeeded by Vista, 7 (x86, x64).

This is the major reason why I have often told usbser.sys is not reliable.


Tsuneo
post edited by chinzei - 2010/11/25 14:43:08

Attached Image(s)

#1

6 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:CDC - stalled bulk IN 2010/11/25 13:13:24 (permalink)
    +2 (1)
    b) Error detection and recovery on PC application?

    On PC side, even when the usbser.sys falls into this trouble, Device Manager tells no trouble on the virtual COM port.
    On PC application,
    - ClearCommError() returns TRUE, no error (0) on lpErrors
    - GetCommState() returns TRUE, no significant sign on DCB
    - OVERLAPPED ReadFile() returns FALSE, GetLastError() returns ERROR_IO_PENDING.
    - GetOverlappedResult() returns FALSE, GetLastError() returns ERROR_IO_PENDING.
    These responses are normal one. There is no way to detect this error on the PC application using serial APIs.

    Also, any of these procedure doesn't recover bulk IN polling.
    - CloseHanle() and re-open the device with CreateFile()
    - PurgeComm().
    - DeviceIoControl( IOCTL_SERIAL_RESET_DEVICE )

    That is, there is nothing to do on the PC side.
    Therefore, this error should be recovered on the device side, by forcing the device disconnect.

    Tsuneo
    #2
    jtemples
    Super Member
    • Total Posts : 11018
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re:CDC - stalled bulk IN 2010/11/25 14:14:22 (permalink)
    0
    Vista, 7 (x86, x64) succeeds lack of error recovery.

    Do you mean that the problem is fixed in Vista and Windows 7?
    #3
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:CDC - stalled bulk IN 2010/11/25 14:49:28 (permalink)
    0

    Do you mean that the problem is fixed in Vista and Windows 7?

    No, Vista/7 don't fix it yet.
    usbser.sys on these OS version behaves exactly same as XP - Lack of error recovery.
    I revised above post, to make it clear.

    Tsuneo
    #4
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:CDC - stalled bulk IN 2010/11/26 01:54:42 (permalink)
    0
    This explains why - in presence of noise at the device's end - my CDC adapter does hang forever... and this happens pretty often...

    Of course, the cause is indeed the noise at its ground. But, still, some recovery would help.

    Thank you!

    GENOVA :D :D ! GODO
    #5
    qɥb
    Monolothic Member
    • Total Posts : 3332
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re:CDC - stalled bulk IN 2018/01/31 15:00:18 (permalink)
    0
    Bump, for this very useful topic.
    I have heard that the CDC driver finally had improvements in Windows 10, but I don't know if this specific problem was fixed.
    Win 7 (and older) are going to be around for years though, so this problem is still very relevant.

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #6
    jtemples
    Super Member
    • Total Posts : 11018
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re:CDC - stalled bulk IN 2018/01/31 16:08:10 (permalink)
    +1 (1)
    I have heard that the CDC driver finally had improvements in Windows 10

     
    The one I've noticed is that you no longer need an INF file when first plugging in a CDC device.
    #7
    Jump to:
    © 2018 APG vNext Commercial Version 4.5