pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

[WIP] Gpib events #175

Open tivek opened 5 years ago

tivek commented 5 years ago

Request for comments, related to Issue #142

MatthieuDartiailh commented 5 years ago

@tivek ping me when this is ready for further reviews.

tivek commented 5 years ago

A quick update. The event work in pyvisa was on hold due to hardware issues. I expect to be able to continue working on it in the following weeks. In the meantime I plan to thoroughly test the changes in pyvisa-py on our test equipment.

MatthieuDartiailh commented 5 years ago

Sounds good @tivek . Let me know if I can do anything. I am currently working on pyvisa documentation and I will try to give a shot at implementing GPIB INTFC for pyvisa-py once I am done(see https://github.com/pyvisa/pyvisa/issues/400 for a use case).

MatthieuDartiailh commented 5 years ago

@tivek any news on this ?

tivek commented 5 years ago

@tivek any news on this ?

I am trying to replicate the behavior of event queues in NI-VISA. There appear to be some differences in how my KUSB-488A with linux-gpib handles GPIB events with respect to NI adapters on Windows. Not sure if it is down to my code (most likely), the instrument (Tek osci), OS, driver version... This is taking a bit more tinkering than I thought :)

MatthieuDartiailh commented 5 years ago

@tivek did you made any progress on this ? I am planning new releases for end of July, beginning of August, would like to push to get this in or will this wait for the next one ?

tivek commented 5 years ago

@tivek did you made any progress on this ? I am planning new releases for end of July, beginning of August, would like to push to get this in or will this wait for the next one ?

Thank you for your patience. I was until recently out of town and without lab access.

I am having increasing difficulties to reproduce behavior of Windows NI-VISA with Linux-GPIB with my instruments. I am not sure if it is something to do with how I initialize the instruments over GPIB or if I am misunderstanding VISA events.

My estimate is GPIB event support will not be ready for the next release. I am planning to exclusively work on this in August when the instruments are not likely to be used for regular experiments.

MatthieuDartiailh commented 5 years ago

Sounds good and thanks for the update. Could you also have a look st https://github.com/tivek/gpib_ctypes/issues/3 if you have a moment ?

LongnoseRob commented 3 years ago

Was looking for events use with pyvisa-py and found this PR, any info available when work on this will continue?

MatthieuDartiailh commented 3 years ago

I do not have the bandwidth at the moment to take over @tivek work, and I did not hear from him since his last post. If this is something you are interested in however, I will be happy to review a PR.

tivek commented 3 years ago

I do not have the bandwidth at the moment to take over @tivek work, and I did not hear from him since his last post. If this is something you are interested in however, I will be happy to review a PR.

Hello,

working from home during the last year has left me without access to gpib equipment so unfortunately I am mostly stuck as far as testing on real-life equipment goes.

Where I got stuck was: the linux-gpib driver for my NI controller either has missing or buggy automatic serial polling. This is needed for any kind of practically useful event support in pyvisa-py. With that bit not really working on my setup, I was not able to make meaningful progress.

Hopefully with vaccinations going forward I'll be able to pinpoint what exactly is the problem and see how to continue.

LongnoseRob commented 3 years ago

@tivek thank you for the feedback Unfortunately I do not have the setup with NIVisa here at home on my linux machine to support your testing. However if you would like to have me test some pyvia-py modifications, I have a 82357B usb-GBPIB interface and an HP3478A Multimeter here.

tivek commented 3 years ago

@tivek thank you for the feedback Unfortunately I do not have the setup with NIVisa here at home on my linux machine to support your testing. However if you would like to have me test some pyvia-py modifications, I have a 82357B usb-GBPIB interface and an HP3478A Multimeter here.

Great. Actually, what would help is testing some short gpib code to see if and how autopoll works on your setup. Then we can proceed with rudimentary events. Would that be ok? If so, it would be great if you could find some quick-but-not-too-quick action or measurement on HP3478A which would eg. raise the SRQ bit when it is done.

@MatthieuDartiailh is it ok that we continue this gpib-specific communication here?

MatthieuDartiailh commented 3 years ago

Sure go ahead

LongnoseRob commented 3 years ago

Great. Actually, what would help is testing some short gpib code to see if and how autopoll works on your setup. Then we can proceed with rudimentary events. Would that be ok? If so, it would be great if you could find some quick-but-not-too-quick action or measurement on HP3478A which would eg. raise the SRQ bit when it is done.

Yes, we could set the SRQ mask for the data ready feature, and some ranges the conversation rates are very low (only 2-3 readings per second).

If this is would be too fast we still could using single trigger and GET (group exceute trigger) to time it even slower.

Could you point me to which source to checkout to get ready for the testing?

tivek commented 3 years ago

Great. Actually, what would help is testing some short gpib code to see if and how autopoll works on your setup. Then we can proceed with rudimentary events. Would that be ok? If so, it would be great if you could find some quick-but-not-too-quick action or measurement on HP3478A which would eg. raise the SRQ bit when it is done.

Yes, we could set the SRQ mask for the data ready feature, and some ranges the conversation rates are very low (only 2-3 readings per second).

If this is would be too fast we still could using single trigger and GET (group exceute trigger) to time it even slower.

Could you point me to which source to checkout to get ready for the testing?

Sounds like a plan.

The code I used for testing sits locally in my lab - sorry about that. In the next one or two days I am going on site and then I can prepare a minimal example for you to test on linux-gpib.

Basically, in order to implement wait_on_srq() for pyvisa-py we need to ibwait() for a RQS event and then check if the device in question generated the request. I observed that linux-gpib with the NI GPIB-USB-HS ignores the IbcAUTOPOLL configuration option and treats it as always disabled, so an ibwait() on the RQS event times out. On the other hand, NI GPIB drivers on Windows respects autopoll as expected.

LongnoseRob commented 3 years ago

@tivek just wanted to check if you had a chance to retrieve the code used for testing?

tivek commented 3 years ago

@tivek just wanted to check if you had a chance to retrieve the code used for testing?

@LongnoseRob thanks for your patience, I had to leave it for next week because of some sideffects from the covid shot. Luckily next week I should get more time allotted to play with the instruments.

LongnoseRob commented 3 years ago

@tivek DId you had a chance to check your sources for the tests? I think I would be able to do some tests in the next week if I would get some instructions.

hinxx commented 2 weeks ago

Has this PR been abandoned? Will apply against the latest master branch?

MatthieuDartiailh commented 1 week ago

@tivek has not given any news recently. If you are interested by this work I think you can pick it up where he left it.