I have a cDAQ 9136 embedded controller running WES7 and I'm calling DAQmx 19.6 from MSVC 2019 using the C API. In the controller I have an NI-9401 digital module and three NI-9215 analogue input modules.
When starting a task (DAQmxStartTask) with 12 analogue inputs spread across the three NI-9215 modules I get the error:
Buffer is too small to fit read data.
Buffer length: 110497
Required Buffer Size in Samples: 265188
Yet the buffer is set to 265188 with DAQmxSetBufInputBufSize, which returns no error. And I've used DAQmxGetBufInputBufSize to confirm this is the configured buffer size.
What's going on here? Is it a DAQmx bug? Do I need to run three synchronised analogue input tasks, one for each NI-9215? Why does it ignore the buffer size I set? If I keep it to 5 channels split over the 3 cards it works ok. But for 6 channels it wants 132594 samples, 7 channels 154693, etc. at a rate of 22099 samples per channel. Interesting to note that 110497 is the max sample rate (samples/second) of the NI-9215.
Any help appreciated.
Solved! Go to Solution.
I worked this out in the end. So for the benefit of somebody else...
This error message refers to the buffer size passed to functions such as DAQmxReadAnalogF64, not the buffer configured for the task itself.
Thanks for posting the solution -- I puzzled over this one a bit but didn't reply b/c I didn't have any useful ideas.
(Probably at least partly because I never use any of the text API's for DAQmx, only LabVIEW, There the memory buffer that returns data from the read function is managed by LabVIEW itself, and that kind of error can't happen.)
Glad you got things working!