Giter Site home page Giter Site logo

Comments (15)

VioletEternity avatar VioletEternity commented on May 30, 2024 1
  • Did this happen the first ever time, and then never again after re-plugging?

Correct.

  • Does a reboot get it to occur again?

It works fine after a reboot.

(does anything / can you reproduce it?)

You can artificially make it happen the second time by uninstalling the driver using the Device Manager, unplugging the device, and plugging it back in.

Also, I am fairly certain it will happen once per physical device (i.e. VID/PID/DID/serial number combination).

from glasgow.

VioletEternity avatar VioletEternity commented on May 30, 2024 1

No, not physical port. It was originally plugged into Port_#0004.Hub_#0002. After plugging it in Port_#0002.Hub_#0002 it works fine.

The device instance path remains the same, USB\VID_20B7&PID_9DB1\C3-20230729T201611Z, so the same device settings are used. It is only the location that is updated when it is plugged in a different port.

from glasgow.

VioletEternity avatar VioletEternity commented on May 30, 2024 1

In addition, it looks like this implementation of STALL_EP0() is incorrect:
https://github.com/whitequark/libfx2/blob/82d154153f548b29b1be60f1c11d7a5bc102486d/firmware/library/include/fx2usb.h#L76-L77

It should be EP0CS = _HSNAK|_STALL instead:

image

from glasgow.

VioletEternity avatar VioletEternity commented on May 30, 2024 1

This isn't correct. In case of an IN request, it is necessary to wait for EP0CS & _BUSY to clear first.

My apologies; I wasn't paying enough attention and got confused.

There is no point in waiting for EP0CS & _BUSY to clear in the beginning of the SUDAV deferred interrupt handler because it will never be set at that point:

image
image

It only makes sense to wait for EP0CS & _BUSY to clear after an EP0 data transfer has been set up. In case of libfx2, this would be after a call to SETUP_EP0_BUF, SETUP_EP0_IN_DATA, or SETUP_EP0_IN_DESC.

The issue is caused by not stalling EP0 as described here:

image

from glasgow.

attie avatar attie commented on May 30, 2024

Unplugging the device and plugging it back in resolves the issue.

Could you clarify?

  • Did this happen the first ever time, and then never again after re-plugging?
  • Does a reboot get it to occur again? (does anything / can you reproduce it?)

from glasgow.

attie avatar attie commented on May 30, 2024

Also, I am fairly certain it will happen once per physical device (i.e. VID/PID/DID/serial number combination).

Knowing Windows, possibly physical port too...! (could you confirm?)

from glasgow.

whitequark avatar whitequark commented on May 30, 2024

I will be able to capture ETW traces later.

I would really appreciate ETW traces (or any additional information about this issue) because I'm at a loss of where to even begin debugging it.

from glasgow.

whitequark avatar whitequark commented on May 30, 2024

@esden Have you already programmed all of the Early Bird units? This could be an unpleasant thing for people who use Windows to hit on their first plug in...

@attie I think we need to catch usb1.USBErrorNotSupported on Windows and ask the operator to unplug it and plug it back again to see if that solves it, until we can fix this properly >_>

from glasgow.

attie avatar attie commented on May 30, 2024

No, not physical port

That's good... FTDI UARTs (and I'm sure something else) used to have a habit of tying the COMn to a physical port.

catch usb1.USBErrorNotSupported on Windows and ask the operator to unplug it and plug it back again

I've got access to Windows too, though my knowledge is far below where it could be.
I'm a little surprised it doesn't "figure things out" and that a replug is required... but that's a good idea.

from glasgow.

whitequark avatar whitequark commented on May 30, 2024

I'm a little surprised it doesn't "figure things out" and that a replug is required... but that's a good idea.

It might be related to WinUSB somehow?

from glasgow.

whitequark avatar whitequark commented on May 30, 2024

@VioletEternity Could you test #385, please?

from glasgow.

VioletEternity avatar VioletEternity commented on May 30, 2024

I've attached the ETW trace capturing USB transactions on first plug-in of the device:
usbtrace.zip

It seems that the cause of the issue might be the failure of the requests with FNs 378 and 390:
image

I've included the requests below:

image
image

from glasgow.

VioletEternity avatar VioletEternity commented on May 30, 2024

It looks like an unrecognized USB request that is received by the device will always fall through to this line:

STALL_EP0();

This isn't correct. In case of an IN request, it is necessary to wait for EP0CS & _BUSY to clear first.

As a result, EP0 is stalled after an unrecognized Microsoft-specific request arrives, but instead of rejecting just this request, a following GET_DESCRIPTOR request is also rejected. This causes the Windows USB stack to mark the device as faulty, since a GET_DESCRIPTOR(Device) should always succeed. Windows only queries the Microsoft OS descriptor on the first plug-in, so on the next one the issue does not arise.

from glasgow.

whitequark avatar whitequark commented on May 30, 2024

All right, I can't quite get it to work right now, but I also realized that I think I understood this part of the FX2 TRM wrong this whole time and I need to rewrite a significant amount of code. I'll do this tomorrow >_>

from glasgow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.