Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

onboard device memory underflow USB 6251

Hi

 

I saw that many people got this error :

 

DAQmx Error: Onboard device memory underflow. Because of system and/or bus-bandwidth limitations, the driver could not write data to the device fast enough to keep up the device output rate.
Reduce your sample rate, or reduce the number of programs your computer is executing currently.
Task Name : _unnamedTask<0>

Status Code: -200621

 

I am trying to generate a sine signal with a frequency between 4kHz and 40 kHz. I want at least 25 samples per period so I have a maximum sampling frequency of 1 MHz.

I tried to change the data transfer mechanism but I am not allowed to choose interrupt. I can only select programmedIO or USB bulk.

My code is based on the example CntAcq-IntClk-EveryNSamplesEvent

Here is the architecture of my code :

 

In Main:

 

DAQmxErrChk (DAQmxCreateTask("",&genTaskHandle)); 
DAQmxErrChk (DAQmxCreateAOVoltageChan (genTaskHandle, channels, "", -Range, Range, DAQmx_Val_Volts, NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming (genTaskHandle, "",SamplingFrequency, DAQmx_Val_Rising, DAQmx_Val_ContSamps,NumberOfSamples));
DAQmxErrChk (DAQmxSetWriteAttribute (genTaskHandle, DAQmx_Write_RegenMode, DAQmx_Val_DoNotAllowRegen));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent (genTaskHandle, DAQmx_Val_Transferred_From_Buffer, NumberOfSamples, 0, OnEveryNSamplesEvent, NULL));
DAQmxCfgOutputBuffer (genTaskHandle,4*NumberOfSamples);
DAQmxErrChk (DAQmxWriteAnalogF64 (genTaskHandle, NumberOfSamples, 0, Range, DAQmx_Val_GroupByScanNumber, data, NULL, NULL));
DAQmxErrChk (DAQmxStartTask(genTaskHandle));
while (!Done)
          DAQmxIsTaskDone(genTaskHandle, &Done); 
DAQmxStopTask(genTaskHandle);
DAQmxClearTask(genTaskHandle); 

 

 

In OnEveryNSamplesEvent

 

CheckIfFinish()
If True
    taskHandle=0;
    DAQmxStopTask(taskHandle);
    DAQmxClearTask(taskHandle);
    return 0

else
    GenerateData()
    DAQmxErrChk (DAQmxWriteAnalogF64 (taskHandle, NumberOfSamples, 0, Range, DAQmx_Val_GroupByScanNumber, data,  &NumberOfWrittenSamples,    NULL));
     genTaskHandle=0;
 
return 0

 

I don't know what is wrong with my code or the settings of the card. Is there anyone who can help me ? Please

 

 

 

0 Kudos
Message 1 of 3
(3,590 Views)

Hi,

 

Everything is explain in your error message. Indeed, the driver could not write data from your PC buffer to the onboard memory of your device because of the bus-bandwidth limitations. What happens then is that there is no more sample to generate from the onboard memory of your device.

 

What you have to do is to allow regeneration of your waveform that is into your onboard memory. Replace the last parameter of the DAQmxSetWriteAttribute function by DAQmx_Val_AllowRegen as shown below in order to allow regeneration.

 

DAQmxErrChk (DAQmxSetWriteAttribute (genTaskHandle, DAQmx_Write_RegenMode, DAQmx_Val_AllowRegen)); 

 

Regards

 

 

0 Kudos
Message 2 of 3
(3,497 Views)

Thank you.

I finally understood that my computer is too slow to be able to write/read at the required speed.

 

0 Kudos
Message 3 of 3
(3,482 Views)