[LinuxPPS] How to get interrupt on parallel port working
Bernhard Schiffner
bernhard at schiffner-limbach.de
Mon Sep 22 20:33:38 CEST 2008
On Friday 19 September 2008 19:54:17 Paul Simons wrote:
...
> I am using the parallel port (pin 10 - ACK, pin 24 - ACK ground) and just
> going straight TTL. Everything seems to register fine:
...
> However, no joy:
...
I tried to check this from the beginning.
I connect busy (Pin 11) to ground (Pin 24). I'll explain later why this.
I connect /ACK (Pin 10) to my puls source.
I apply (guaranteed single) negative pulses to the /ACK-Pin (Pin 10).
I test interrupts occuring like this:
bs2:~# cat /proc/interrupts | grep 7:
With a fresh booted Debian Lenny (minimal system):
bs2:~# cat /proc/interrupts | grep 7:
7: 1 XT-PIC-XT parport0
Apply pulses, but nothing increases.
Module partport_pc loaded
Module partport loaded
No module lp
No module ppdev
No /dev/lp0
Next step:
modprobe lp
(creates /dev/lp0)
Apply pulses, nothing increases yet.
Next step:
echo "A" > /dev/lp0
Apply pulses and HERE WE GO!
bs2:~# cat /proc/interrupts | grep 7:
7: 2 XT-PIC-XT parport0
bs2:~# cat /proc/interrupts | grep 7:
7: 3 XT-PIC-XT parport0
First trial of an explanation:
Module lp creates a "line discipline" which is in my case with interrupts
enabled. Enabled doesn't mean useable from the very beginning!
The "lp" line discipline sets a certain type of handshake see
http://www.beyondlogic.org/spp/parallel.htm
This does
1.) write data
2.) wait for busy (Pin 11) = low (already connected to ground, see above!)
3.) make some flagging with strobe (Pin 1)
4.) be ready for the /ACK interrupt to continue with 1.)
If you don't connect the busy (Pin 11) to ground echo "A" /dev/lp0 blocks and
is to be killed by ^C. Interrupts will be counted nevertheless.
If your lp.ko isn't compiled with interrupt enabled, try the ppdev.ko module.
This creates /dev/parport0 and is easy to program from userspace. (ECP-mode
of the parport possible, only single use of parport, interrupt ...) But you
have to program it. See for this:
$KERNELSOURCE/Documentation/parport-lowlevel.txt
$KERNELSOURCE/Documentation/parport.txt
http://www.beyondlogic.org/ecp/ecp.htm
The "lp magic" above seems minimal to me.
Hope this helps!
Bernhard
More information about the LinuxPPS
mailing list