LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxWriteAnalogF64 - Non Fatal error -200920

Solved!
Go to solution

Hi.

My application is loading a wav file, carving it up into a number of blocks and then continuously playing the file with DaqMxWriteAnalog64. I am seeing a non fatal buffer error and I do not understand the error.

I have created representative sample code that shows the error (error checking removed to keep it simple).

int WriteBlockSize = 51200;
double* pSampleSet = (double*)malloc(WriteBlockSize);
int WriteBufferSize = WriteBlockSize * 4;

DAQmxSetTimingAttribute(taskHandle, DAQmx_SampClk_Rate, 200000.0F);
DAQmxGetTimingAttribute(taskHandle, DAQmx_SampClk_Rate, &resultingSampClkRate);
DAQmxCfgSampClkTiming(taskHandle, "", resultingSampClkRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, WriteBufferSize);
DAQmxRegisterEveryNSamplesEvent(taskHandle, DAQmx_Val_Transferred_From_Buffer, WriteBlockSize, 0, ReloadCallback, (void*)pSampleSet);       
DAQmxWriteAnalogF64(taskHandle, WriteBlockSize, 0,10.0, DAQmx_Val_GroupByChannel, data, &written, NULL);
DAQmxStartTask(taskHandle);

 

The error that I am seeing is a error -200920. This states that "

NON-FATAL RUN-TIME ERROR:  Function DAQmxWriteAnalogF64: (return value == -200920 [0xfffcef28]). Requested Every N Samples Event Interval is not supported for the given buffer size.  Modify the buffer size and/or the Every N Samples Event Interval so the buffer size is an even multiple of the Every N Samples Event Interval. Property: DAQmx_Every N Samples Transferred From Buffer Event Interval Requested Value: 51200 Buffer Size: 10000  Task Name: _unnamedTask<0>  Status Code: -200920"

 

I have done the reading about buffer sizes and the help states that 

"NI-DAQmx allocates a buffer equal in size to the value of the samples per channel attribute/property, unless that value is less than the value listed in the following table. If the value of the samples per channel attribute/property is less than the value in the table, NI-DAQmx uses the value in the table." - the table states a 100kS

 

My requested buffer size is 204800 which should satisfy the note above but the error is saying that my buffer size is 10000.

 

Any help would be gratefully accpeted.

Thanks

 

 

 

 

 

 

0 Kudos
Message 1 of 5
(3,765 Views)

Hello,

 

Have you looked at this forum post which discusses a similar issue?

http://forums.ni.com/t5/LabWindows-CVI/DAQmxWriteAnalogF64-Generation-cannot-be-started-because-the/...

 

Adam.

0 Kudos
Message 2 of 5
(3,728 Views)

Hi Adam

Thanks for the reply. It's a bit of a result when a reply is posted. I did not find this in my search of the forum topics (not sure why).

The help does describe minimum buffer sizes, but what I could not understand was that I was calling up a buffer size > minimum for the sample frequency and it was not giving me a buffer size.

I think that the values of buffer size, write and samplesEvent are not as flexible as I would like and must be all have a common factor.

I have looked again at my application and I think that as opposed to trying to create buffers of odd sizes to match my wav file, I have put constraints on my source data file to make the buffer sizes more standard. Have more buffers of smaller size (say 2000 samples) at 200KHz.

Steve

0 Kudos
Message 3 of 5
(3,715 Views)
Solution
Accepted by topic author StephenPinfold

Hello Stephen,

 

I must admit that my knowledge of C is not incredible. I can read it fine but it would take me some time to code anything significant.

 

It should be possible to allocate a buffer size of your choosing, but it may be that you are corrrect when you suggest that things may not be as flexible as you like.

 

From the table you are referencing, it should indeed default to a buffer of 100ks. it may however be the case that since something has gone wrong it subsequently defaulted back to 10kS. I am not sure if this is standard behaviour or why this has happened, and I have been unable to find any documentation to suggest what may be going on.

 

Have you had any success with your workaround?

 

I look forwards to hearing from you.

 

Best wishes,

 

Adam.

Message 4 of 5
(3,709 Views)

Hi Adam

My work looks like it is working ok. When running at 200KS per second, I chose to make my block size 20,000 samples and a buffer size of 100,000 samples which allows me to keep a couple of blocks loaded in advance but the source data file that I am sending is constrained to a maximum block of 100mS of idle data before the next loop of the source data. This is not ideal but as a compromise it works.

I did try running at 2,000 samples in a block which still set me a buffer size of 100,000 samples allowing me a max of 10mS of idle data. I may still return to this, but it gives me a much heavier CPU load.

The key seemed to be that as the error stated, the write event samples seemed to need to be a factor of the buffer size, but it did not help that the error message was misleading.

Thanks again for your help.

Steve

0 Kudos
Message 5 of 5
(3,687 Views)