Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

The requested memory could not be allocated USB 6259

Hi,

 

actually the NI USB is driven by an external clock with period of about 200us. The buffer readout is done every 2 seconds. Based on these parameters:

(1000us/2us)*16channels = 8000 samples/second then out of buffer (considering the 4065 buffer size cumulative for all 16 channels). This could be an error source and I'm going to reduce the sampling time but the memory allocation error happens before the measurement starts then should be not related to it. shouldn't it?

 

thanks.

0 Kudos
Message 11 of 17
(1,051 Views)

Hi Fabrizio,

 

don't know how the problem could manifest at the starting point of the execution, but let's try to reduce the sampling freq and see if the problem's still here.

🙂

 

Bye!

FBM

0 Kudos
Message 12 of 17
(1,046 Views)

HI,

 

FBM thanks for your support up to now.

 

I modified the sampling rate and timing in order to avoid the buffer overhead but the issue is still there. As mentioned before the error appears during the init phase before measurement starts (then non related to the buffer overhead).

 

any other suggestion?

0 Kudos
Message 13 of 17
(1,031 Views)

Hi Fabrizio,

 

can you post your code here?

 

THX

 

FBM

0 Kudos
Message 14 of 17
(1,027 Views)

Hi,

following my code. The run function is called just after the ini function. The error message is generated when the "startTask" function is called.

Making some trial I verified that reducing the number of total samples (nValues) for a factor of 16 (just an example value) the error doesn't appear, or at least after 20 repetitions.

 

 

unsigned long NIUSB6259::ADCInit(long nValues, double dSampleClock, MKind mode)
{

 if (m_taskHandle != 0)
   {
  ADCStop();
 }

   m_nValues= nValues;

    uInt32 majorV, minorV;
    DAQmxErrChk (DLL_DAQmxGetSysNIDAQMajorVersion(&majorV));
    DAQmxErrChk (DLL_DAQmxGetSysNIDAQMinorVersion(&minorV));
    qDebug("NIDAQ version is %d.%d",majorV,minorV);


   // make sure the ADC is listening (may have gone crazy last time 😉
   DAQmxErrChk (DLL_DAQmxResetDevice("Dev1"));
  
 // create a task
    DAQmxErrChk (DLL_DAQmxCreateTask("DMA",&m_taskHandle));

   if (mode == MmeasureI)
   {
      // use 16 NRSE analog current input channels
    DAQmxErrChk (DLL_DAQmxCreateAICurrentChan(m_taskHandle,"Dev1/ai0:15","",DAQmx_Val_NRSE,-(NIPCI_CURRENT_MAX),NIPCI_CURRENT_MAX,DAQmx_Val_Amps,DAQmx_Val_External,NIPCI_SHUNTRESISTOR,NULL));
   } else {
      // use 16 NRSE analog voltage input channels
    DAQmxErrChk (DLL_DAQmxCreateAIVoltageChan(m_taskHandle,"Dev1/ai0:15","",DAQmx_Val_NRSE,-(NIPCI_VOLTAGE_MAX),NIPCI_VOLTAGE_MAX,DAQmx_Val_Volts,NULL));
   }

 // define external sampling clock
 DAQmxErrChk (DLL_DAQmxCfgSampClkTiming(m_taskHandle,"/Dev1/PFI0",1.00*dSampleClock,DAQmx_Val_Rising,DAQmx_Val_ContSamps,m_nValues));

 // acquisition will start without external trigger on 1st transition of samplig clock low -> high
 DAQmxErrChk (DLL_DAQmxDisableStartTrig(m_taskHandle));
 // no stop trigger required (stopped by software)
   DAQmxErrChk (DLL_DAQmxDisableRefTrig(m_taskHandle));
 
   // output sampling clock on PFI1
   DAQmxErrChk (DLL_DAQmxExportSignal(m_taskHandle, DAQmx_Val_SampleClock, "/Dev1/PFI1"));

 // output conversion clock on PFI2 (debug)
 DAQmxErrChk (DLL_DAQmxExportSignal(m_taskHandle, DAQmx_Val_AIConvertClock, "/Dev1/PFI2"));

 // check how many channels were reserved (debug)
 unsigned long nChannels;
   DAQmxErrChk (DLL_DAQmxGetTaskAttribute(m_taskHandle, DAQmx_Task_NumChans, &nChannels));

 return m_error;
}

 

unsigned long NIUSB6259::ADCRun()
{
    if (!m_bFunctionsAssigned) { return -1; }

 // start ADC on next positive trigger edge
 DAQmxErrChk (DLL_DAQmxStartTask(m_taskHandle));

 return m_error;
}

0 Kudos
Message 15 of 17
(1,018 Views)

Hi Fabrizio,

 

thanks for the code.

Since I don't see anything wrong in that, I think the only problem is that you're filling the buffer...if you need much more points to be caught you have to improve the speed of the consumer loop, to empty the buffer most fastly.

 

Hope it helps,

FBM

0 Kudos
Message 16 of 17
(1,010 Views)

Hi,

 

I still have this issue. Any other inputs?

 

Thanks.

0 Kudos
Message 17 of 17
(952 Views)