07-19-2012 01:44 PM
Hi I am using NI-USB 6251 board with NI-DAQmx software libraries in .Net to get samples of a really small TTL pulse of width 700microSeconds.
I am keeping Sampling rate of 100000/s and buffer size is 100000 too. I am making use of EveryNSamplesRead event to catch 100000 samples every second.
However when I run my program in a seperate application or solution it runs fine at this sampling rate and buffer size. But when I make it run on a separate thread along side of my main application it fails with
Errorcode : 200279
Description: Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
Possible cause: The application did not retrieve the data from the buffer fast enough, so the data was overwritten.
If I reduce the sampling rate to 50000/s and buffer size to 50000 then It runs perfect even on thread alongside of the main application.
Please let me know why is this. And way to achieve it with sampling rate of 100000/s with buffer size of 100000 in a multithreaded environment.
Thanks
Shrikant.
07-20-2012 03:25 PM
Hello prabhushrikant,
this issue could be due to the latency and delay from USB port connections. I would recommend first increasing the buffer size to 120000 samples. The second suggestion is you can read data from the card twice a second instead of once per second.
If that is not the case, I feel the next source of information is if we can reproduce the error on a second computer. Would you be willing to try the same setup on another computer?
Daniel de Gaston
Applications Engineering
National Instruments
07-20-2012 05:12 PM
Thanks I could solve it by doubling the buffer size. Don't think it's the USB issue since it works fine when I run it as simple separate program but when run as thread it fails. Do you think it could be that NI board produces data faster than thread could read when it's switched with main thread.??
Thanks,
Shrikant.
07-23-2012 09:03 AM
Hello,
100kSamples a second is definitely not a speed I think will impede performance. I feel like the latency with USB is enough to make the 100,000 Samples a second with only 100,000 samples for a buffer size. That is just not much when given latency and O/S system delays. I again would recommend increasing the buffer size.
Daniel