09-10-2012 10:31 AM
We would like to use the analog triggering functions of the PCIe-6320 under Linux to time tag external events.
I have no experience with the MH DDK but have been told this is what we would need to implement the functions we want. We plan on using Fedora Linux and we are targetting kernel 2.6.31 with the PREEMPT_RT patch applied. We may consider slightly more recent kernel versions. The PREEMPT_RT patch is used to greatly improve determinism in the system and get real-time responses to some external events.
Here is what we wish to do in more details:
We wish to route at least two analog inputs to the comparator, then route the output of the comparator to a digital input which in turn would create a PCIe interrupt. The interrupt software handler would than time tag that event for our application purposes. We need the comparator threshold to be software programmable in level and slope. We are also interested in using the Watchdog Timer feature of the board.
Our application is written in C/C++.
Would the above be feasible? Please provide comments and instructions how we should address our requirement.
Thanks!
09-10-2012 02:27 PM
Patof wrote:
We wish to route at least two analog inputs to the comparator, then route the output of the comparator to a digital input which in turn would create a PCIe interrupt. The interrupt software handler would than time tag that event for our application purposes. We need the comparator threshold to be software programmable in level and slope. We are also interested in using the Watchdog Timer feature of the board.
An X Series device only has one comparator, and so to gurantee that a trigger condition is always detected, each analog signal requires its own comparator (and thus its own X Series device).
If all of the analog signals share the same trigger condition (eg all are rising slope crossing 3 V), then more than one channel may be used, but the hardware only routes one channel at a time to the comparator. In this scenario, it is possible that a trigger condition would not be detected. This can happen when one channel is routed to the comparator while the other exhibits the trigger condtion.
If the signals don't change their trigger condition during the application run-time, you can also externally modify them with a custom analog circuit. By converting them to make 0 - 5 V transitions on their conditions, you can connect these TTL signals to the digital port and use the digital change detection subsystem on the device to generate interrupts instead.
Depending on the nature of the timestamps you require, you may also want to consider using the on-board counter-timers to measure the time between events. If the comparator is routed to a counter, the hardware can measure the time between events (using its 100 MHz oscillator), requiring only a single accurate intial timestamp from the OS, time server, or other time source (1588, PSS, etc).
The watchdog timers are fully usable from the MH DDK, and they are demonstrated in dioex6.cpp. If you decide to use multiple X Series devices, watchdog events can be routed betwen boards via cabling so that all digital output lines are triggered on a single event.
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
09-11-2012 10:52 AM
Thanks for the answer!
We need to generate a software interrupt from an external analog signal with a given threshold and slope. The interrupt handler will read the IRIG-B time from another board in the system. We rely on IRIG-B for event time stamps and synchronization.
I am not familiar with the MHDDK. I would like to have an idea of the effort required to implement the functions I have described using MHDDK on Linux. Like I mentionned, we plan on using Linux kernel 2.6.31 with the PREEMPT_RT patch. Could you provide comments on that matter? I need to evaluate the amount of time I will need to spend to deploy and use MHDDK for the PCIe-6320.
Thanks,
Stephane
09-11-2012 11:56 AM
Patof wrote:
I am not familiar with the MHDDK. I would like to have an idea of the effort required to implement the functions I have described using MHDDK on Linux. Like I mentionned, we plan on using Linux kernel 2.6.31 with the PREEMPT_RT patch. Could you provide comments on that matter? I need to evaluate the amount of time I will need to spend to deploy and use MHDDK for the PCIe-6320.
There are two factors to consider when writing a driver for your specific application:
The MHDDK for X Series offers the following behavior out-of-the-tarball:
There are two notably missing pieces and one item to consider:
To estimate the time for these three, here are my recommendations:
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
09-11-2012 01:36 PM
What is the latest kernel version MHDDK is compatible with? Am I going to be able to build the kernel module and the examples under Fedora? Do I need NI-VISA?
09-11-2012 03:08 PM
Patof wrote:
What is the latest kernel version MHDDK is compatible with? Am I going to be able to build the kernel module and the examples under Fedora? Do I need NI-VISA?
The Linux kernel module distributed with the MHDDK supports kernels as late as 2.6.37 (we tested the X Series DDK with openSUSE 11.4 before releasing it), and Steven outlined changes necessary to add support for 2.6.39 in the DDK Programmer's Group [1]. In testing with openSUSE 12.1 later, these same changes worked with kernel version 3.2, with some minor updates to the supporing init.d script nirlp.
Yes, you will build the kernel module and examples on your host OS. By using the kernel module, you will not need NI-VISA.
[1] DDK Programmer's Group :: Getting MHDDK to work with Linux Kernel 2.6.39
https://decibel.ni.com/content/docs/DOC-17855
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)