Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in ArCOMObject_Bpod/read
#1
Hi Josh,

I'm running into this error fairly often in Bpod sessions > ~150 trials... Any idea what might be the issue? 

I am using the Hifi module to delivery sound stimuli, and am using the BNC input channel(s) to detect licking events (5V TTL) in a head-fixed mouse set-up with:

Bpod r2
Matlab R2021b with Psychtoolbox 3.0.18 installed
Ubuntu 20.04.4 LTS

Index exceeds the number of array elements. Index must not exceed 1.

Error in ArCOMObject_Bpod/read (line 395)
                        varargout{i} = uint8(obj.InBuffer(PosTongueos+nBytesRead-1));

Error in RunStateMachine (line 101)
            opCodeBytes = BpodSystem.SerialPort.read(2, 'uint8');

Error in RunStateMatrix (line 2)
RawEvents = RunStateMachine;

Error in Stage3_FixedLocation (line 300)
    RawEvents = RunStateMatrix; % Run the trial and return events

Error in run (line 91)
evalin('caller', strcat(script, ';'));

Error in NewLaunchManager>LaunchProtocol (line 717)
run(ProtocolPath);
 
Error while evaluating DestroyedObject Callback.
Reply
#2
Hi Og100,

I haven't tested r2021b with Ubuntu yet - but I have a few ideas.

1. Try starting MATLAB with a serial port argument and select the Java serial interface:

Code:
Bpod('/dev/ttyACM0', 'UseJava')
This send communication with the state machine via MALTAB's Java based serial interface instead of PsychToolbox IOPort

2. Try changing line 153 of ArCOMObject_Bpod from:


Code:
obj.Port = IOPort('OpenSerialPort', portString, ['ReceiveTimeout=3, BaudRate=' num2str(baudRate) ',...
OutputBufferSize=' num2str(obj.OutputBufferSize) ', InputBufferSize=' num2str(obj.InputBufferSize) ', DTR=1']);

to


Code:
obj.Port = IOPort('OpenSerialPort', portString, ['ReceiveTimeout=0.05, BaudRate=' num2str(baudRate) ',...
OutputBufferSize=' num2str(obj.OutputBufferSize) ', InputBufferSize=' num2str(obj.InputBufferSize) ',...
DTR=1, PollLatency=0.0001, StartBackgroundRead=1']);

In this case, don't select the Java interface when starting up.

3. (a more radical option) - try the develop branch of Bpod_Gen2. You'll have to remove all references to the master branch from the MATLAB path, and add the develop branch instead. There is also updated state machine firmware on the develop branch of the firmware repo, though the MATLAB software should work with your existing firmware v22. The develop branches are not completely stable, though we're very close to a major release - so any feedback would be more than welcome!

Is there other software running besides MATLAB and the default Ubuntu processes?

Thanks, 

-Josh
Reply
#3
Hi Josh,

Sorry for the delay in getting back to you - 

You're first suggestion (starting Matlab with a serial port argument and using the Java serial interface) seems to have worked! Have been running long behavioural sessions for the past 2 weeks without any issues,

Thanks a lot,
Oli
Reply


Forum Jump: