Hello Malda,
In reply to your item 1:
The behavior session is "running" between the time you click the "Start" button in the launch manager, and the time you click the "stop" button on the Bpod Console GUI to end the session.
You're correct that you would miss the first logic edge if you start photometry before the Bpod session.
I'd solve the problem by creating an extra state on the first trial of your session (or a special trial consisting of a single state):
sma = AddState(sma, 'Name', 'WaitForPhotometry', ...
'Timer', 1,...
'StateChangeConditions', {'BNC1High', 'myNextState'},...
'OutputActions', {});
During the WaitForPhotometry state, you'd start the photometry system. That way you capture your first edge, but the photometry system is running prior to the first actual trial.
The pause button on the GUI does not pause mid-trial. To keep the trials consistent, it schedules a pause for the next break between trials. Events are not captured during a pause.
In reply to your item 2:
All events (including incoming TTL pulses) are timestamped with respect to trial start time. Each trial start time (with respect to session start time) is separately included in the data. If your photometry system has a TTL interface with 10kHz sampling or better, you can set up any free digital output channel as a "sync" channel so that trial start and end times are also timestamped on the photometry system clock. You'd set that up from the settings menu (wrench icon on the Bpod console GUI) and then the "sync" icon.
In reply to your item 3:
To output a square or pulse waveform on trigger, you can set up a looping global timer as shown in this example.
Please let me know if this was the info you were looking for.
Thanks,
Josh