I am trying to take analog readings on a Teensy 3.2 and send them to a Windows 10 computer via Serial.write. I am sending the data as soon as it is available. I am running into a problem where the data being read by the computer is occasionally being delayed. After the writing is initiated, somewhere between 17,000 and 22,000 bytes are written before there is a pause. After that, there is a pause every 8192 bytes. The Teensy code is running at a speed that there is, on average, one byte being written approximately every 10 microseconds. The pause that occurs is on the order of 30 to 40 milliseconds (which is a huge difference). I have experimented with changing the number of bytes being written at a time from 16 to 32 to 64 to 128 and still run into the same problem. Using an IntervalTimer at 750 microseconds changes the data being sent between pauses to 16384. Changing the timer to 1000 microseconds changes the data being sent between pauses to 49152. It's not lost to me that these values are all powers of two.
Does anyone have any insight as to where the delay is coming from? Is it from the Teensy or from the computer? Is there a specific recommended data rate that I should stay below? If my calculations are correct, 12.5 Mb/s translates to less that one microsecond per byte.
Thanks
Does anyone have any insight as to where the delay is coming from? Is it from the Teensy or from the computer? Is there a specific recommended data rate that I should stay below? If my calculations are correct, 12.5 Mb/s translates to less that one microsecond per byte.
Thanks