R&S CMW500 Remote control using SCPI commands - Page 1
Forum section: electronics / testgear

author: zazas321
author_rank: Newbie
timestamp: October 23, 2024, 11:31:25 am
content: 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.pdfhttps://www.rohde-schwarz.com/webhelp/Remote_Control_SCPI_HTML_GettingStarted/Content/d512ae4c23784e52.htmhttp://www.vogold.com.cn/upfile/cmw500pdf/cmw500_usermanual_v3-0-14.pdfI 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 RsInstrumentimport sysimport timedef main():# Define the resource string for the instrument connectionresource_string_4 = 'USB0::0x0AAD::0x0057::103840::0::INSTR' # USB-TMC (Test and Measurement Class)# Initialize the instrument onceinstr = 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 frequencyfrequency = instr.query_str('SOURce:GPRF:GENerator:RFSettings:FREQuency?')print("Initial frequency = ", frequency)# Set a new frequency and wait for completioninstr.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 frequencyfrequency = instr.query_str('SOURce:GPRF:GENerator:RFSettings:FREQuency?')print("Updated frequency = ", frequency)instr.close()return 1if __name__ == "__main__":result = main()sys.exit(result)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+009Frequency set completed with OPC result: 1Updated frequency = 1.500000E+009However, 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 maininstr = 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_stbreturn 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_stbvalue, 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_stbret = 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_handlerreturn self.handle_return_value(session, ret_value) # type: ignoreFile "C:\Users\petrikas.lu\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_valueraise errors.VisaIOError(rv)pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.I cannot wrap my head around why would it behave like thatit 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 :18300o Frequency : 1960.50MHzo Expected Nom.Power : 23.0dBmo User Margin : 13dBo External Atten. : depends on the measurement paths- Measurement control :o Bandwidth : 20.0MHzo Channel type : PUSHo Network Signaled Value : NS_01o RB Allocation : 50o Modulation : QPSK- Trigger :o Trigger Source : Free Run (Fast Sync)o Trigger Slope : RisingEdgeo Trigger Threshold : -20.00dBo Trigger Delay : 0.0μso Trigger Timeout : 100mso Min Trigger Gap : 2 SlotI have already figured out that I can set frequency using the following command:Code:SOURce:GPRF:GENerator:RFSettings:FREQuency 1.960GHzbut 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?