From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ-9191 + NI9402 max. reading rate ?

I am using a NI9402 embedded in a NI9191 Wi-Fi Chassis.

 

The input lines on the NI9402  are coming from a cRIO:

Line0: Clock at 1 Mbps

Line1: Data at 1 Mbps

 

The NI9191 Chasis is conected to the computer via Wifi and has been configured with NI-MAX program. (Ad-hoc network NI9191 - Computer).

 

In the code, the acquisition is set to continuous mode and Line0 is used as a clock to trigger the samples.

 

For reading the Samples  from Line1 I call DAQmxReadDigitalLines in a loop.

 

After running the code for few seconds i get an overflow error on the NI9191 Wifi device.

 

Could someone specify which is the maximum speed at which samples can be transfered from NI9191 to the computer via Wifi ?

I noticed that if I use Ethernet, it takes a little bit longer to display the Overflow error but I eventually get it anyway.

 

Thank you very much for your help,

 

 

Error:

 

DAQmx Error: 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 

 

 

 

 

0 Kudos
Message 1 of 5
(5,317 Views)

Hi Coquivhdl,

 

As far as I know, the speed at which samples can be transferred to the computer via Wifi is only limited by the Wifi signal strength and the speed of your network. You can see this on pages 5&6 on the 9191 spec sheet here: http://www.ni.com/pdf/manuals/374048a.pdf

 

Would you mind posting your code for me to take a look at? I find it curious that you are also running into the error when connected over ethernet as well.

 

Thanks,

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(5,289 Views)

Hi Daniel,

Thank you for your answer.

 

I need to acquire 1 Mega Sample per second. Every sample is stored in 1 Byte.

In the NI 9191 module I have maximum strength of Wireless signal (4 bars) and once connected on Ad-hoc mode, Windows acknolwedges a speed on the link of 54 Mbps.

 

The code is as follows : 

 

TaskHandle taskHandle=0;
uInt8 *data=NULL;
uInt32 sampsRead, numChannels, numBytesPerSamp;


DAQmxErrChk (DAQmxResetDevice ("cDAQ9191-196F75DMod1") );

int frequency = 1000000 ;


DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk (DAQmxCreateDIChan(taskHandle,"/cDAQ9191-196F75DMod1/port0/line1","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/cDAQ9191-196F75DMod1/PFI0",(float)frequency,DAQmx_Val_Rising,DAQmx_Val_ContSamps,frequency*2));


DAQmxErrChk (DAQmxStartTask(taskHandle));



int readSize = frequency/2;
int i = 0;

 

while(1){

data=malloc(readSize);

DAQmxErrChk (DAQmxReadDigitalLines (taskHandle, readSize, 2.0, DAQmx_Val_GroupByChannel, data, readSize, &sampsRead, &numBytesPerSamp, NULL));
printf("\nNum %d SampsRead %d",i++, sampsRead);
fflush(stdout);
free(data);
}

 

After running it for a short period of time I get the overflow error mentioned above. According to Windows' Wirless Network Connection Activity , I noticed  that for every 1 Megasample I acquire via Wifi, the number of bytes received are actually around 6 Megabytes. Is that due to the overheading introduced by NI Driver + wifi headers ?  I am definetely transmitting more information han the raw data.

 

Thank you for your help,

 

 

 

 

0 Kudos
Message 3 of 5
(5,282 Views)

Is there any reason why you are reading samples at half the acquisition rate? Every time you acquire samples, it goes into the device buffer. Then when you read the samples, they are removed from the buffer. Since you are acquiring twice the number of samples you read, and your buffer is only twice the size of your rate, you would fill up the device buffer rather quickly. That would definitely be a cause for device buffer overflow.

 

Try setting your readSize to the same as your frequency, or even larger. Also I would try increasing your timeout from 2 seconds to 5 or 10.

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(5,259 Views)

Hi Coquivhdl,

 

Based on our testing, we would expect that you could sustain a rate of 300,000 Samples/second for infrastructure mode. Keep in mind that ad-hoc mode doesn't match the performance of infrastructure, and that you'll probably see slightly better performance with the computer hosting the ad-hoc network.

 

Wired ethernet should have a higher throughput than the wireless, so it makes sense that it takes longer before you receive the error.

 

The data is constantly being transferred from the FIFO onboard the 9191 to RAM on your PC. Based on your error message you are overflowing the FIFO on the 9191, so the bottleneck is the network connection, not your code. Your readSize should be fine, and you shouldn't be running into timeouts.

 

If you have any questions, just let us know.

 

Regards,

Luke B.

Data Acquisition R&D

0 Kudos
Message 5 of 5
(5,180 Views)