Error in ArCOMObject_Bpod/read

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

We are running into an error periodically (unpredictably) that crashes the behavior session.

Running Fedora 26, Matlab 2017a

Note that we are running two Bpods at a time.  We are manually specifying the USB port when running Bpod.  Sometime one module crashes, sometimes both.  When this error occurs, the Bpod USB connection seems to be reset (not sure if this the cause or the effect of the error); the timestamp of /dev/ttyACM0 is reset to the current time.

Matlab error message:

Code:
Index exceeds matrix dimensions.

Error in ArCOMObject_Bpod/read (line 304)
                        varargout{i} =
                        typecast(uint8(ByteString(Pos:Pos+(nValues(i)*4)-1)),
                        'uint32'); Pos = Pos + nValues(i)*4;

Error in RunStateMachine (line 239)
        TimeStamps = double(BpodSystem.SerialPort.read(nTimeStamps, 'uint32'));

Error in RunStateMatrix (line 2)
RawEvents = RunStateMachine;

Error in PoleAuditory (line 548)
    RawEvents = RunStateMatrix;

Error in run (line 86)
evalin('caller', [script ';']);

Error in RunProtocol (line 112)
            run(ProtocolRunFile);

Error in poleAuditoryObj.start (line 2485)
            RunProtocol('Start', 'PoleAuditory','');

Thanks in advance,
Dan
Reply
#2
Hi Dan,

Are you running each Bpod in a separate instance of MATLAB?
If not, does this fix the problem?

Thanks,
-Josh
Reply
#3
(10-18-2017, 07:31 PM)Josh Wrote: Hi Dan,

Are you running each Bpod in a separate instance of MATLAB?
If not, does this fix the problem?

Thanks,
-Josh

Hi Josh,

Yes, we are running separate instances of Matlab.

Dan
Reply
#4
Hi Dan

Do you have PsychToolbox installed? 
If Psychtoolbox is not installed, installing it may fix your issue.
If it is installed, switching to MATLAB's Java serial interface may fix it (at the expense of latency).
To do this, provide a second argument when starting Bpod:
Bpod('/dev/ttyACM0', 'ForceJava');

If that doesn't resolve it, you can send your protocol code to support@sanworks.io, and I'll try to replicate the error you're seeing.
Reply
#5
(10-19-2017, 10:59 PM)Josh Wrote: Hi Dan

Do you have PsychToolbox installed? 
If Psychtoolbox is not installed, installing it may fix your issue.
If it is installed, switching to MATLAB's Java serial interface may fix it (at the expense of latency).
To do this, provide a second argument when starting Bpod:
Bpod('/dev/ttyACM0', 'ForceJava');

If that doesn't resolve it, you can send your protocol code to support@sanworks.io, and I'll try to replicate the error you're seeing.

We do have Psychtoolbox installed and it is being used for serial communication.  I will try to force the Java mode, however we would rather not sacrifice latency if possible.

Will update this thread with our results.

Thanks,
Dan
Reply
#6
Hello,

So this error magically went away for a few weeks but has now come back with a vengeance.  The error seems to occur after some random number of trials (sometimes after many, sometimes after few).

We have tried restarting the computer, using different USB ports, and even a new USB PCI card.  This has been happening on two BPods out of four that we have.

The other two BPods, running concurrently with identical code, seem to be running just fine and we have never seen this error on them.

Any thoughts?

Dan
Reply
#7
Hi Dan

Official support for multiple Bpods in a single MATLAB instance is a priority, and will be released in the coming year (hopefully in the spring).
Support will necessitate a revised version of the Bpod object, containing the state machine assembler and all other code that currently interacts with the global variable BpodSystem. This encapsulation will enable us to ensure that operations of the separate rigs do not interfere with each other at the level of calls to the file system, or calls to the hardware. Unfortunately, this update will necessitate a revised syntax for behavior protocols. 

e.g. TrialEvents = StateMachine1.runStateMachine() instead of TrialEvents = RunStateMachine()

It's hard to guess what's causing your current issue, especially since it isn't present on your second set of (otherwise identical) machines. 
One possible culprit for dropped data is a faulty USB cable, and/or its mating USB connector on the Arduino board. That being said, if you do not see the issue when you run either of the Bpods individually, it's likely something else. 

Is it one of the Bpods of the pair that always crashes? Or is it either at random?
If you swap the Bpod and/or USB cables with the machines on your second computer, does the problem move with it?

-Josh
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)