Why does "readbinblock" function return incomplete data or crash MATLAB when reading large waveform data from a TCP/IP instrument using NI-VISA driver?

When reading large chunks of data from an instrument over a TCP/IP VISA connection (for example, a VXI-11 resource such as TCPIP0::<IP-address>::inst0::INSTR), readbinblock or read function execution does not complete successfully and I see one of the following problems:
  • The readbinblock or read function errors with VI_ERROR_TMO timeout and returns fewer bytes than expected.
  • MATLAB crashes during the read operation.
I see this issue only with the NI-VISA driver, and the same operation works fine when working with a different VISA driver.

 Risposta accettata

This is a known issue in NI-VISA 2026.x driver that affects VXI-11 TCP/IP instrument communication that can affect larger VXI-11 read operations (~1024 bytes and above).
When this issue occurs, NI-VISA can read more data than requested during a read operation. As a result, the MATLAB Instrument Control Toolbox's readbinblock or read function, that internally uses the VISA driver, can return incomplete data.
Also, subsequent read operations can fail with VI_ERROR_TMO, and in some cases cause MATLAB to crash.
Possible Workarounds
You can try one of the following workarounds to see if it fixes the issue:
  1. Use a vendor VISA configiration software on your system to manually set the preferred VISA driver to something other than NI-VISA.
  2. Use NI-VISA version 2024.5, which does not contain this issue.
  3. Read data in smaller chunks. For example, read 1000 bytes or fewer per operation and continue reading until you receive the complete response.
  4. Use a raw TCP/IP socket connection instead of VXI-11, if your instrument supports socket communication. For example: >> v = visadev("TCPIP0::<IP-address>::5025::SOCKET");
For more information, see the NI knowledge base article: Timeouts or Crashes When Reading from VXI-11 Instruments Using NI-VISA 2026.x - NI

Più risposte (0)

Categorie

Prodotti

Release

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by