09-13-2018 12:02 PM
In my lab we have a couple of NI PCIE-6341 cards (with address /Dev4 and /Dev5) that we use to acquire different analog voltage signal.
We were using the two cards in an independent way but recently we wanted to use one single task to synchronize the acquisition on both card.
Researching the NI documentation I found that I had to connect the two card with an RTSI cable and add it to NIMAX.
After this i wrote a simple script using PyDAQmx, performing an acquisition using only one task and it worked, I attach the code to the post.
My problem starts when I try to implement this acquisition on the main software, also written in python using PyDAQmx by another student some years ago.
The difference between my script and the main program are very minimum except for the fact that the card configuration in the main program it's subdivided in different classes which are then called through class inheritance.
When I launch the main program I can see on the CLI this error:
DAQError: Specified route cannot be satisfied, because it requires resources that are currently in use by another route. Property: DAQmx_RefClk_Src Source Device: Dev4 Source Terminal: 10MHzRefClock Required Resources in Use by Task Name: _unnamedTask<0> Source Device: Dev4 Source Terminal: None Destination Device: Dev4 Destination Terminal: RefClockInternal Task Name: _unnamedTask<0> Status Code: -89137 in function DAQmxStartTask
I cannot understand what's causing this since this program uses tasks to control only this two cards since I remove all the code that uses other NI cards that we have in the lab.
I can try to provide also the main program code if necessary but it will take me a bit of cleaning
09-13-2018 07:44 PM
Some more info can be found here (and then follow the link in that article to another link about channel expansion).
This won't be a complete solution, but to help diagnose more clearly, try removing all the Dev5 channels so that the task is limited to channels from a single board. Then DAQmx won't be trying to mess around with routing the Reference Clock, leading to the error you're getting.
If that helps, the next thing I'd probably try is to either reboot or go into MAX and reset all your DAQ boards. Then try again with your multi-board task. No specific theory, just figure it's worth trying with a completely fresh start.
-Kevin P
09-14-2018 04:59 AM
Some more info can be found here (and then follow the link in that article to another link about channel expansion).
I tried to look on c reference manual for those two function ( DAQmxSetRefClkSrc and DAQmxSetRefClkRate ) but could not find them, the link is broke. I will search a little bit more.
This won't be a complete solution, but to help diagnose more clearly, try removing all the Dev5 channels so that the task is limited to channels from a single board. Then DAQmx won't be trying to mess around with routing the Reference Clock, leading to the error you're getting.
I tried running the code without any /Dev5 channel and the Error does not appear, it only appears if I try to acquire even one channel on /Dev5
If that helps, the next thing I'd probably try is to either reboot or go into MAX and reset all your DAQ boards. Then try again with your multi-board task. No specific theory, just figure it's worth trying with a completely fresh start.
I can try to reset all the card, but I will keep it as last result. They were installed not by me so I'm not completely sure if they did anything in particular, but I don't think so because it will be written somewhere.
09-14-2018 07:57 AM
I've never used the "channel expansion" capability to put channels from 2 boards into a single task. I learned other ways to sync 2 boards before that capability came around and have simply stuck with what I knew.
A workaround would be to define separate tasks for the 2 boards. Consider the one on Dev4 as the "master task." It will need to start last. For the other task on Dev5, when you configure DAQmx Timing you'll need to identify the master task's sample clock as its "self.clockSource". I don't know the exact syntax for the python DAQmx API as I'm a LabVIEW guy. It'll be something similar to "/Dev4/ai/SampleClock".
Start the Dev5 task first. Since there aren't yet any sample clock signals coming from the un-started Dev4 task, it won't do anything yet. When you start the Dev4 task, its clock will be shared over the RTSI cable to Dev5. DAQmx will handle the routing for you, and it won't need to mess around with the Reference Clock that causes errors for you.
I've done a lot of board and task sync and rarely consider relying on the Ref Clock. I generally just share sample clocks (and occasionally, but not as often as people expect, triggers.)
-Kevin P
09-14-2018 08:19 AM
@Kevin_Price wrote:
A workaround would be to define separate tasks for the 2 boards. Consider the one on Dev4 as the "master task." It will need to start last. For the other task on Dev5, when you configure DAQmx Timing you'll need to identify the master task's sample clock as its "self.clockSource". I don't know the exact syntax for the python DAQmx API as I'm a LabVIEW guy. It'll be something similar to "/Dev4/ai/SampleClock".
Start the Dev5 task first. Since there aren't yet any sample clock signals coming from the un-started Dev4 task, it won't do anything yet. When you start the Dev4 task, its clock will be shared over the RTSI cable to Dev5. DAQmx will handle the routing for you, and it won't need to mess around with the Reference Clock that causes errors for you.
-Kevin P
This seems to be a good workaround I'm going to test it for sure, the only problem I can foresee is how to start one task before another.
Basically for how it's been done the main program it starts all the tasks (there is another PCIe-4474 on /Dev3) at the same time.
But maybe I can manage, I will keep you posted, thanks!
09-14-2018 09:09 AM
Just FYI, your Dev3 4474 board might be at the root of the Ref Clock error you saw when trying to span a task across Dev4 and Dev5. Another diagnostic step might be to try commenting out any code related to the Dev3 task while trying your original approach where Dev4 and Dev5 channels are in a single task.
-Kevin P
09-14-2018 11:14 AM
Yes, That's what I thought too at the beginning, so I already commented out everything for /Dev3 before opening this discussion.
I will keep on testing and keep you posted