Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronous AI & AO with DAQmx Base under Linux

Hi,

I am trying to use a PCI6182 M Series board with DAQmx Base under Mandrake Linux 10.1 Official (everything is configured OK and examples run fine)

I am trying to obtain synchronous AI and AO (continuous AO single channel and finite samples AI single channel)

DAQmx complains, and exits with an error, when an AI operation is started while the AO operation is running, with the following message:

DAQmxBase Error: RLP Invoke Node <err>The DMA Channel is in the wrong state.  The DMA Channel may need to be <b>Reset</b>.  Or you may have specified an <b>invalid DMA Mode</b>, or a DMA Mode which has not been implemented yet.

I have read on the DAQmx Base documentation that it should be possible to run concurrent tasks as long as they operate on different channels or, if they operate on the same channel, as long as one task is an output and the other is an input.

Apparently I am meeting this condition, but after several trials I am still not able to run the DAQ board as needed.

Does anyone know if it is possible at all to do continuous AO while performing AI under DAQmx Base - Linux ?

I am attaching at the end if this post the core of the code that I am running as a test (it is basically the merge of AO and AO example codes), and the output messages that result from it.

Thanks in advance for any help,

Regards,

Andrea.

  
    // Create Write Task
    printf ("Before creating write task\n");
    DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandleWr));
    DAQmxErrChk (DAQmxBaseCreateAOVoltageChan(taskHandleWr,chanWr,"",min,max,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandleWr, source,sampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,writeSamplesPerChan));
   
    // Start a continuous writig task
    printf ("Before istantiating write task\n");
    DAQmxErrChk(DAQmxBaseWriteAnalogF64(taskHandleWr,writeSamplesPerChan,0,timeout,DAQmx_Val_GroupByChannel,writeData,&pointsWritten,NULL));
    printf ("Before starting write task\n");
    DAQmxErrChk (DAQmxBaseStartTask(taskHandleWr));
   
    // Create Read Task
    printf ("Before creating read task\n");
    DAQmxErrChk (DAQmxBaseCreateTask ("", &taskHandleRd));
    DAQmxErrChk (DAQmxBaseCreateAIVoltageChan (taskHandleRd, chanRd, "", DAQmx_Val_Cfg_Default, min, max, DAQmx_Val_Volts, NULL));
    DAQmxErrChk (DAQmxBaseCfgSampClkTiming (taskHandleRd, source, sampleRate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, readSamplesPerChan));

    // Start a concurrent read task   
    printf ("Before instantiating read task\n");
    DAQmxErrChk (DAQmxBaseReadAnalogF64 (taskHandleRd, pointsToRead, timeout, 0, readData, readBufferSize, &pointsRead, NULL));
    printf ("Before starting read task\n");
    DAQmxErrChk (DAQmxBaseStartTask (taskHandleRd));

    printf ("Acquired %d samples\n", pointsRead);



**********************************OUTPUT FROM PROGRAM******************************************

Before creating write task
Before istantiating write task
Before starting write task
Before creating read task
Before instantiating read task
DAQmxBase Error: RLP Invoke Node <err>The DMA Channel is in the wrong state.  The DMA Channel may need to be <b>Reset</b>.  Or you may have specified an <b>invalid DMA Mode</b>, or a DMA Mode which has not been implemented yet.

   
   


0 Kudos
Message 1 of 2
(2,847 Views)
The error you are seeing is because you are reading from the analog input before starting it.  Switch the order of the start and read and you should be fine.  Also, to improve determinism, I'd suggest creating both tasks (including channel and timing), write, start AO, and then start AI.  The creation of the task takes longer than the other operations.
0 Kudos
Message 2 of 2
(2,832 Views)