Timeout error with visa communication between Matlab and Siglent SDS2100X-plus - Page 1
Forum section: electronics / testgear

author: seackone
author_rank: Newbie
timestamp: January 24, 2023, 02:02:13 pm
content: Hi,im using Matlab 2202b and sucessfuly established a TCPIP connection to my oscilloscope using visadev. I was using the programming guide of the scope to receive data. Here is a very simple example of my code:Code:obj = visadev('TCPIP0::192.168.1.2::inst0::INSTR');obj.Timeout = 30;fopen(obj);fwrite(obj, 'WAV:STAR 1');fwrite(obj, sprintf('WAV:POIN %i', 1000));fwrite(obj, sprintf('WAV:SOUR C%i', 1));fwrite(obj, 'WAV:DATA?');data = fread(obj);% data = binblockread(obj,'int8');clear(obj);Short explaination: open visa device, start transmitting at waveform sample 1, transfer 1000 samples, asking for data and using fread or binblockread to read the data. The 'WAV:DATA?' command stopps the scope and queries for the (binblock)data. This works very well at my computer without any dependencies of the scope settings (timebase of the scope for example). The scope is connectd to the computer with a lan cable and a switch in between. Both devices are within the same subnetmask, the computer is using the ip address 192.168.1.1.Now I was changing the location. Same Scope, other Laptop and Matlab version 2022a. In this case, the Laptop is directly connected to the scope via LAN cable. The communication between the two devices works very well but only in dependence of the timebase settings of the scope. If the timebase is low, lets say below 1ms, I can receive data using the script above. If I increase the timebase (the acquisition time of the scope is getting slower), i get a timout error of fread. The same script which works an my laptop causes problems now on an other one. The timeout error message appears very fast after im using the fread command. Much faster than 30 seconds, defined at the visa device. How can this happen? Binblockread also returns an error: "wrong format". Of course, binblockread is expecting something starting with #9... but did not get any values. I guess is the same timeout problem.I was searching for hours yesterday to solve this problem, but did not find any solution. There is also an Python example at the programming guide page 638 but there are no big differences compared to my script (but i also have no experience with python). Do you have any idea?Programming Guide:https://www.siglenteu.com/wp-content/uploads/dlm_uploads/2022/07/SDS_ProgrammingGuide_EN11C.pdf

author: PatrickB
author_rank: Regular Contributor
timestamp: January 24, 2023, 04:23:50 pm
content: I use NI-Visa and C# with my Siglent SDS1000X-E but I don't know MatLab at allIf I understand correctly you have 2 configurations, one that works correctly with Laptop 1 with MatLab 2022B and the other not with Laptop2 and MatLab 2022A. The only common element is the scope.Have you tried capturing data (with utility software, and if I remember correctly there is such software on the NI site) to see if it's ASCII or BIN, if the header is the one you expect and if the number of bytes is the right one.As soon as we use NI-Visa, we encounter this kind of problem, that was my case with the format error. With utility software, I captured the transmission from the scope only to realize that I was not receiving what I needed (the CHDR parameter of the scope did not have the correct value, and BIN data instead of ASCII, .. ).Not knowing Matlab and Python, I only have that as an idea.Or by proceeding by elimination. Try to replace 1 by 1 the elements (software, laptop, Matlab, ...) of the configuration which works by those of configuration 2 which does not work.