Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling the connection with USB2 wire for ps5000D #199

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

elechapt
Copy link
Contributor

Fixing issue #198

@hmaarrfk
Copy link
Collaborator

I somewhat don't want to fix this.

USB2.0 only gives you 500mA of power (by spec) so it will cause you many problems.

I would almost want it to be an option like:

usb_2_power_ok=True

to ensure that the user knows that they are connecting to a low power, lower datarate port.

@elechapt
Copy link
Contributor Author

elechapt commented Apr 11, 2024

Indeed, the problem is that the bandwidth is divided by four, but the alternative is no connection at all. And I think a user wanting high datarate will be aware of that problem, or at least see it in its datas. This patch connects via USB2 only if it's required. We can have a warning message indicating the error while connecting if you prefer.

@hmaarrfk
Copy link
Collaborator

No. I want it to error by default unless the user tells me explicitly that usb2 is ok.

Silently switching to usb2 on a device that is supposed to be high performance is not good for API design.

I'm still curious, in your use case. Are you able to use USB3? In my mind this is such a trivial issue to solve in real life that providing the opt8ok to workaround it in software seems like more work (and maintenance)

@elechapt
Copy link
Contributor Author

I'm not the only one using the equipment. I'm the low-level guy making things for non-programmers && non-electronicians in the lab. I have to make sure things work no matter what, even if someone uses the wrong wire or another computer, so I handle the warnings for low datarates. And the picoscope is embedded in another device, no one is supposed to know what's inside the box.
Those people know how to use the official "Picoscope 6" software, which handles the low datarate for USB2.

Do you want me to add that as an option in both _Picobase.open(...) and PS5000a._lowLevelOpenUnit(...) ?

@hmaarrfk
Copy link
Collaborator

And the picoscope is embedded in another device

Ok this is a usecase that was not considered before. Embedded devices sometimes only function at 2.0 levels so it is "impossible" to change the cable for an "upgrade".

Truthfully I don't really know the semantics of the error. Does it mean:

  • External Power Supply connected, data cable is 2.0

or

  • External Power Supply not connected, data and power go through USB 2.0

I just want to make sure that the problem I outlined 8 years ago worse:

        # This will check if the power supply is not connected
        # and change the power supply accordingly
        # Personally (me = Mark), I don't like this
        # since the user should address this immediately, and we
        # shouldn't let this go as a soft error
        # but I think this should do for now

And the picoscope is embedded in another device, no one is supposed to know what's inside the box.

PS. For your own sake, I hope you QC to ensure that the right cable goes in the box ;)

@elechapt
Copy link
Contributor Author

elechapt commented Apr 11, 2024

Quoting the programmers' guide, it is apparently intended, "normal" in a way, that ps5000aOpenUnit returns a code status saying that USB3 is not available and the user has to change power source:

PICO_USB3_0_DEVICE_NON_USB3_0_PORT:
· Call ps5000aChangePowerSource to complete the two-stage power-up sequence for a USB 2.0 port

and

PICO_USB3_0_DEVICE_NON_USB3_0_PORT – for 2-channel 5000D and 5000D MSO devices

I have no clue a priori whether external power is connected on the picoscope, I wasn't handling this part, but for what I can see inside the box, it's only connected through USB3, no external power (I think ther isn't, it is a 2 channels model). I think the error arise whether or not external power is there, only if USB2 instead of USB3 is used.

@hmaarrfk
Copy link
Collaborator

ok, deal.

@hmaarrfk hmaarrfk merged commit e71dee8 into colinoflynn:master Apr 11, 2024
2 checks passed
@elechapt
Copy link
Contributor Author

@hmaarrfk Just to make you laugh a bit : I've checked with a USB3 wire. It is a USB3 inside, but the connection from outside doesn't work : they didn't tested it !! So until it's fixed, the only available connection is USB2 !

@hmaarrfk
Copy link
Collaborator

@hmaarrfk Just to make you laugh a bit : I've checked with a USB3 wire. It is a USB3 inside, but the connection from outside doesn't work : they didn't tested it !! So until it's fixed, the only available connection is USB2 !

The saga never ends with embedded development!

Godspeed with fixing things! Thanks for your contribution and willingness to discuss!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants