Calculate baudrate from serialport!

Sep 1 2011 9:33 AM
Hi,

I've plugged in a USB bluetooth dongle into my computer, and I've made a virtuel seriel commport app - and I can communicate just fine with my other bluetooth device, through serial port profile!

The problem is the baudrate, is I can se from this topic: http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesvbcs/thread/f04f57d5-0508-437b-9780-92c621272729/

I
t doesn't matter what I set the baudrate to, because it's a virtual connection! So I've tried to calculate the baudrate, sending a long byte-array many times and measure how long time it takes, by using the stopwatch class!

comport.WriteBufferSize = 1024;
sw.Start();
while (i<500)
{
        comport.Write(payload, 0, 1024);
        i++;
}
sw.Stop();

Where payload is a 1024-byte array!

The elapsed time is ~44700 ms, which gives me a baudrate of:
500*1024*8/44700 = 91.63 kbps

The baudrate of the receiving device is 115.2 kbps, why doesn't this fit with my calculations?

I've tried with different WriteBufferSize's and different count-characters (1024, 512, 256, 64, 32 and 16), and I get these results:
 
16 -> ~ 9 kbps
32 -> ~ 19 kbps
64 -> ~ 34 kbps
128 -> ~ 68 kbps
256 
-> ~ 91 kbps
512 -> ~ 91 kbps
1024 -> ~ 91 kbps

How come it's max with 91 kbps? :(

Answers (7)