Error using GetWaveform() with Agilent technologies
11 views (last 30 days)
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.
% 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.
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.
[w1, w2] = getwaveform(o);
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.