Rohde-Schwarz / RsInstrument

RsInstrument is a Python remote-control communication module for Rohde & Schwarz SCPI-based Test and Measurement Instruments.
MIT License
72 stars 16 forks source link

NRP Power Sensor I/O Error Ubuntu 20.04 #12

Closed Testudoed closed 10 months ago

Testudoed commented 1 year ago

Attempting to connect to a NRP-Z85 Power Sensor from Ubuntu 20.04

Versions: PyVISA==1.13.0 RsInstrument==1.54.0

rsvisa==5.12.9 NRP_Toolkit==4.21

NRP-Z85 Firmware==1.37

Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from RsInstrument import *
>>> resource = 'USB::0x0AAD::0x0083::102199::INSTR'
>>> nrp = RsInstrument(resource)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/RsInstrument.py", line 67, in __init__
    self._core = Core(resource_name, id_query, reset, driver_options=RsInstrument._driver_options_const, user_options=options, direct_session=direct_session)
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/Core.py", line 212, in __init__
    self.io = Instrument(self.resource_name, self.simulating, self._instrumentSettings, handle)
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/Instrument.py", line 87, in __init__
    self._set_session(VisaSession(resource_name, self._settings, direct_session))
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/VisaSession.py", line 114, in __init__
    raise e
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/VisaSession.py", line 111, in __init__
    self._session = self._rm.open_resource(resource_name=pure_resource_name, open_timeout=settings.open_timeout, access_mode=acc_mode)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 3284, in open_resource
    res.open(access_mode, open_timeout)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/resources/resource.py", line 282, in open
    self.session, status = self._resource_manager.open_bare_resource(
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 3209, in open_bare_resource
    return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/ctwrapper/functions.py", line 1851, in open
    ret = library.viOpen(
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/ctwrapper/highlevel.py", line 226, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 251, in handle_return_value
    raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_IO (-1073807298): Could not perform operation because of I/O error.

Using RSNRP in the address gives an error finding the device

Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from RsInstrument import *
>>> resource = 'RSNRP::0x0083::102199::INSTR'
>>> nrp = RsInstrument(resource)
Traceback (most recent call last):
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/VisaSession.py", line 111, in __init__
    self._session = self._rm.open_resource(resource_name=pure_resource_name, open_timeout=settings.open_timeout, access_mode=acc_mode)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 3247, in open_resource
    info = self.resource_info(resource_name, extended=True)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 3174, in resource_info
    ret, err = self.visalib.parse_resource_extended(self.session, resource_name)
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/ctwrapper/functions.py", line 2077, in parse_resource_extended
    ret = library.viParseRsrcEx(
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/ctwrapper/highlevel.py", line 226, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "/nrp-test/venv/lib/python3.8/site-packages/pyvisa/highlevel.py", line 251, in handle_return_value
    raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/RsInstrument.py", line 67, in __init__
    self._core = Core(resource_name, id_query, reset, driver_options=RsInstrument._driver_options_const, user_options=options, direct_session=direct_session)
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/Core.py", line 212, in __init__
    self.io = Instrument(self.resource_name, self.simulating, self._instrumentSettings, handle)
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/Instrument.py", line 87, in __init__
    self._set_session(VisaSession(resource_name, self._settings, direct_session))
  File "/nrp-test/venv/lib/python3.8/site-packages/RsInstrument/Internal/VisaSession.py", line 117, in __init__
    raise InstrumentErrors.ResourceError(resource_name, message)
RsInstrument.Internal.InstrumentErrors.ResourceError: Insufficient location information or the requested device or resource is not present in the system.
Library: Visa Library at /usr/lib/librsvisa.so
Manufacturer: Rohde & Schwarz GmbH
Resource Name: 'RSNRP::0x0083::102199::INSTR'

NRPZ0 is mounted to /dev/NRPZ0 with the following permissions: crw-rw-rw- 1 root root 180, 0 Aug 7 14:55 nrpz0

In addition, none of the tools provided with RS VISA is able to detect or connect to the NRP-Z85 I successfully tested this power sensor on a Windows 10 machine with both RS VISA and NRP-Toolkit installed. Does the Ubuntu version of NRP-Toolkit contain the translation layer from NRP proprietary to VISA?

Thanks

Miloslav-RS commented 1 year ago

Hi Testudoed,

RS VISA under Ubuntu does not support the NRP-Zxx powersensors. Only Windows version of the RS VISA supports that. Let me clarify with a colleague if there is a way to do this. Unfortunately everybody is on vacation now :-( I'll get back to you.

Milo

Miloslav-RS commented 10 months ago

Currently, there is no way to use the VISA on Ubuntu, you have to stick to the rsnrp or nrpcontrol APIs.