psychopy.org | Reference | Downloads | Github

Dual parallel port issue


#1

Hi,

I have an issue with dual parallel port setup. Basically the second port does not work with PsychoPy for some reason. The OS is Ubuntu 14.04 (64bit). Weird thing is that both ports work with simple C-code.

‘dmesg | grep parport’ gives:

[ 1.335521] parport_pc 00:05: reported by Plug and Play ACPI
[ 1.335564] parport0: PC-style at 0x378, irq 5 [PCSPP]
[ 1.429308] lp0: using parport0 (interrupt-driven).
[ 1.519372] SNX Info : parport2 - PC-style at 0xd050 (0xd040)
[ 1.520124] SNX Info : lp2 port using parport2 (polling).

Now when sending pulses to the ports with the C-code which gives me option to send the pulses directly to memory address (0x378 and 0xd050), the ports work just fine. So I figure the problem lies with the PsychoPy (?).

With PsychoPy, parport0 (0x378) works as it should. But parport2 (0xd050) does not. I don’t get any signal from parport2. I have tried ‘import parallel’ and ‘from psychopy import parallel’ modules. In the script I define my port as follow:

port = parallel.Parallel(0) # replacing ‘0’ with ‘/dev/parport0’ works as well

or

port = parallel.ParallelPort(0) # if using ‘from psychopy import parallel’

So this works. But when replacing ‘0’ with ‘2’ (or ‘/dev/parport2’) I don’t get any signal. I also don’t get any errors. If I use ‘1’ instead of ‘0’ or ‘2’ I get an error message saying that ‘/dev/parport1’ does not exist which is correct because I don’t have parport1.

Any suggestions? Is there a way to force PsychoPy to send signal to 0xd050? Well, parallel.Parallel(2) should do that, right?


#2

Just a thought, have you tried passing the address in to the constructor?:

port1 = parallel.ParallelPort(address=0x378)
port2 = parallel.ParallelPort(address=0xd050)

#3

Yes I have. For some reason PsychoPy does not understand that it is the address. It converts the address. For example address=0xd050 is converted to /dev/parport53328.

OSError: [Errno 2] No such file or directory: ‘/dev/parport53328’

Anyway, I installed a new parallel port. And voilà. Both ports work as they should. Maybe the issue was that the second parallel port was a PCI-e card and I switched that to a PCI card… Also, I noticed that previously I had the second parallel port working as ‘polling’ and now the new one works as ‘interrupt-driven’.

[ 1.519372] SNX Info : parport2 - PC-style at 0xd050 (0xd040)
[ 1.520124] SNX Info : lp2 port using parport2 (polling).

->

[ 1.511151] parport1: PC-style at 0xd0f0, irq 18 [PCSPP,TRISTATE,EPP]
[ 1.604867] lp1: using parport1 (interrupt-driven).