Hi Matina,
I can't test the issue because we don't have an Open Ephys in our workshop. It's possible that they released GUI updates that require changes to the analysis code. The info below should help you troubleshoot.
Open Ephys has 8 digital input lines. The GUI software records a timestamp when any of them changes their logic state. Bpod 0.5's "sync" port has 7 lines connected to Open Ephys inputs, which display the current state# of the state machine in binary. The 8th line is connected to the sync board's BNC connector.
For instance, in Bpod state# 3, the 7 lines should read: 0000011, and the BNC line should read 0.
The first line of function OpenEphysEvents2Bpod() imports the Open Ephys event and timing data to MATLAB:
[data, pinChangeTimestamps, info] = load_open_ephys_data(filename);
For each line change, "data" indicates which Open Ephys digital input channel was changed.
For each line change, "info.eventID" indicates whether the associated line went low->high or high->low.
For each line change, pinChangeTimestamps contains the time of the change event, on the Open Ephys clock.
Each time Bpod changes its state, the Open Ephys sync board may register 1 or more line changes. For instance, changing from state#3 to state#4 would generate 3 events:
Position 1: High -> Low
Position 2: High -> Low
Position 3: Low -> High
The OpenEphysEvents2Bpod script converts these events into Bpod event codes:
0000011 = 3
to
0000100 = 4
It then aligns the record of state numbers and timestamps in SessionData.RawData, with corresponding timestamps recorded by Open Ephys.
I'm not sure why you're seeing all 1's. Do the variables returned by load_open_ephys_data() look like they contain the expected logic line transitions?
If not, the error could be in hardware.
The 8th pin on the RJ45 connector is a ground, connecting Bpod to the Open Ephys board. Using a multimeter, if you measure resistance between Bpod ground (you can use the rightmost wire terminal ground) and Open Ephys ground, it should read much less than 1 ohm.
As a last resort, you can handle synchronization manually.
In each state matrix, set a free BNC or wire output channel, to go "high" at the beginning of a trial, and remain high throughout the trial (for instance, by adding {'BNC1', 1} to each state's output actions. If you connect the line to Open Ephys's I/O board, load_open_ephys_data() should return a "high" event + timestamp on each trial start, and a "low" event + timestamp on each trial end. You can use the Open Ephys trial start timestamps to replace Bpod trial start times.
I hope this helps - and I'll update this next time I have a chance to test sync an Open Ephys board.
-Josh