Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast retriggering without Stop/Start overhead?

What is the right way to capture a burst of  N samples, every time a trigger pulse arrives? 

I'm using an NI4462, so would expect to be able to sample every 5us, and re-trigger within perhaps 10us.

Typically, N ~ 40, and triggers arrive (about) every 0.2 ms.

 

I just made some measurements of the performance of DAQmx, doing the following:

     Configure task. Set sample_freq = 200 kHz, N_samples = 40,  Finite acquisition.

     Commit task

     while (1){

          StartTask             //This waits for trigger

          ReadData             //Tight loop, non-blocking reads of 40 samples as they become available,

          StopTask

          printf ()                 //One line, printing the times taken by the 4 instructions.

     }

          

This loop does nothing else (except for some gettimeofday() calls for instrumentation; it ignores the resulting data.

 

I'm triggering PFI0 at 1 MHz, so that the trigger delay is < 1us.

I have the CPU pegged flat out (1.8 GHz), and am running this job as nice -n -20.

 

Results:

   taskStart:   takes  0.46 - 0.70 ms

   taskStop:   takes  0.22 - 0.30 ms

   Read          takes 0.66 - 0.68 ms     

   Printf          takes 0.04 - 0.07 ms

 

BUT this is WAY too slow. The overhead of starting, stopping (and reading) the task is too great.

 

How can I make a single task re-triggerable? Or is there a way to gate the sampling on/off?

 

Is there any way to get a lower-level interface to the card than using libnidaqmx?

 

Thanks very much for your help.

 

  

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

Hi Richard,

 

Unfortunately due to the nature of the Delta-Sigma ADC which your DSA card uses, it is not possible to retrigger acquisitions on the hardware or gate the sampling. This is possible with some of our DAQ cards which have onboard counters and different ADC configurations.

 

If you contact customer services at NI UK, we can arrange for one of our field engineers to visit you and see what hardware alterations might be advisable for your application.

 

Kind Regards,

0 Kudos
Message 2 of 3
(1,814 Views)

I understand that this can't be done directly in hardware: the NI4462 is missing the necessary control functionality. But it must surely be possible to reduce the overhead of the C-library function calls.

When the card signals to the kernel driver (nikal.c) that the task is done; the kernel driver should immediately retirgger it, without passing control back to userspace.

 

I am reminded of the following:

1 : “There is no problem in computer science that cannot be solved by an extra level of indirection.”

2 : “Any performance problem can be solved by removing a level of indirection”

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