Timing issue when reading from serial port

OS: Mac OS 10.14
PsychoPy version : 2020.1.2.
Standard Standalone? (y/n) : yes
What are you trying to achieve?: record multiple responses and RT in from button box through serial port

What did you try to make it work?: using pyserial in a code component to read in the serial input [e.g. ser.read().decode(‘ascii’) in the each frame tab of one routine] from the response box (with a serial-to-usb adapter), I’m able to get the key presses and using the countdown timer I’m able to get the RT, however, this seems to mess up the transition between routines and therefore leads to dropped frames.

What specifically went wrong when you tried that?: Routines get ‘stuck’ (even in ones where no input is required) and don’t follow the set duration (despite being green in builder view). Looks like the serial input overrides the timing setting somehow - if i press the buttons non-stop the routines do follow the max duration set, but if I only press once (or none at all), there are no transitions. I assume this is a problem with timing window flips?