Error -89137 When Using Multiple NI-DAQmx Tasks or Terminal Routes

Updated Apr 28, 2023

Reported In

Hardware

  • Multifunction I/O Device

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

  • I have created a DAQmx Task that references multiple devices. I keep seeing error -89137. How can I fix this?
  • I am programming multiple tasks or connecting multiple terminal routes in an NI-DAQmx device. However I am getting the error shown below. Why is this happening?
Error -89137: Specified route cannot be satisfied, because it requires resources that are currently in use by another route.


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. This will prevent error -89137 when trying to access the same hardware resources in different DAQmx tasks or section of your program. You can also manually disconnect all routes by resetting your device(s) in NI MAX.

This error can occur any time separate tasks require access to a shared resource. Therefore, it is important that you verify that there aren't any unexpected LabVIEW or DAQmx tasks running while you are executing/troubleshooting your VI.

If you plan to use multiple subsystems like AI, AO, DIO, or Counters at the same time, you must define the same reference clock for all of the tasks created. Do this by 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:
  1. Add a DAQmx Timing Property Node after channel creation
  2. Right-click the property node and select Add element
  3. Select More:Reference Clock:Rate Property and More:Reference Clock:Source Property, as shown in the image below (an example is also attached):
DAQmx Timing Properties.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
 
  1. 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)); 

 
 

Additional Information

The reference clock can be set either implicitly or explicitly. When using a reference clock with NI-DAQmx devices, the same reference clock must be set for every task on that device. If the reference clock is not explicitly set, the first task to commit will implicitly define the reference clock for the whole card. Thus, if another task tries to explicitly set a different reference clock later, that clock will try to use the reference clock circuitry which is already in use by the first task.

This can also manifest when using channel expansion on certain DSA, S Series, and simultaneously sampling X Series cards. This is because the channel expansion synchronization is completed using a reference clock from the chassis.