I need to transmit multiple 8-byte-packets over bluetooth-serial link. I am using JY MCU bluetooth-serial module. On the PC side, I have a C# application running that communicates with the COM port.
Considering 115200 baud, each 8 byte packet should take 8*8/115200 = 0.555 milliseconds.
The problem is that one in every 4 packets takes up to 39 milliseconds which completely destroys all the timing.
For measuring times, I am using stopwatch component of .net framework. output from C # application:
Sample # 583 : 39.126841990471 ms
Sample # 584 : 0.7883273789593 ms
Sample # 585 : 0.93885067781563 ms
Sample # 586 : 0.884708368788226 ms
Sample # 587 : 8.65278575619526 ms
Sample # 588 : 1.05558303203074 ms
Sample # 589 : 0.870116824511337 ms
Sample # 590 : 0.888932236868378 ms
Sample # 591 : 39.0876752137277 ms
Sample # 592 : 1.02639994347697 ms
Sample # 593 : 0.820198383564084 ms
Sample # 594 : 0.960737994230964 ms
Sample # 595 : 15.2051571125331 ms
Note that each sample contains 8 bytes of data