Closing an ASRL instrument, and resource manager, faults other unrelated USB serial devices.
Once opened and closed - the other devices can only be used again by re-opening the instrument, then re-opening the serial port
ttyUSB0 is an un-related serial-to-uart device
ttyACM0 is the instrument being controlled
Open serial device, send/receive data OK self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
Open instrument using self.inst = self._rm.open_resource("ASRL" + port + "::INSTR")
With opened serial device, send/receive data OK
Close instrument using self.inst.close()
With opened serial device, send data OK, no data received
Close serial device
Open serial device, send data OK, no data received self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
Scenario two; Opening serial port while instrument opened, then closing instrument
Open instrument using self.inst = self._rm.open_resource("ASRL" + port + "::INSTR")
Open serial device, send/receive data OK self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
Close instrument using self.inst.close()
With opened serial device, send/receive data OK
Output of pyvisa-info
Machine Details:
Platform ID: Linux-4.19.94-ti-r42-armv7l-with-debian-10.3
Processor:
Python:
Implementation: CPython
Executable: /usr/bin/python3
Version: 3.7.3
Compiler: GCC 8.3.0
Bits: 32bit
Build: Dec 20 2019 18:57:59 (#default)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
Binary library: Not found
py:
Version: 0.5.1
ASRL INSTR: Available via PySerial (3.5)
USB INSTR: Available via PyUSB (1.2.1). Backend: libusb1
USB RAW: Available via PyUSB (1.2.1). Backend: libusb1
TCPIP INSTR: Available
TCPIP SOCKET: Available
GPIB INSTR:
Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of funcionality.
No module named 'gpib'
Can you try to reproduce using only pyserial ? if you look at serial.py in pyvisa-py you will see that closing an instrument simply calls serial.Serial.close and I fail to see how pyvisa-py messes things up.
Closing an ASRL instrument, and resource manager, faults other unrelated USB serial devices. Once opened and closed - the other devices can only be used again by re-opening the instrument, then re-opening the serial port
ttyUSB0 is an un-related serial-to-uart device ttyACM0 is the instrument being controlled
To Reproduce
Steps to reproduce the behavior:
Scenario one; Opening and closing instrument
self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
self.inst = self._rm.open_resource("ASRL" + port + "::INSTR")
self.inst.close()
self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
Scenario two; Opening serial port while instrument opened, then closing instrument
self.inst = self._rm.open_resource("ASRL" + port + "::INSTR")
self._port = serial.Serial(port, baudrate=baudrate, timeout=0.1)
self.inst.close()
Output of
pyvisa-info