Hello,
I am encountering a bug where Bpod freezes in the middle of a protocol: valves do not open/close, the trial does not advance, and the Bpod Console displays a single state with no transitions. This happens on only one of two Bpod machines that I have, despite the fact that they are running the exact same protocol. (They are, however, connected to different hardware, as I describe below.) I have to Ctrl+C in order to end the program, and when I do, the following error message is printed:
Operation terminated by user during ArCOMObject_Bpod/write (line 295)
In SendStateMachine (line 333)
BpodSystem.SerialPort.write(ByteString(i), 'uint8'); % send byte-wise, to avoid
HW timer overrun
In DistributionalRL_6Odours (line 236)
SendStateMachine(sma); % With TrialManager, you can send the next trial's state machine while the
current trial is ongoing
In run (line 91)
evalin('caller', strcat(script, ';'));
In NewLaunchManager>LaunchProtocol (line 748)
run(ProtocolPath);
Interrupt while evaluating DestroyedObject Callback.
It appears that Matlab is failing to write information to the serial port, but I have no idea why that might be. This Bpod receives TTLs from a microscope in order to perform synchronization. It also sends a voltage out to trigger the microscope. Interestingly, the problem appears worse when the microscope is running (and Bpod is receiving TTLs). In this case, Bpod almost always freezes after exactly 31 trials. (If I run a slightly different protocol, it becomes ~30 trials, but a similar amount of time and TTLs.) However, it is worth noting that every so often (perhaps 10% of attempted runs?), the program does run successfully until completion, even when the microscope is also running. When the microscope is not running, Bpod generally runs longer without errors, and tends to have a higher success rate, but nonetheless still sometimes fails in the same manner, after around 80 trials. The other Bpod, which runs without error, is not connected to a microscope and never receives TTLs, but is otherwise configured in exactly the same way.
Perhaps related to this issue, I sometimes get a different error on the same Bpod State Machine:
Error using ArCOMObject_Bpod/read (line 359)
Error: The USB serial port did not return the requested number of bytes.
Error in TrialManagerObject/startTrial (line 89)
SMA_Confirmed = BpodSystem.SerialPort.read(1, 'uint8');
Error in DistributionalRL_6Odours (line 189)
TrialManager.startTrial(); % Start next trial's state machine (call with no argument since it was
already sent)
Error in run (line 91)
evalin('caller', strcat(script, ';'));
Error in NewLaunchManager>LaunchProtocol (line 748)
run(ProtocolPath);
359 error('Error: The USB serial port did not return the requested number of bytes.')
Here, the problem is again with serial communication between Matlab and Bpod, but at the read step. I suspect these are related somehow, but I don't know in what way.
I have taken a variety of steps to debug (some of which are suggested in this thread), but none of them have been successful. They have been:
- 1. Re-installing the Bpod software
- 2. Re-uploading the firmware (v22). Verified that upload was successful through the USB native port.
- 3. Changing out the USB cable from Bpod to computer
- 4. Powering Bpod with a separate 12V DC adapter, as opposed to just the USB
- 5. Disabling unused inputs in the Bpod Console
I would greatly appreciate any help you could provide!
Specs:
Bpod State Machine version 0.8
Latest Gen2 Bpod software
Bpod firmware version 22
Matlab 2019b
Inspiron 3847 desktop with an Intel i7 processor and 16 GB of RAM
64-bit Windows 10 Pro OS
PsychToolbox is installed
Bpod is communicating with an 8-channel valve driver module and a port interface + valve
Only port 1 is selected in Bpod Console > Settings > Ports, corresponding to the lick sensor input
Other USB input is disabled in Bpod Console > USB module configuration menu
Only other USB devices connected to the computer are standard keyboard, mouse, and speakers