QSwitch debugging

[4]:
import pprint
pp = pprint.PrettyPrinter()
from qcodes_contrib_drivers.drivers.QDevil import QSwitch
qswitch_addr = '192.168.8.20'
qswitch = QSwitch.QSwitch('switch', visalib='@py', address=f'TCPIP::{qswitch_addr}::5025::SOCKET')
Connected to: Quantum Machines QSwitch (serial:2, firmware:0.178) in 0.11s

You can record the underlying SCPI commands that are sent to the QSwitch:

[5]:
qswitch.start_recording_scpi()
[6]:
qswitch.reset()
qswitch.arrange(
    breakouts={'DMM': 5, 'VNA': 7},
    lines={'plunger': 23, 'sensor': 5})
qswitch.connect('sensor')
qswitch.breakout('sensor', 'DMM')
qswitch.errors()
[6]:
'0,"No error"'
[7]:
pp.pprint(qswitch.get_recorded_scpi_commands())
['*rst',
 'stat?',
 'clos (@5!9)',
 '*opc?',
 'open (@5!0)',
 '*opc?',
 'clos (@5!5)',
 '*opc?',
 'all?']
[8]:
qswitch.close()

Connections

If you are connecting via USB, then you need pyserial installed.

[1]:
import pyvisa
rm = pyvisa.ResourceManager('@py')
rm.list_resources()
[1]:
('ASRL/dev/ttyS0::INSTR', 'ASRL/dev/ttyACM0::INSTR')
[4]:
from qcodes_contrib_drivers.drivers.QDevil import QSwitch
qswitch = QSwitch.QSwitch('switch', visalib='@py', address='ASRL/dev/ttyACM0::INSTR')
Connected to: Quantum Machines QSwitch (serial:1, firmware:0.162) in 0.06s

If a python process hangs and blocks the ethernet connection to the QSwitch, you can force the QSwitch to drop the connection:

[6]:
qswitch.write('system:comm:lan:close')

See https://github.com/QDevil/qdac2-tools for more debugging tools.

The QSwitch only supports a single Ethernet connection at a time. If you find yourself in a situation where you cannot connect to the instrument, then it might be because some process on your computer still has a connection to the instrument. To identify which process, do something like

$ netstat -ntpn | grep '192.168.8.21'
tcp 0 0 192.168.8.66:43772 192.168.8.21:5025 ESTABLISHED 153450/python3

Then you can forcefully kill the process like

$ kill 153450

and then wait for the TCP connection to let go:

$ netstat -ntpn | grep '192.168.8.21'
tcp 0 0 192.168.8.66:43772 192.168.8.21:5025 TIME_WAIT -