-
Notifications
You must be signed in to change notification settings - Fork 315
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
Lakeshore 336 Driver with USB interface not connecting #5369
Comments
Hi @filmartinelli I am not sure it the driver has been tested with usb connection but normally it should work. Could you show the exact command you use to connect. |
Also its usually a good idea to test if you can connect with the utility program supplied from the visa library vendor. Ni Max if you use the NI drivers etc. |
Hi @jenshnielsen . The line that I use to connect to the instrument is the following ASRL4::INSTR is the VISA resource name that I can find on NI MAX or with PyVisa Resource manager. I tried to connect the instrument via NI MAX and it works perfectly. However, in order to succesfully establish the connection, I need to specify proper parameters in terms of baud rate, bit number and parity. These parameters are different from the default values. In QCodes I did not find a way to specify the parameters of the serial communication, so I guessed that the problem could come from the driver establishing a communication with default parameters which are wrong. Serial com parameters are as follow
Thank you! |
I am a bit surprised to see that it's a serial instrument and not a usb instrument https://pyvisa.readthedocs.io/en/latest/introduction/names.html Perhaps its also possible to connect as a usb instrument. We typically have not needed to expose these kinds of settings but if it is required, we are happy to review a pr that makes it possible to set then on the Lakeshore class. |
I was surprised as well, however according to the manual the USB interface just emulates a serial port and it does not mention any way to use it as a USB instrument. Here a screenshot of the manual To my understanding, it seems that the only possible way to establish connection via USB as Serial. |
We had that issue a while ago. The default settings for the serial connection are set to 9600 as far as I know. A workaround would be to directly use pyvisa's ResourceManager, to open the connection to the device and then create the Lakeshore336 instance. Here's some code (in this case the port was "COM3"): from pyvisa import ResourceManager, constants
rm = ResourceManager()
LS366 = rm.open_resource("COM3", baud_rate=57600, parity=constants.Parity.odd, data_bits=7)
lake = Model_336("lake", "COM3") Cheers |
@frankhoff I am not completely sure that would always be safe since it relies on pyvisa always reusing the resouce. In the mean time I have opened #5485 to allow these kwargs to be passed to open_resource |
Thanks for the reply! Passing kwargs to open_resource for serial devices sounds like a good idea to me 👍 |
I solved this by overloading def _open_resource(self, address: str, visalib: str | None) -> tuple[MessageBasedResource, str, ResourceManager]:
# first call the existing _open_resource method
resource, visabackend, resource_manager = super()._open_resource(address, visalib)
# then set the odd communication settings that can't be passed by argument with the current api
from pyvisa import constants
resource.parity = constants.Parity.odd
resource.data_bits = 7
return resource, visabackend, resource_manager |
If you encounter a bug, use the following template.
If you have a feature request feel free to freestyle or use ideas section in the discussions
here.
If you have a question or general opinion, open your query on a relevant discussion section.
Bug report template:
The driver for the lakeshore 336 does not connect when using USB interface
Steps to reproduce
Expected behaviour
The device is connected
Actual behaviour
The device runs in timeout when waiting for the *IDN?\n
System
It would be helpful to provide such information:
Windows 10
If you are using a released version of qcodes (recommended):
latest release
The text was updated successfully, but these errors were encountered: