Description
parint is a device driver that uses the PC's parallel port interrupt to timestamp a
TTL signal. The driver's Interrupt Service Routine records the time an ACK signal
occured. I wrote this driver in order to timestamp a shutter TTL output from a
camera we have. For our application non-realtime time stamping is needed.
An alternative to getting a GPS timing board with event timer inputs.
Below are some also contains some performance testing data.
Developed/tested using CentOS 4 ( kernel 2.6.9-78.0.17.EL ).
Documentation is mininal. The driver is very simple, and the testpi user
program illustrates the driver's function. Any one with very basic
device driver knowledge should be able to take this code and use it.
For novices, there are many tutorials on writing linux device driver
using the PC's parallel port as an example hardware.
Making the driver & test code
To compile the driver modules:
# make
To compile testpi and supporting library:
> make -f makefile.app
How to load the module
Note, you may need to remove modules using the parallel port:
# rmmod lp parport_pc parport
1. To make a /dev entry for parint:
# mknod --mode=666 /etc/udev/devices/parint c 67 0
2. manual loading:
# insmod parint.ko
3. manual unloading:
# rmmod parint
testpi
testpi is a user program used to test the driver. testpi demonstrates
how to use the parint driver function calls. I connected pin 10(ACK)
to pin 2 (data out). Then ran 2 copies of testpi. testpi #1 used to "get.time",
and the other generated pulses ("pulse").
Testing using CentOS4/2.6.9-78.0.17.EL on a 2.8GHz Pentium4 on 04Oct2010.
1. rep=1000 usec=1000000 (1.0 sec x 1000)
Graph of ISR_time - outp time, shows ISR service 100 ISRs at 10 usec or better.
2. rep=10000 usec=100000 (0.100 sec x 1000)
Graph of ISR_time - outp_time, shows ISR is usually 10 usec, worst case 45 usec.
3. rep=100000 usec=10000 (0.010 sec x 100000)
Graph of ISR_time - outp_time, shows ISR is usually 10 usec, worst case 80 usec.
4. rep=200000 usec=1000 (0.001 sec x 200000)
(pulse loop ran at about 0.003 ).
Graph of ISR_time - outp_time, shows ISR is usually 10 usec, worst case 70 usec.
Looks like parint could provde ~100 resolution microseconds 99.999% of the time.
I say 99.999% as this is stil a non-realtime solution.