• AVR Freaks

Hot!Enumeration failing under Win7 on a USB3.0 port

Author
rshotbolt
Super Member
  • Total Posts : 192
  • Reward points : 0
  • Joined: 2009/01/09 09:00:31
  • Location: Ramsey, England
  • Status: offline
2011/08/03 06:09:03 (permalink)
5 (1)

Enumeration failing under Win7 on a USB3.0 port

After shipping a full-speed 18F4550 product for months that uses the popular Diolan bootloader, it's suddenly started to fail about 50% of the time on new Win7 / USB3.0 machines during enumeration. Has anyone else had a similar problem recently? I know it's a firmware problem because the Microchip USB stack, even in polled mode and no ping-pong, works perfectly on these machines. I'll be investigating the issue myself and reporting back here when a USB3.0 laptop arrives, but I'd welcome any clues to what might be the most likely cause.
 
Thanks
Richard
post edited by rshotbolt - 2011/08/03 06:17:22
#1

13 Replies Related Threads

    Pacer
    Super Member
    • Total Posts : 1171
    • Reward points : 0
    • Joined: 2004/12/01 09:29:20
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/03 09:48:59 (permalink)
    0
    I'd guess some kind of timing issue (yeah vague, I know). Use of a hardware USB analyser is pretty essential, but I'm sure you have one of those.
    #2
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/04 04:19:12 (permalink)
    0
    I had a customer calling for something similar on a HID simple device with a VB program, that seems to fail on Win7 ...
    I guess some timing issue as well - command/reply I mean...

    GENOVA :D :D ! GODO
    #3
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/04 23:44:28 (permalink)
    0
    It could well be the host USB 3.0 driver problems. Right now the quality of the drivers are not that high as the drivers are from the vendors and not Microsoft. You can probably ask the customer to switch to USB 2.0 before Windows 8.

    Quoting one of the leading Windows driver experts in the world (Tim Roberts)
    http://www.osronline.com/.owthread.cfm?link=208771


    USB 3 in Windows is uncharted territory. It is the wild, wild west. There is no USB 3 support from Microsoft, so when you use USB 3 today, you are using a complete stack of drivers from the manufacturer. There is no guarantee that the manufacturer has followed any of the rules Microsoft established for USB 2.

    Several of my clients have simply decided not to support their USB 2 devices on USB 3 until we have support from Microsoft, presumably in Windows 8.







      USB_Links and libusb
    #4
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/05 00:57:15 (permalink)
    0
    thank you, will have it checked...

    GENOVA :D :D ! GODO
    #5
    Pacer
    Super Member
    • Total Posts : 1171
    • Reward points : 0
    • Joined: 2004/12/01 09:29:20
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/05 06:00:22 (permalink)
    0
    This is interesting. I had assumed up to now that the Microsoft Stack would be used for the LS/FS/HS connections, even when USB 3.0 was used, but this is suggesting that that is not the case. Certainly something to watch out for!
    #6
    rshotbolt
    Super Member
    • Total Posts : 192
    • Reward points : 0
    • Joined: 2009/01/09 09:00:31
    • Location: Ramsey, England
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/06 02:55:33 (permalink)
    0
    The laptop's arrived (Dell Vostro 3550) and the enumeration fails about 75% of the time, so I stand a chance of fixing it after taking a close look at the code in the Microchip stack which works whatever mode it's compiled in.
    #7
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/08/06 17:19:06 (permalink)
    -2 (1)
    Pacer
    This is interesting. I had assumed up to now that the Microsoft Stack would be used for the LS/FS/HS connections, even when USB 3.0 was used, but this is suggesting that that is not the case. Certainly something to watch out for!


    Unfortunately that is the case. Even when USB LS/FS/HS device attached to the USB 3.0 port, the device will be at the mercy of the vendor host driver.

    Enclosed is a USBView screen capture showing a Microchip USB HID Custom Demo device attached to a Renesas (NEC) USB 3.0 port. In this case, the device works (USB 2.x stack).

    Renesas is probably the best in terms of USB 3.0 ports device out there, but there are still problems. I suggest the OP to try to update to the latest Renesas driver to see if that helps. It seems to me Dell Vostro 3550 is using Renesas USB 3.0 host controller.

    We have gone through some problems in the libusb 1.0 Windows backend mailing list.
    http://libusb.6.n5.nabble...tp4463538p4535156.html

    Only the latest Renesas driver as of that time (2.1.16.0) works.


    Attached Image(s)


      USB_Links and libusb
    #8
    rshotbolt
    Super Member
    • Total Posts : 192
    • Reward points : 0
    • Joined: 2009/01/09 09:00:31
    • Location: Ramsey, England
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/09/01 09:26:49 (permalink)
    0

    Actually, the USB3.0 port on the laptop is fine. Enumeration never fails. But the real problem is with the USB2.0 ports (Intel C200 chipset). I used the USB-IF analyser, but the special debug drivers eliminate the problem. However, I've just tried USBTrace which uses the chipset driver, and it shows the problem immediately. A stall is occurring on the EP0 control transfer following the config descriptor request on the occasions the enumeration fails. Can anyone make sense of this (see image comparing good and bad)? Who is sending the stall? It's not me, at least not intentionally.


    post edited by rshotbolt - 2011/09/01 09:28:45
    #9
    Pacer
    Super Member
    • Total Posts : 1171
    • Reward points : 0
    • Joined: 2004/12/01 09:29:20
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2011/09/01 12:02:29 (permalink)
    0
    I still think you need to see what is happening on the bus, which will show you who is responsible for the problem. Any software based analyser can only access the traffic at a point where you are insulated from bus problems. And it may not necessarily be your fault. I recently had to stop using a controller card of a particular make in my work computer because, under pressure, the card started to misinterpret the meaning of NYET, causing a lockup. I found that using a hardware analyser; up till then I had been assuming it was our product at fault.

    #10
    lanceraq
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/10/31 01:37:42
    • Location: Australia
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port 2012/10/31 01:56:01 (permalink)
    0
    Has anyone managed to get to the bottom of this problem?
    I am seeing exactly the same thing - works perfectly on a  USB3 port but fails intermittently on a USB2 (Intel C200) port.
    Its very frustrating! [:-]
    #11
    lanceraq
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2012/10/31 01:37:42
    • Location: Australia
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port [SOLVED] 2012/11/07 19:32:51 (permalink)
    0
    [SOLVED]
    This is thanks to Richard (rshotbolt). He fixed this bug, and took the time to also let me know about it. Much appreciated. Smile
     
    Looking at the original Diolan Bootloader code - usb_sm_ctrl_rx - lines 305-308:
     
        movf    PREINC2, W    ; BDT_CNT(ep0Bo)
        movwf    byte_to_read
        ; Accumulate total number of bytes read
        addwf    Count, F
    --> bz       usb_sm_ctrl_rx_read_end ; Exit if no bytes to read
     
    The check for zero needs to be added so that if the "byte_to_read" is zero then it does not continue processing the buffer.
     
    Similarly in usb_sm_ctrl_tx - line 342:
     
        movwf    byte_to_send
    --> bz   usb_sm_ctrl_tx_end ; Exit if no bytes to send

    With both of these fixes I get no errors when connecting to USB2.0 or USB3.0 ports, with or without a hub.Smile

    #12
    rshotbolt
    Super Member
    • Total Posts : 192
    • Reward points : 0
    • Joined: 2009/01/09 09:00:31
    • Location: Ramsey, England
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port [SOLVED] 2012/11/08 00:39:23 (permalink)
    0
    Thanks for posting the fix Lance Smile
     
    I've uploaded my version of the Diolan Bootloader to my web site. Feel free to use what you want from it, but afraid I can't give you any help implementing it.
    It now supports all the TODO and untested bits from the oiginal code and is USB-IF compliant. However, as it stands it does not support SLEEP and WAKEUP. If anyone feels lke creating a derivative which does, please upload it.
    I also replaced the security stuff with a CRC8408 routine which is how I decide if the bootloader or main program runs on power-up.
     
    Get it here:
    http://www.shotbolt.com/uploads/bootloader.zip
    Cheers
    Richard
     
    #13
    danbakana
    Starting Member
    • Total Posts : 77
    • Reward points : 0
    • Joined: 2012/08/27 05:21:28
    • Location: 0
    • Status: offline
    Re:Enumeration failing under Win7 on a USB3.0 port [SOLVED] 2019/05/20 08:23:59 (permalink)
    0
    I'm trying to make the code of rshotbolt work on my device. I'm using a PIC18F4550. I tried to build, but I had the following message:
     
    Clean: Deleting intermediary and output files.
    Clean Warning: File "C:\MPLAB\SE1027\Bootloader\usb.o" doesn't exist.
    Clean Warning: File "C:\MPLAB\SE1027\Bootloader\usb.err" doesn't exist.
    Clean Warning: File "C:\MPLAB\SE1027\Bootloader\usb.lst" doesn't exist.
    Clean Warning: File "C:\MPLAB\SE1027\Bootloader\SE1028.cof" doesn't exist.
    Clean Warning: File "C:\MPLAB\SE1027\Bootloader\SE1028.hex" doesn't exist.
    Clean: Deleted file C:\Users\Daniel\Desktop\ArquivosBootloaderPIC18F4550\bootloaderMPLAB8\diolan_plus\bootloader\SE1028.mcs".
    Clean: Done. Couldn't locate build tool. Check tool locations.
     
    So, I changed the include on usb.asm originally written #include "P18F87J50.INC" to #include "P18F4550.INC"
    and add a P18F4550.INC that I found on the internet. I tried to compile and the following message appeared:
     
    Clean: Deleting intermediary and output files.
    Clean: Done.
    Couldn't locate build tool. Check tool locations.
     
    What I'm doing wrong ?
     
    #14
    Jump to:
    © 2019 APG vNext Commercial Version 4.5