06-23-2021 12:38 PM
Hello,
So I've been working on automating a signal generator and an oscilloscope in tandem. Most recently I got my Agilent 83630B to run and take commands. When I tried to run my code with both devices the scope started giving an error I should say that this is the error I get when I changed my USB driver I will show the original error after I change drivers and restart my computer.
"File "C:\Users\99101\AppData\Local\Programs\Python\Python39\lib\site-packages\serial\serialwin32.py", line 64, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM4': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)"
My first thought was that this was some driver issue so I set it to (WinUSB (v6.1.7600.16385)). This didn't correct the issue and gave me the error above. I then went to check the keysight connection manager and other things
The keysight manager displays the scope and seems like it can register a visa address. When I use the IO application to test the commands it outputs the IDN command? which makes me think it is connecting?
When I run this same command through these various addresses I get that error that I mentioned above.
I don't see how it can send commands through the application but not through my python script?
Here you can see my computer sees the scope in my device manager
For some reason the NI max and NI visa do not see the device though and create this error as well?
I will update this in a moment with the other driver errors and it's unique issues.
Solved! Go to Solution.
06-23-2021 12:55 PM
Ok so I will now show the errors with the USB driver that I was using for the signal generator.
So here we have the USB serial driver. When this driver is installed it now registers the devices on the NI max software
It however creates this error?
And this is new it seems like it's able to see the device in the keysight software? It wasn't doing this a moment ago.
It however is not able to take the IDN command and gives this error unlike the other driver.
Here is my python code and the errors I get from that
Any help is greatly appreciated I'm not sure what to do because the capabilities change so much based on these USB drivers? but neither does fully what I want it to do which is control the device through python.
06-24-2021 10:38 AM
I hate to do this.
I switched out the scope yesterday and it wasn't working and changed my backend configuration line of code from this
"rm = pyvisa.ResourceManager('@py')"
to this which should automatically change the backend to something desirable
"rm = pyvisa.ResourceManager()"
then I come in today and turn everything on.
It connected and my code worked
I don't remember changing anything besides switching out the scope and that backend line of code. To people in the future I do recommend changing the line of code I think that's what had this affect.