Error using GetWaveform() with Agilent technologies

11 views (last 30 days)
Ayle on 24 Aug 2017
Answered: Wilson A N on 3 Feb 2018
I am trying to get the waveform data from Agilent DSO-X 2024A Oscilloscope. Below is the code for configuration.
function [myScope]= ConfigureScope( ResourceAddress, AcquiringChannel, TriggeringChannel,TriggerMode, TriggerSlope, TriggerLevel)
% Instantiate an instance of the scope.
myScope = oscilloscope();
% Find resources.
availableResources = getResources(myScope);
% tektronix mdo3104 %connect to availble resources
myScope.Resource = ResourceAddress;
% Connect to the scope.
% Enable channel 1.
enableChannel(myScope, AcquiringChannel);
enableChannel(myScope, TriggeringChannel);
% Set the trigger mode to normal.
set(myScope, 'TriggerMode', TriggerMode);
set(myScope, 'TriggerSlope', TriggerSlope);
set(myScope, 'TriggerSource', TriggeringChannel);
set(myScope, 'TriggerLevel', str2double(TriggerLevel));
%%myScope=ConfigureScope('USB::0x0957::0x1796::MY51250127::INSTR', 'Channel1', 'Channel2', 'normal', 'Falling', '0.1')
Scope is establishing connection with the MATLAB. Problem is when I try to get the waveform, it returns an error (The instrument returned an error while executing the function: Specified channel is not enabled.) and displays "query interrupted" on Oscilloscope screen. However, if I comment last four lines of above mentioned code (i.e. donot set any trigger at all), getwaveform() function works fine. Why is that so? I have to get the signal from channel1 when signal is triggered on channel 2.
Moreover, both channels are enabled.
  1 Comment
Ayle on 31 Aug 2017
I have been trying to look into matter further and what I found is, if I press STOP button (manually) just before calling getwaveform() function then instrument is able to return data to MATLAB without error. After acquiring data in MATLAB, if I press RUN I am able to get next signal on channel 1 whenever channel 2 triggers. Now the simple solution, I can think of right now is to send STOP command from MATLAB before calling getwaveform(); I am unable to find a function in Quick control Oscilloscope to send 'STOP/RUN', however I have found a way of sending STOP/RUN using visa connection which I cannot use in this scenario. Can you please guide me how can I do so while using QUICK CONTROL Oscilloscope tool? Anyway, why is this happening? Is there some issue with the drivers or underlying IO Lib functions? As in case of tektronix Oscilloscope, the process is smooth while in case of keysight IO libs, this functionality is not embedded within scope or libs?

Sign in to comment.

Answers (1)

Wilson A N
Wilson A N on 3 Feb 2018
The above error is usually thrown when there is no signal source connected to the channel or when the trigger levels that are set is not a valid value(not in the range of the waveform displayed on the scope).
In these conditions, the getWaveform() function times out after 2 seconds and the instrument proceeds to a frozen/bad state. The instrument will continue to wait until the trigger condition is reached and it will not respond to any SCPI command.
In this stage, however, the connection to the oscilloscope from MATLAB is not lost. If the getWaveform() function is executed again, it will still throw the same error. The device will recover only if a signal source is connected to the channels or the set trigger level is in the valid range of the displayed waveform. Manually pressing the run/stop button on the device will also enable it to recover. During the frozen state, the SCPI command '*RST' also will not work as the device won't respond to it.
Hence, to avoid reaching the frozen state, you can check whether the signal source is connected to the channel and the trigger level is in the valid range or not. If the requirement is such that the trigger level reaches the valid range of the displayed waveform only after a certain time, then executing the getWaveform() function inside the while loop and using a try/catch block may help resolve the issue. The code snippet given below illustrates this behaviour.
while true
[w1, w2] = getwaveform(o);
catch ME
disp('no success. lets retry');
The complete script 'scope_waveform.m' which illustrates the above is attached.
It seems that the issue is present only in Agilent Oscilloscope mainly because of how they handle trigger operations.
If possible, please check with Agilent for a firmware update that can help resolve the issue.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by