Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 6014 DMA limitations

HI,

I am recently updating my software and seem to now be stumbling over an unexpected NI 6014 DMA limitation. (C#, .NET)

 

Before, I used only a AnalogSingleChannelwrite with DMA on DA 1 and "Manual output" on Demand on DA 0

 

Setting up the DMA_Task like that

 

        public static Task DMA_AO_Task(string dev, int chnl, double uMin, double uMax, int nsamples, double clkRate)
        {
            Task task = new Task();
            task.AOChannels.CreateVoltageChannel(dev + "/ao" + chnl, "", uMin, uMax, AOVoltageUnits.Volts);
            task.AOChannels[0].DataTransferMechanism = AODataTransferMechanism.Dma;
            task.Timing.SampleTimingType = SampleTimingType.SampleClock;
            task.Timing.SampleQuantityMode = SampleQuantityMode.FiniteSamples;
            task.Timing.SamplesPerChannel = nsamples;
            task.Timing.SampleClockRate = clkRate;
            task.Control(TaskAction.Verify);
            return task;
        }
.

. later calling to set up the waveform

 

        SimpleNIDAQ.WriteMultiSample(dma_writer, dma_buf);

 

.

.

 

and finally in a loop (as a test here)

 

        while (!Console.KeyAvailable)
        {
            dma_task.Start();

.

. Do something usefull while the DMA output is running

.

            dma_task.WaitUntilDone();
            dma_task.Stop();
        }

        sgl_task.Stop();

 

Works like a charm, even stable when going much higher than the guaranteed 10KHZ DMA output rate.(3GHZ Dual Core processor)

(Up to > 100 KHz!)

 

So now I simulatneaously want the DA0 output also to be generated by DMA, synchroneously with DA1 as before.

 

I do again with nchnl = 2, using an AnalogMultiChannelWriter

 

        public static Task DMA_MultiAO_Task(string dev, int chnl, int nchnl, double uMin, double uMax, int nsamples, double clkRate)
        {
            Task task = new Task();
            for (int i = 0; i < nchnl; i++)
            {
                task.AOChannels.CreateVoltageChannel(dev + "/ao" + chnl++, string.Empty, uMin, uMax, AOVoltageUnits.Volts);
                task.AOChannels[i].DataTransferMechanism = AODataTransferMechanism.Dma;
            }
            task.Timing.SampleTimingType = SampleTimingType.SampleClock;
            task.Timing.SampleQuantityMode = SampleQuantityMode.FiniteSamples;
            task.Timing.SamplesPerChannel = nsamples;
            task.Timing.SampleClockRate = clkRate;
            task.Control(TaskAction.Verify);
            return task;
        }

 

Later

 

        SimpleNIDAQ.WriteMultiSample(dma_writer, dma_buf);

 

and finally again

 

        while (!Console.KeyAvailable)
        {
            dma_task.Start();

//

// Do something useful while the waveforms are output

//
            dma_task.WaitUntilDone();
            dma_task.Stop();
        }


RESULT: Not stable, even when reducing the DMA rate to a few kHz! :

 

>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 with the device output rate.

>Reduce your sample rate, alter the data transfer method (from interrupts to DMA), use a product with more onboard memory, or reduce the number of >programs your computer is executing concurrently.

 

Most of the time it gets around the loop once, sometimes not at all, sometimes twice, but as long as it runs, it works, I can see the waveform on the oscillosope!

 

What is the problem here? I know that NI 6014 has only one DMA channel, but as I want to output all the samples on the same trigger, should be no problem at all? Somehow it seems thta probably the driver falls back to interrupt processing when using Multichannel writer, but when I look in the Task contents, DMA is still set there for both channels!

 

Whar can I do??

 

Sincerely

 

Joachim

 

0 Kudos
Message 1 of 2
(2,940 Views)

Joachim,

 

the output task does indeed contain two AO channels configured for DMA transfer. The problem occurs most probable because the 6014 has no AO FIFO onboard. So there is no buffer on the device to handle some kind of performance peaks. Since you have to "swap between the AO channels (e.g. Sample AO 0, Sample AO 1, Sample AO 0, Sample AO 1, ...)", you have to supply the device with a sample for each hardware clock tick. If you are late, you will receive the error you are seeing.

In the case of the single channel solution, the device can use the output register as a "single sample output FIFO" which will make your application work.

 

The only feasable solution for this request is to purchase hardware which has an output FIFO onboard. You can use M-, or X-Series devices like the 6221, which has 8k onboard FIFO for AO.

 

Sorry for this outcome,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 2
(2,912 Views)