Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

The speed of VISA read requests into a while loop

Hello,

 

I'm working on project that reads adc simples  in a very high rate from an MCU based card. To transfer samples to the computer, I've used USB communication (full speed with USBTMC driver).

I've insered a "VISA read" into a while loop, but I have a very bad rate :1 request is sent every 3ms.

 

I have tried to put other functions into the loop in order to make it slowlier but I have always the same result (1req/3ms), so it's not a related to the amout of function in the loop.

I am wondering if its a Labview, VISA driver or Windows limitation.

 

Can you explain to me why I cant have better the 3ms rate??

 

Thank you 

0 Kudos
Message 1 of 10
(4,944 Views)

Code?

0 Kudos
Message 2 of 10
(4,938 Views)

And provide the make and model of the device.

0 Kudos
Message 3 of 10
(4,932 Views)

device : STM32

code: a simple while loop having a read visa block

0 Kudos
Message 4 of 10
(4,905 Views)
You got a USBTMC driver from them. Unusual since USBTMC is based on GPIB communication and you almost always have to do a write first to request data.

In any case, USB has a high latency and for small packets, a 3ms delay does not seem unreasonable. Does the vendor spec this?
0 Kudos
Message 5 of 10
(4,899 Views)

Actually, a VISA read block generate a "REQUEST_IN_MSG" request. After that request, STM32 USBTMC firmware handles this request by sending a response.

Since I am sending samples in a high sampling rate (1mega samples per second) 3 ms is very slow, even If I would send a large amount of samples in a single transfer (actually I try to tranfer 1000 samples at ones)

 

Any suggestion? I need a real time samples tranfer.

 

0 Kudos
Message 6 of 10
(4,884 Views)

The only driver that I found for an STM32 was a virtual com port. That is not at all the same as USBTMC. But whether you really do have a USBTMC driver or not, it apparently has been written by STM and both the number of samples and the transfer rate would be set by firmware they wrote. Are you saying that you only get a single sample at a time or are you actually getting the 1000 that you request? If you set the VISA Read for a high byte count and you are not getting the number of requested bytes, perhaps you need to disable the termination character for a read. Since you have not posted your code or typical data, kind of guessing.

0 Kudos
Message 7 of 10
(4,875 Views)

I've found that I can read data at around 1-3 Msamples per second if I read 100,000 to 500,000 samples for each iteration of my while loop. I had to add a timing sequence to the loop to make sure that it doesn't read data in too quickly though.

0 Kudos
Message 8 of 10
(4,862 Views)

the firmware responds to a "read request" by sending a buffer. It have nothing to do with the timing. I have to handle the "read requests" frequency by Labview. Actually I put in the buffer 1000 samples (I cant store a very large number of samples because of memory constraints) .  

The probleme is that the buffer is updated very quickly and I must not miss any buffer. That's why I must have very accurate and quick "read requests"

0 Kudos
Message 9 of 10
(4,856 Views)
Please can you send to me a code of the application written by a device stm32 f4 to commicate with labview through the usb tmc
0 Kudos
Message 10 of 10
(4,438 Views)