Hi,
I am currently using Bpod 0.5 firmware. Instead of communicating Bpod with a PC (running Matlab), I am running the Bpod connected with another Arduino board (controller) which has the same functionality with the Matlab (i.e., Handshake, Send and run state matrix, receiving Events, etc). In this way, I have to change the Bpod firmware from 'SerialUSB' to 'Serial1' to communicate with the controller (actually, that's the only change for the Bpod firmware). The controller can successfully handshake with Bpod, however, the Bpod was stuck when receiving state matrix; it can receive the 'P', but not the following matrix.
when I change the code from timer interrupt way (which is how Bpod is running)
Timer3.attachInterrupt(handler);
Timer3.start(100); // Runs every 100us
to loop with delay to run the handler
void loop() {
handler(); // ~30 us?
delayMicroseconds(70);
}
It runs well. The controller can Send, run and receive events successfully and Bpod runs the state matrix well. That's also the reason why I said the controller has the same functionality with the Matlab code. But the timing of this way is not that precious due to the variable handler() running time. So I still want to use the timer one...
It seems that the Timer is incompatible with Serial1 (or 2, 3)? Anyone has this problem before? Thanks a lot.
Best,
Yao