Products > Test Equipment
R&S CMW500 Remote control using SCPI commands
(1/1)
zazas321:
Hello. We have recently started a project which involves testing the DUT (Device under the test) using CMW500 instrument using SCPI commands via USB/GBIP interface.
This is first time I am using specialized testing equipment such as CMW500 and first time using SCPI commands so everything is new to me. I have started to familiarize myself with:
https://www.ivifoundation.org/downloads/SCPI/scpi-99.pdf
https://www.rohde-schwarz.com/webhelp/Remote_Control_SCPI_HTML_GettingStarted/Content/d512ae4c23784e52.htm
http://www.vogold.com.cn/upfile/cmw500pdf/cmw500_usermanual_v3-0-14.pdf
I have downloaded R&S Visa software and managed to connect to the instrument via USB and get information with *IDN? command:
After reading the docs I have the followings questions:
1. There are commands such as *CLS and *RST. When I query either of those commands, I am not getting any response. Are these commands only supposed to be Written without any response? How can I know whether the command went through successfully?
2. I have found R&s Python driver for Python (https://github.com/Rohde-Schwarz)
I have implemented the following code:
--- Code: ---from RsInstrument.RsInstrument import RsInstrument
import sys
import time
def main():
# Define the resource string for the instrument connection
resource_string_4 = 'USB0::0x0AAD::0x0057::103840::0::INSTR' # USB-TMC (Test and Measurement Class)
# Initialize the instrument once
instr = RsInstrument(resource_string_4, True, False)
instr.reset()
time.sleep(1)
idn = instr.query_str('*IDN?')
print(f"\nHello, I am: '{idn}'")
# Issue reset and clear status commands, waiting for completion
'''
instr.write('*RST')
instr.write('*CLS')
opc_result = instr.query_str('*OPC?')
print(f"Reset and clear complete with OPC result: {opc_result}")
'''
# Query the current frequency
frequency = instr.query_str('SOURce:GPRF:GENerator:RFSettings:FREQuency?')
print("Initial frequency = ", frequency)
# Set a new frequency and wait for completion
instr.write('SOURce:GPRF:GENerator:RFSettings:FREQuency 1.5GHz')
opc_result = instr.query_str('*OPC?') # Read the response from *OPC?
print(f"Frequency set completed with OPC result: {opc_result}")
# Query the updated frequency
frequency = instr.query_str('SOURce:GPRF:GENerator:RFSettings:FREQuency?')
print("Updated frequency = ", frequency)
instr.close()
return 1
if __name__ == "__main__":
result = main()
sys.exit(result)
--- End code ---
Sometimes, the script runs without any issues and I get the following:
--- Code: ---Hello, I am: 'Rohde&Schwarz,CMW,1201.0002k50/103840,2.1.10.16'
Initial frequency = 1.200000E+009
Frequency set completed with OPC result: 1
Updated frequency = 1.500000E+009
--- End code ---
However, sometimes (maybe about 2 out of 5 times), I get the following:
--- Code: ---Traceback (most recent call last):
File "C:\Users\petrikas.lu\Desktop\WORK\CMW500_ANALYSYS\cmw500_test.py", line 46, in <module>
result = main()
File "C:\Users\petrikas.lu\Desktop\WORK\CMW500_ANALYSYS\cmw500_test.py", line 12, in main
instr = RsInstrument(resource_string_4, True, False)
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\RsInstrument\RsInstrument.py", line 77, in __init__
self._core = Core(resource_name, id_query, reset, driver_options=RsInstrument._driver_options_const, user_options=options, direct_session=direct_session)
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\RsInstrument\Internal\Core.py", line 268, in __init__
self.io = Instrument(self.resource_name, self.simulating, self._instrumentSettings, handle)
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\RsInstrument\Internal\Instrument.py", line 88, in __init__
self._set_session(VisaSession(resource_name, self._settings, direct_session))
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\RsInstrument\Internal\VisaSession.py", line 217, in __init__
stb = self._read_stb()
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\RsInstrument\Internal\VisaSession.py", line 603, in _read_stb
return StatusByte(self._session.read_stb())
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\resources\messagebased.py", line 771, in read_stb
value, retcode = self.visalib.read_stb(self.session)
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\ctwrapper\functions.py", line 2361, in read_stb
ret = library.viReadSTB(session, byref(status))
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
return self.handle_return_value(session, ret_value) # type: ignore
File "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_value
raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
--- End code ---
I cannot wrap my head around why would it behave like that |O it works once or twice and then gives this timeout error. Then when I try a few moments later, it works again..
3. My Final goal is to be able to configure the CMW500 as shown here:
Main parameters of the LTE 4G analyzer configuration:
- LTE Measurement reception sur RFcom
- RF settings :
o Channel :18300
o Frequency : 1960.50MHz
o Expected Nom.Power : 23.0dBm
o User Margin : 13dB
o External Atten. : depends on the measurement paths
- Measurement control :
o Bandwidth : 20.0MHz
o Channel type : PUSH
o Network Signaled Value : NS_01
o RB Allocation : 50
o Modulation : QPSK
- Trigger :
o Trigger Source : Free Run (Fast Sync)
o Trigger Slope : RisingEdge
o Trigger Threshold : -20.00dB
o Trigger Delay : 0.0μs
o Trigger Timeout : 100ms
o Min Trigger Gap : 2 Slot
I have already figured out that I can set frequency using the following command:
--- Code: ---SOURce:GPRF:GENerator:RFSettings:FREQuency 1.960GHz
--- End code ---
but I cannot seem to find any information about setting the parameters such as Expected.Now Power, User Margin. Where can I find SCPI commands related to these RF Settings?
Navigation
[0] Message Index
Go to full version