04-20-2023 08:20 AM - edited 04-20-2023 08:31 AM
I have a usecase where the user can stop the task at any point and write different samples and start again. But I face the below error while trying the same.
Error -200288 occurred at DAQmx Write Error.vi
Possible reason(s):
Attempted to write a sample beyond the final sample generated. The generation has stopped, therefore the sample specified by the combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not beyond, the final sample generated. The final sample generated can be determined by querying the total samples generated after a generation has stopped.
Attempted to Write Sample: 0
Property: RelativeTo
Corresponding Value: Current Write Position
Property: Offset
Corresponding Value: 0
Task Name: _unnamedTask<18>
I have noticed that, if I unreserve the task before writing the new samples, the task runs without any issues. Is this the right fix or can this be improved.
Solved! Go to Solution.
04-20-2023 03:26 PM
1. Your code ran just fine for me using a simulated device (PCIe-6341) and DAQmx 20.1
2. Stopping the task should have been sufficient without needing an explicit unreserve. That leads me to 2 speculative thoughts:
I'm wondering if for your combo of device / driver version, you need to allow just a little extra time for DAQmx to fully manage the Stop even though the function call has returned outputs back to you already. I know something like this has come up as an issue when trying to reuse a channel immediately after Clearing a task that used it.
3. Having said all that, an explicit "unreserve" should also be a viable workaround.
-Kevin P
04-25-2023 01:11 AM
Thanks for the inputs, Kevin.
I tried to simulate the same device (PCIe-6341) and tried my code, still it showed me the same error. Even with stall data flow (tried with 10s max) , still no luck.
One difference I see in my setup is that I have DAQmx 20.7.
Anyway, for now I'm retaining my workaround.
- Raj