psychopy.org | Reference | Downloads | Github

Parallel Port Trigger Issues

Hi all,

I’m currently in the process of designing an experiment using a modified Sternberg task built with Psychopy, and TMS-EEG. While we have worked out how to trigger the TMS pulse when required, however we cannot work out how to get triggers sent to the EEG amplifier at the start/end of trials.

We are running Linux Mint, and have tried the code on the psychopy page:

port = parallel.ParallelPort(address=0x378)
port.setData(4)
port.readPin(2)
port.setPin(2, 1)

as well as

port = parallel.ParallelPort(address='/dev/parport0')
port.setData(4)
port.readPin(2)
port.setPin(2, 1)

and

parallel.setPortAddress()

We continually get the error messages such as:

‘Runtime error: port address must be set using setPortAddress’

‘No module named parallel’

As well as a warning message saying: Could not initiate port no such file or directory’

Has anyone got any ideas how to tackle this on a linux computer?

Thanks

This is a Windows-style memory address:

port = parallel.ParallelPort(address=0x378)

This is the old-fashioned way of doing things, as mentioned in the documentation, and if it doesn’t have an associated import, then it would also cause the No module named parallel error anyway:

parallel.setPortAddress()

This looks like a proper Linux port location:

port = parallel.ParallelPort(address='/dev/parport0')

although it had curly apostrophes instead of straight quotes in your post.

Yet you get told this: Could not initiate port no such file or directory’

So I would check what your parallel port handle actually is. Look in /dev/ and check that a file called parport0 or similar actually exists. Do you actually have a parallel port driver installed, and so on? (Hopefully someone who knows their way around Linux can help more with this.)

PS:

Hi Michael,

We ended up figuring the issue out. There were a couple of problems:

  1. There was a ‘u’ in front of /dev/parport0 that was added in the preferences tab in psychopy. Removing the u made the address correct which solved the first error in the string of messages in the output.

  2. Typing ‘sudo rmmod lp’ command removed the printer port module which solved the problem of the port already being in use. ‘sudo modprobe ppdev’ was another command to make sure that the parallel port module has been added.

Another point is making sure that the permissions on the system have allowed access to the parallel port.

Thanks,

Sabrina