Fail to communicate with PR655 on Linux

Hi Mario,

I did UpdatePsychtoolbox today, then try connecting the PR655 with matlab. The 'Lenient' keyword to the 'OpenSerialPort'
options was already included in PR655Init.m, so the port was opened but with an error message:

>> g_serialPort = IOPort('OpenSerialPort', portNumber, 'Lenient');
Error setting receive latency for device /dev/ttyACM1 to low latency mode - Operation not supported(95).

Then, I tried these lines

rm = 'PHOTO';
for i = 1:5
IOPort('write', g_serialPort, rm(i));
end

,and found matlab remained busy. Actually, even the first letter 'P' was not sent out. I am sure the port number is correct, which is /dev/ttyACM1. What is the unsupported low latency mode?

Thanks!
I think Matlab can recognize the ports, because I managed to communicate with the Bits# in Matlab (suggested by Jakob from CRS):

1. Make a file called "java.opts" containing the line:
­Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0:/dev/ttyACM1

2. Place the file in the directory to start MATLAB from: $matlabfolder/bin

3. Navigate to that folder and run ./matlab

Below is the message for connecting the Bits#

>> s = serial('/dev/ttyACM0');
>> fopen(s);
>> fprintf(s,['#ProductType' 13]);
>> disp(fscanf(s));
#ProductType;Bits_Sharp;


But if I try PR655, the only thing I can do is to kill Matlab...Do I also need to join a particular group (like dialout) for PR655?

--- In psychtoolbox@yahoogroups.com, "ptbmin" <ptbmin@...> wrote:
>
> Hi Mario,
>
> I did UpdatePsychtoolbox today, then try connecting the PR655 with matlab. The 'Lenient' keyword to the 'OpenSerialPort'
> options was already included in PR655Init.m, so the port was opened but with an error message:
>
> >> g_serialPort = IOPort('OpenSerialPort', portNumber, 'Lenient');
> Error setting receive latency for device /dev/ttyACM1 to low latency mode - Operation not supported(95).
>
> Then, I tried these lines
>
> rm = 'PHOTO';
> for i = 1:5
> IOPort('write', g_serialPort, rm(i));
> end
>
> ,and found matlab remained busy. Actually, even the first letter 'P' was not sent out. I am sure the port number is correct, which is /dev/ttyACM1. What is the unsupported low latency mode?
>
> Thanks!
>
Good. I'll add it to all PRxxxInit functions for the next beta update.
-mario

--- In psychtoolbox@yahoogroups.com, "ptbmin" <ptbmin@...> wrote:
>
>
>
> --- In psychtoolbox@yahoogroups.com, "Mario" <mario.kleiner@> wrote:
> >
> >
> >
> > So communication with the device fails with both IOPort() and Matlab's serial()? It both times ends with a hang of Matlab?
> >
> > Looks as if the blocking write hangs for some reason. You can try if any of these helps:
> >
>
> > Add DontFlushOnWrite=1 to the config string in PR655init, so that it reads: 'Lenient DontFlushOnWrite=1'
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This really works! Thanks!
>
>
> > If that doesn't help, change the IOPort('Write', ....) call to add the non-blocking write flag 0 -> IOPort('Write', ..., rm(i), 0);
> >
> > We had a similar issue with some misbehaving serial port devices on MS-Windows (message #10537), maybe this is some similar problem with the PR655. I assume the PR655 is connected via USB?
> >
> > -mario
> >
>