I have a USB-6343, X series DAQ device with BNC termination that I am using to collect counts from an avalanche photodiode connected to the ctr1 channel in a counter task. I am timing the task using a pulse streamer connected to the PFI0 channel. The task is triggered automatically and reads the samples into a buffer with pre-allocated size at every rising edge detected from the external clock (which is connected to PFI0).
The pulse streamer produces 10 ns pulses in the following sequence:
100 ns off - 10ns pulse - 390ns off - 10ns pulse - 4us off - 10 ns pulse - 390ns off- 10 ns pulse- 1 us off
This means that the shortest time between two ticks of the external clock is 400ns, corresponding to 2.5 MHz, which is the value I set the DAQ sampling rate. The sequence runs n times (typically ~10,000) and total tick number is 4*n, which is the size of my counter buffer.
From a reason I don't understand, I get the following error at random times (everything will work most times, but every now and then when I try to run the code it produced this error):
nidaqmx.errors.DaqError: Onboard device memory overflow. Because of system and/or bus-bandwidth limitations, the driver could not read data from the device fast enough to keep up with the device throughput.
Reduce your sample rate. If your data transfer method is interrupts, try using DMA or USB Bulk. You can also use a product with more onboard memory or reduce the number of programs your computer is executing concurrently.
Status Code: -200361
I tried reducing the sampling rate, running the sequence for fewer times, and closing all programs on my computer, but the error still comes up pretty randomly. It happens less often when I run the sequence fewer times, but it still happen with no apparent pattern.
I would really appreciated your help in this matter.
It is important to note I am using the python API with the following code:
for timing
timing.cfg_samp_clk_timing(
sampling_rate,
source= self.clk_channel, #PFI0
sample_mode=AcquisitionType.CONTINUOUS)
for reading
read_many_sample_uint32(
self.ni_ctr_sample_buffer,
number_of_samples_per_channel= self.buffer_size)