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

open_gpibethernet()/GPIBCommunicator attribute error #347

Open
pstrk opened this issue Apr 11, 2022 · 6 comments
Open

open_gpibethernet()/GPIBCommunicator attribute error #347

pstrk opened this issue Apr 11, 2022 · 6 comments

Comments

@pstrk
Copy link

pstrk commented Apr 11, 2022

I have been experimenting with the Prologix GPIB-Ethernet adapter and have been facing some issues to get it working.

The open_gpibethernet() method in the instrument module calls the GPIBCommunicator() class with a socket object as the filelike argument:

conn = socket.socket()
conn.connect((host, port))
return cls(GPIBCommunicator(conn, gpib_address, model))

where conn is a socket object.

GPIBCommunciator then raises an AttributeError as the attribute 'terminator' is not defined for the socket object. I think the correct way is to provide a SocketCommunicator as the filelike argument instead. The following corrections seem to fix the issue for the Prologix adapter:

conn = socket.socket()
conn.connect((host, port))
comm = SocketCommunicator(conn)
return cls(GPIBCommunicator(comm, gpib_address, model))
@scasagrande
Copy link
Contributor

I believe you are correct

With those changes, does the GPIB-Ethernet adapter that you have, then function correctly?

@pstrk
Copy link
Author

pstrk commented Apr 11, 2022

My first tests show that I can communicate with the adapter after these changes, let me run a few more tests to check the communication with some actual equipment. Once this is done I can commit & push the changes and create a pull request.

@pstrk
Copy link
Author

pstrk commented Apr 11, 2022

Unfortunately it seems it does not solve all issues when communicating with equipment. I'll look into this in the coming days.

@scasagrande
Copy link
Contributor

No problem. I am interested in hearing more about this so please keep this updated with your findings :)

pstrk pushed a commit to pstrk/InstrumentKit that referenced this issue Apr 11, 2022
pstrk pushed a commit to pstrk/InstrumentKit that referenced this issue Apr 11, 2022
Corrects the GPIBCommunicator class to enable basic support for Prologix adapters in InstrumentKit.
@pstrk
Copy link
Author

pstrk commented Apr 11, 2022

I have now a working solution, but some cleanup is still required.

The main issue was that in the GPIB communicator class there was no clear distinction between the terminator for Ethernet commands (i.e. commands sent to the Ethernet adapter over the network) and the terminator for GPIB commands/in GPIB responses.

These two terminators might be different, e.g. when EOI is enabled there is no terminator for the GPIB commands, but the Ethernet terminator is still required. This lead to some major issues when reading back data from the instrument through the socket_communicator. In addition some required adapter commands were missing. The latest commit provides basic functionality with the Prologix GPIB-Ethernet adapter.

@trappitsch
Copy link
Contributor

This looks great, I'm interested in the solution. I'm gonna get my hands on one of those Prologix connectors next week and can help with testing, if that is of any use to use.

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

No branches or pull requests

3 participants