Hi Josh,
the way we connect bpod, pulse pal and NUC is listed in this wiki: https://gitlab.com/sainsbury-wellcome-centre/delab/bpod-auto/-/wikis/interaction-with-other-system-(Syncing-and-Triggering)#opto-triggering
This is the part of the code that writes to PulsePal. We then use BNC output to trigger this pre-saved program when it enters the specific state. The digital output from channel 2 feeds into BNC IN on bpod to serve as a feedback. The state bpod gets stuck on is not always the same, but after we lower the frequency of writing to PulsePal from every several trials to only once in every session, the freezing issue hasn't happened again -- just made the change yesterday, so this only holds true for the 6 sessions today 🙂. So it seems like if we try to write to pulse pal frequently, then bpod might get stuck when writing to pulse pal, which might be a problem with the way we connect bpod to pulse pal?
load ParameterMatrix_Example.mat; % Loads the default parameter matrix
Fs = 1000;
this_trig_onset_wave = extract_laser_onset_trig(obj.settings.opto_info.laser_onset_type,Fs);
obj.opto_trial_info.fixed_duration = obj.settings.opto_info.fixed_duration(2); % 1s, not including ramp down
fix_duration_wave = [this_trig_onset_wave,ones(1,0.97*Fs),linspace(1,0,0.1*Fs)]; %30ms onset ramp, 970ms steady output, 100ms ramp down
ParameterMatrix(2:13, 3) = {0 5 0 obj.opto_trial_info.fixed_duration 0 0 0.25 0 0 1 0 1}; % Set output channel 2 parameters
ParameterMatrix{15,2} = 1; % channel 1 use pulse train 1
ParameterMatrix{15,3} = 0; % channel 2 use default TTL
ParameterMatrix{13,2} = 1; % both channel 1 and 2 are using trigger input 1
ParameterMatrix{13,3} = 1; % both channel 1 and 2 are using trigger input 1
ProgramPulsePal(ParameterMatrix); % Send matrix of parameters to Pulse Pal
SendCustomWaveform(1, 1/Fs, fix_duration_wave); %set output channel 1 to use this custom train 'fix_duration_wave' (our analog waveform)
Best,
Cong