Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

java - Android Bluetooth Serial RFCOMM low baud rate / slow transmission

I'm working on an Android Bluetooth project to send and receive data from a custom made hardware. I used Bluetooth Chat Sample in SDK as basis.

I realized that there is no way to change baud rate on Client (Android phone) and baud rate will depend on hardware. I tried setting different baud rates on hardware and none met our expectations;

Fastest i can get is 91Kbps (when baud rate is set to 2.7Mbps ~ 910Kbps). Using minimum baud rate (115Kbps) i get 43Kbps. I tried using different phones and it's the same. I need to transfer 170KB data per second to hardware.


Specifications
Protocol: Synchronized or generated data is sent to hardware using packages of maximum 520 bytes size. Hardware sends verify command after each package recieved and approved then phone sends next data package.
Client: Android 2.3.3, Samsung galaxy w i8150, Bluetooth v3.0, RFCOMM
Hardware: Custom, Bluetooth v2.1 BlueGiga WT11i


I'm totally confused.. Can it possibly be a problem caused by Android or Bluetooth device on the phone? I wonder what the maximum baud rate is? Is there a way to speed up the transmission (like increasing maximum package size, or sending all packages without waiting for hardware verify commands).


Edit
After changing the package size to 4160 Bytes, Throughput has increased to 254Kbps. I'm trying to figure out the optimum package size to reach 1.5Mbps. I appreciate any suggestions

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Firstly changing the baud rate on the Bluetooth RFCOMM / Serial Port protocol should not make a difference, since it is not a real serial port but just an emulation. (Specific manufacturers could so something special with it but Bluetooth in general or Android does not use the parameter to control over the air bit rates)

The factors that effect the data rate over SPP will be the size of the packets, the practical max data rate you can get over Bluetooth and how fast the receiver is reading / and how frequently the sender is sending. For the packet size you could look at internal documentations or try different sizes to reach an optimal number for your application. Also I would suggest sending multiple packets (or all) until the stream can send data continuously, similarly read continuously.

The main issue here for you seems to be the practical throuput you can achieve over Bluetooth. If you are using the non-EDR versions as you have mentioned in your question the theoretical speed at the very low level is 720Kbps , and adding protocol and application over heads as well as RFCOMM protocol overhead you could get max around 450-500 Kbps.

If you have access to both devices that are +EDR I.e Bluetooth version 2.0 or more + EDR then you can expect application throuput in the order of 1.2 to 1.5 Mbps ( theoretical over the air bit rate being 2.0 or 3.0 Mbps)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...