Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

timeout (200284) from DAQmx when used in threaded loop - parallel processes

Solved!
Go to solution

Hi,

I'm using a NI6537 for fast Digital Acquisition. The board is installed on a NIPXIe-1062 crate controlled by a NI PXIe-8130 controller, where the software is running. I'm reading all the 32 lines as a single channel, at 50MS/s, and the clock is the one provided by the board itself. I put the timeout as infinite, but I also tried various other settings. As I'm reading a finite samples bunch of 524288 samples, at 50 MS/s, a timeout of 1 second should be by far sufficient.

 

As far as I put the DAQmxReadDigitalU32(...) call in a simple loop I have no troubles, everything working fine.

 

for (...) {

   DAQmxReadDigitalU32(...);

} // That loop works perfectly

 

 

 

while, if a have a loop inside a multi-thread process, or simply I give the system some freedom inside the loop, sometimes I get the timeout error. Note that the time cost of the Sleep() function is just of some millisecond, so there is no reason for the call to timeout.

 

for (...) {

   DAQmxReadDigitalU32(...);

   Sleep(1); // To release system resources...

}// That loop stops erratically

 

With the last code, I can also see that actually the board did not complete the reading, i.e. is returning less samples than what requested. It seems to me that someting is stopping the acquisition, but I'm not able to figure what. The same happens even in LabView, using the VI read: sometimes the read randomly generates a timeout error and stops, even if LabView is the only running application.

 

Could you point me what I'm doing wrong?

Thanks, Piero.

0 Kudos
Message 1 of 2
(6,229 Views)
Solution
Accepted by topic author Piero Giubilato

Hello Piero,

 

I am not sure how you built up your code in labVIEW, but I have been unable to reproduce this.  The error that you posted though is indicative of a buffer underflow and we timed out.  How many samples are you requesting to be returned with your DAQmxReadDigitalU32? In the code that I have built up, I simply have left the timeout to the default 10 seconds and have just requested all the samples avaliable in the buffer.  I read off chunks from the buffer until I have hit the desired 524288 samples and then I break out of my loop.

 

This error most likely indicates that you are requesting a specified number of samples and have not yet aquired them in the timeout that you have defined.  Please post back if these suggestions do not help.  

ColeR
Field Engineer
0 Kudos
Message 2 of 2
(6,200 Views)