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/
It 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? :(
Loading
VulpesPosted Sep 2, 2011, 5:58 AM
Anyway, I'm pleased you've figured it out now :)
Alexander Malik KleistPosted Sep 2, 2011, 5:29 AM
I've figure it out though :)
Here's the answer:
The baudrate is 115,2 kbps - BUT I'm calculating the datarate!!!
The used serial communication configuration is 8-N-1, which means everytime I'm sending a data byte, I'm actually sending 10 bits! 1 start bit, 8 data bits and 1 stop bit.
When I'm maxing out, it really are sending 115,2 kbps, which is 115,2 * (8/10) = 92,16 kbps of data. That fits very good with my calculations above.
Thank you again for your fast replies :)
VulpesPosted Sep 2, 2011, 4:27 AM
Alexander Malik KleistPosted Sep 2, 2011, 4:11 AM
Communication is good :) the other device is receiving data just fine - every single byte is received correctly.
It's not that big an issue for me if it's 'only' sending with 91 kbps - but I need some explanation in my report, I'm writing.
The whole project is a part of a school project I'm working on.
VulpesPosted Sep 2, 2011, 3:58 AM
Despite the difference in baud rate, does it seem to be communicating OK with your other device?
Alexander Malik KleistPosted Sep 2, 2011, 2:12 AM
I've tried with comPort.Write(payload, 0, 2048) and it's still ~91 kbps
I've tried with comPort.Write(payload, 0, 4048) and still gets ~91 kbps
Any explanation why it max out at ~91 kbps?
VulpesPosted Sep 1, 2011, 10:32 AM