how to find start and stop commands in a serial stream