Solution
The error is caused by the impossibility of routing the reference clock to all the created DAQmx tasks or routes specified. If you are using the
DAQmx Connect Terminals VI, be sure to also use the
DAQmx Disconnect Terminals VI for the terminals that were connected in order to avoid this error when trying to access the same hardware resources in a different DAQmx task or section of your program. You can also manually disconnect all routes by resetting your device in NI MAX.
This error can occur any time separate tasks require access to a shared resource. Therefore it is important that you check to make sure you don't have any unexpected LabVIEW or DAQmx tasks running while you are running/troubleshooting your VI.
If you plan to use multiple subsystems like AI, AO, DIO, or Counter at the same time, you must define the same reference clock for ALL the tasks you are creating, using the NI-DAQmx timing properties
Reference Clock Rate and
Reference Clock Source, which should be set before any other channel configurations (such as triggering and timing).
In order to set these properties, you need to call the appropriate API based on your development environment:
- If you are programming in LabVIEW, you should:
- add a DAQmx Timing Property Node after channel creation
- right-click the property node and select Add element
- select More:Reference Clock:Rate Property and More:Reference Clock:Source Property, as shown in the image below (an example is also attached):
- set RefClk.Src input to the Source Terminal value that was indicated by the error message, for example PXIe_Clk100 (thus, RefClk Rate input should be set to 100 MHz in this case)
- If you are programming in LabWindows™/CVI, you should add the following functions to your code, after channel creation and before configuring task timing:
DAQmxErrChk(DAQmxSetTimingAttribute(TaskHandle,DAQmx_RefClk_Src,"PXIe_Clk100"));
DAQmxErrChk(DAQmxSetTimingAttribute(TaskHandle,DAQmx_RefClk_Rate,100000000.0));