Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

VISA serial read never times when using a particular USB devices

$
0
0

LabVIEW 2018, Windows 10 , VISA 17.0

 

Just had a piece of code and USB serial device (ADAM-4561 with a Prolific driver) that has been working for years freeze constantly. The problem is that even though the port is initialized with VISA timeout set to 200 ms, Visa Read *never* returns unless it gets the requested number of bytes...In other words - the timeout never kicks in. We either have to force the application to quit, restart Windows or get a blue screen of death, it varies...

 

The use case is as follows; we flush the buffers, write a short command to an instrument, then run VISA read with the byte count set to 7 as that is the reply header we wait for...Now, if we get those 7 bytes we parse out the length of the message and do another read requesting the remaining number of bytes. However, with this USB device we now suddenly have to make absolutely sure that the receiving buffer actually has that number of bytes already - before read is called (even though, as I mentioned before, the port timeout is set to 200 ms, which should make it return after 200 ms anyway unless the requested number fo bytes arrive within that time.)

 

The workaround is to poll bytes at port repeatedly until the number of bytes have actually arrived, but that kind of defeats why we use the VISA timeout feature in the first place (due to timing constraints we need to maximize the efficiency of the communication).

 

Now, the culprit might be the USB device driver (perhaps it has been updated by Windows at some point), OR it could be related to the change to LabVIEW 2018/VISA 17, which is fairly recent. My question is; is this a known issue with the latter, and/or is there a USB mechanism that is known to cause this behaviour - and if so is there a workaround other than changing the device or use the bytes at port polling solution?


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>