Clear Filters
Clear Filters

Problem Instrument Control Toolbox

6 views (last 30 days)
Martin
Martin on 19 Apr 2023
Commented: Martin on 3 May 2023
I want to send a signal with a DAQ-Box (NI-USB 6361) to a oscillsocop (LeCroy Wavesurfer 4054HD) and write it back to matlab via USB.
Writing the output works perfectly. Reading it with the oscilloscop just works for 50kS. If i increase it to 125kS or more it fails.
--------------------------------------------------------------------------------------------------------
This is the error message:
Index exceeds the number of array elements. Index must not exceed 0.
Error in LeCroyGetChannel (line 8)
[Y, X, YUNIT, XUNIT, HEADER] = invoke(groupObj, 'readwaveform', channel);
--------------------------------------------------------------------------------------------------------
This is how i set up the communication: ( i use the extended driver because then it can tranfer 12 Bit)
(frequency, numerOfSInTot, amplitude are variables - it works for 50kS so there is no problem)
% Create a VISA-USB object.
interfaceObj = instrfind('Type', 'visa-usb', 'RsrcName', 'USB0::0x05FF::0x1023::LCRY4903C18617::0::INSTR', 'Tag', '');
% Create the VISA-USB object if it does not exist
% otherwise use the object that was found.
if isempty(interfaceObj)
interfaceObj = visa('NI', 'USB0::0x05FF::0x1023::LCRY4903C18617::0::INSTR');
else
fclose(interfaceObj);
interfaceObj = interfaceObj(1);
end
% Create a device object.
% deviceObj = icdevice('lecroy_basic_driver.mdd', interfaceObj);
deviceObj = icdevice('lecroy_extended_driver.mdd', interfaceObj);
connect(deviceObj);
LeCroySetTimebase(deviceObj, 1/frequency*numberOfSinTot,-(1/frequency*numberOfSinTot*0.5));
LeCroySetTrigger(deviceObj,'channel1',amplitude*0.1, 'single',0 );
LeCroySetChannelOptions(deviceObj,1,'on',amplitude*1.1,0,0,'ac','200mhz');
pause(1/frequency*numberOfSinTot);
set(deviceObj.Waveform(1), 'Precision', 'int16');
LeCroyChannel1 = LeCroyGetChannel(deviceObj,'channel1'); % get the channel
Is the USB communication limited? Can is solve this problem to improve the transfered samples?
Thank you!

Answers (1)

Sugandhi
Sugandhi on 28 Apr 2023
Hi Martin,
I understand that you want to send a signal with a DAQ-Box (NI-USB 6361) to an oscilloscope (LeCroy Wavesurfer 4054HD) and write it back to MATLAB via USB.
Writing the output works perfectly. Reading it with the oscilloscope just works for 50kS. If you increase it to 125kS or more it fails.
Yes, USB communication can be limited by factors such as bandwidth, buffer size, and data rate. The error message you are seeing indicates that the index exceeds the number of array elements and must not exceed 0. The communication between your oscilloscope and DAQ-Box (NI-USB 6361) seems to be limited as you can write output perfectly but reading it with the oscilloscope only works for 50kS. It is unclear if USB communication is limited but it may be possible to solve this problem by improving the transferred samples.
To improve the transferred samples and potentially resolve the issue, you can consider the following:
  1. Check the USB specifications of both the NI-USB 6361 DAQ device and the LeCroy Wave surfer 4054HD oscilloscope to determine their maximum supported data rates and buffer sizes. Make sure that you are not exceeding these limits, as it may result in data transfer failures or errors.
  2. Optimize your MATLAB code to minimize any delays or overhead in the data transfer process. For example, you can try using more efficient data handling techniques as following using binary or binary block data transfer modes instead of ASCII, reducing unnecessary data conversions, and optimizing your data processing algorithms.
  3. Adjust the buffer size and data rate settings of your DAQ device and oscilloscope to optimize the data transfer performance. You may need to balance the buffer size and data rate to avoid overloading the communication link or causing buffer overflow/underflow issues.
The maximum achievable data rate and reliable data transfer may also depend on the overall system configuration, including the performance of your computer, USB ports, and other components. Therefore, it's important to consider the entire system setup when troubleshooting and optimizing data transfer performance.
  1 Comment
Martin
Martin on 3 May 2023
Thank you!
I used TCP/IP now. tIs possible to transfer 25MS from the oscilloscope to matlab.

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!