Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Maximum read/write latency for PCI-DIO-32HS using NI-DAQmx?

Solved!
Go to solution

I've been asked to evaluate using the PCI-DIO-32HS and NI-DAQmx on MacOS X to essentially close a control loop.  My initial concern is whether or not this can run fast enough.

 

So my questions are:  What is the maximum latency from the moment of receiving an external hardware read-data strobe signal, then reading a single 16-bit sample, and sending it up through NI-DAQ to a user-space application?  And, similarly, what is the maximum latency of sending a single 16-bit value from a user-space application down through NI-DAQ, then writing it out a port and asserting an external hardware write-data strobe signal?

 

Thanks. 

0 Kudos
Message 1 of 12
(5,532 Views)
Solution
Accepted by topic author AliasMe

Hi AliasMe,

 

Thanks for posting and welcome to the NI Forums!

 

Do you need to process the data in software, and output a value based on this?  The DIO-32HS (a.k.a. PCI-6533) offers buffered inputs and outputs, but you would have significant latency in your control system if relying on the OS to do the processing.  Since this delay is system dependant, I can't give a specification for the amount of time it would take.  However, bringing the data into memory, processing, and writing back to the card would likely be on the order of several milliseconds.

 

Typically we recommend FPGA in control situations like this, so you can do all of the processing in hardware.  However, if you provide more details about your application we can look into all available options.

 

-John

John Passiak
0 Kudos
Message 2 of 12
(5,510 Views)

Thanks for the reply, John.

 

The exact real-time needs for this are still a bit sketchy (the goal is to bring a nearly 20 year old system up to date).  However I do know that they will require bringing data into our code, processing it, and writing results back out.  This needs to happen once every 10 milliseconds.  So your "several milliseconds" latency estimate, while not particularly surprising, is worrying to me.

 

One suggestion we've received from Apple DTS is to write a device driver to handle the real-time aspects of this problem.  To do that we would need detailed information on how to control the DIO-32HS at the level of the PCI bus interface.  Do you have such documentation?

 

Additionally the system needs to collect two sets of data triggered by external siganls: 256 16-bit values each every 50 milliseconds.  And there is also a requirement to turn the 16 data input lines around and write a 16-bit address value out them, but, again, I haven't received all the details myself, yet.

 

Thanks, again!

 

0 Kudos
Message 3 of 12
(5,498 Views)

The initial replay didn't seem to work.  Also I inadvertantly suggested this was solved.

 

Sorry for any confusion.

 

0 Kudos
Message 4 of 12
(5,496 Views)

Hi AliasMe,

 

I must have completely missed the part where you mentioned OS X, my apologies.  We do not currently provide a driver that supports the DIO-32HS on a Mac, so you would have to look into register level programming using the Driver Development Kit if you want to get it to work (documentation should be included).  I would post in our DDK Forums for advice on getting started.

 

Developing the code would not necessarily be an easy task, and I am still not sure if you could get acceptable latency--I could see the latency possibly being under 10 ms but there are no guarantees when it comes to non-deterministic systems.  Once you find more details, you might also consider posting the big-picture application on the Real-Time Measurement and Control Forum--they could help recommend the ideal hardware to be using if you are interested in going the FPGA route.

 

-John 

 

John Passiak
0 Kudos
Message 5 of 12
(5,463 Views)

Thanks for all the info.  I'll look at the DDK and try to get better details about the project.

 

0 Kudos
Message 6 of 12
(5,458 Views)

I don't think you need to go the DDK way. And I can ensure you that you don't want to go that way unless there is no other way!

My suggestion is to access the 32 DIO lines on a PCIe-6259 (MacPro?) or PCI-6229 (cheaper) on G5.

Then use DAQmx base to access the hardware. You can dig down the board register level with DAQmx base and thus do a lot of things.

We're running controllers at 1kHz without problem and we're accessing DIO lines, AD, DA and a quadrature encoder.

I haven't measured the latency since the board times the acquisition (we write the ouput at time k+1), so everything is handled by the board clock. 

 

Chris 

Message 7 of 12
(5,357 Views)

Hi Chris,

 

Thanks for the post, I agree that it would be much easier to go with hardware that is supported on OSX than to go the Driver Development Kit route.  The M series boards are a good alternative for the 32HS since they also support timed I/O.  It sounded like AliasMe needed to acquire data, process it in the OS, and output the result back to the card with minimal latency, which is where the Real-Time suggestion came from.

 

Are you running a RT controller to achieve the 1 kHz loop rate or processing everything on your PC?  We'd all be interested to hear more about your setup, it sounds like you have the generation "pipelined" so that there is always data available to generate from the previous iteration. 

 

Again, thanks for the input.  I still don't know exactly what AliasMe needed to do with his code, but it's certainly nice to have all options on the table.

 

 

-John

John Passiak
0 Kudos
Message 8 of 12
(5,340 Views)

John,

 

Yes we're running RT controller on OSX (with plain LV). Current machines are fast enough to do soft RT on OSX provided that the board ensure the timing and that your controller is executed  between to board interrupts. I use  the "DAQmx base wait for next sampling clock.vi" to time my controller loop. I presented some of our work at NIWeek 2008. A copy of the slides can be found at the bottom of this page http://lawww.epfl.ch/page4506.html.

 

Chris 

 

0 Kudos
Message 9 of 12
(5,337 Views)

Hi Chris,

 

This looks very cool, thanks for sharing the slides.

 

-John

John Passiak
0 Kudos
Message 10 of 12
(5,320 Views)