Hi Josh,
I recently tried to use the latest version of Gen2 repository and StateMachine-Bpod0_789 on Arduino Due. I experienced a serial reading error in some cases, similar to
https://sanworks.io/forum/showthread.php?tid=120. For the first day, no error came out (8 animals, 40 minutes every day). On the second day, the error came out for 6th animal after running about 10 minutes. On the third day, the error started to show up for the 2nd animal. The Due board and USB cable are fine, as I even changed with the entire new device and cable. The protocol was running on windows 10 and Matlab 2019a. The Psychtoolbox is well installed.
RewardAmount=0.03;
deliverWater={'PWM4', 255};
ChangeState='BNC1High'; % PWM11
sma = NewStateMatrix();
sma = SetGlobalCounter(sma, 1, ChangeState, N_press(currentTrial));
sma = AddState(sma, 'Name', 'WaitForPress', ...
'Timer', 0,...
'StateChangeConditions', {'GlobalCounter1_End', 'WaitForLick'},...
'OutputActions', {}); % didn't work in previous Bpod version
sma = AddState(sma, 'Name', 'WaitForLick', ...
'Timer', 0,...
'StateChangeConditions', {'Port1In', 'Water'},...
'OutputActions', {});
sma = AddState(sma, 'Name', 'Water', ...
'Timer', RewardAmount, ...
'StateChangeConditions', {'Tup', 'exit'}, ...
'OutputActions', deliverWater);
Error using ArCOMObject_Bpod/read (line 367)
Error: The USB serial port did not return the requested number of bytes.
Error in RunStateMachine (line 42)
SMA_Confirmed = BpodSystem.SerialPort.read(1, 'uint8');
Error in RunStateMatrix (line 2)
RawEvents = RunStateMachine;
Thank you in advance,
Lei